File simplesamlphp.spec of Package simplesamlphp

#
# spec file for package simplesamlphp
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%define httpd_group www

Name:           simplesamlphp
Version:        1.19.6
Release:        0
Summary:        SAML IDP/SP written in PHP
License:        LGPL-2.1-only
# FIXME: use correct group or remove it, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group:          Networking/WWW
URL:            https://simplesamlphp.org
Source0:        %{name}-%{version}.tar.gz
Requires:       httpd
Requires:       mod_php
Requires:       mod_ssl
Requires:       php-ldap
Requires:       php-xml
Requires:       policycoreutils-python
Requires(pre):  shadow
Requires(pre):  group(www)
# Requires(pre):  policycoreutils-python-utils
BuildArch:      noarch

%description
SimpleSAMLphp is an award-winning application written in native PHP that deals
with authentication. The project is led by UNINETT, has a large user base, a
helpful user community and a large set of external contributors. The main focus
of SimpleSAMLphp is providing support for:

    SAML 2.0 as a Service Provider (SP)
    SAML 2.0 as an Identity Provider (IdP)

For further information, see the documentation at
https://simplesamlphp.org/docs/.

%prep
%setup -q

%build

%install
mkdir -p %{buildroot}%{_sharedstatedir}/%{name}/log
mkdir -p %{buildroot}%{_sharedstatedir}/%{name}/metadata
mkdir -p %{buildroot}%{_sharedstatedir}/%{name}/config
mkdir -p %{buildroot}%{_sharedstatedir}/%{name}/data
mkdir -p %{buildroot}%{_sharedstatedir}/%{name}/cert
install -d %{buildroot}%{_sharedstatedir}/
cp config-templates/* %{buildroot}%{_sharedstatedir}/%{name}/config/
cp metadata-templates/* %{buildroot}%{_sharedstatedir}/%{name}/metadata/

%pre
#semanage fcontext -a -t httpd_sys_content_t '%{_localstatedir}/lib/simplesamlphp(/.*)?'
#semanage fcontext -a -t httpd_sys_rw_content_t '%{_localstatedir}/lib/simplesamlphp/data(/.*)?'
#semanage fcontext -a -t httpd_sys_rw_content_t '%{_localstatedir}/lib/simplesamlphp/log(/.*)?'

%post
#restorecon -R %{_localstatedir}/lib/simplesamlphp

%postun
# keep the labels, as uninstall + restorecon
# may result in admin revealing sensitive data by mistake.
#    semanage fcontext -d -t httpd_sys_content_t '/var/lib/simplesamlphp(/.*)?'
#    semanage fcontext -d -t httpd_sys_rw_content_t '/var/lib/simplesamlphp/data(/.*)?'
#    semanage fcontext -d -t httpd_sys_rw_content_t '/var/lib/simplesamlphp/log(/.*)?'

%files
%{_localstatedir}/lib/simplesamlphp/
%dir %attr(0750, root,%{httpd_group}) %{_localstatedir}/lib/simplesamlphp/config
%config(noreplace) %attr(0640, root,%{httpd_group}) %{_sharedstatedir}/%{name}/config/acl.php
%config(noreplace) %attr(0640, root,%{httpd_group}) %{_sharedstatedir}/%{name}/config/authsources.php
%config(noreplace) %attr(0640, root,%{httpd_group}) %{_sharedstatedir}/%{name}/config/config.php
%dir %attr(0750, root,%{httpd_group}) %{_sharedstatedir}/%{name}/metadata
#%config(noreplace) %attr(0640, root,%{httpd_group}) %{_sharedstatedir}/%{name}/metadata/adfs-idp-hosted.php
#%config(noreplace) %attr(0640, root,%{httpd_group}) %{_sharedstatedir}/%{name}/metadata/adfs-sp-remote.php
%config(noreplace) %attr(0640, root,%{httpd_group}) %{_sharedstatedir}/%{name}/metadata/saml20-idp-hosted.php
%config(noreplace) %attr(0640, root,%{httpd_group}) %{_sharedstatedir}/%{name}/metadata/saml20-idp-remote.php
%config(noreplace) %attr(0640, root,%{httpd_group}) %{_sharedstatedir}/%{name}/metadata/saml20-sp-remote.php
%dir %attr(0770, root, %{httpd_group}) %{_sharedstatedir}/%{name}/log
%dir %attr(0770, root, %{httpd_group}) %{_sharedstatedir}/%{name}/data
%dir %attr(0750, root, %{httpd_group}) %{_sharedstatedir}/%{name}/cert

%changelog
openSUSE Build Service is sponsored by