File kolab-webadmin.spec of Package kolab-webadmin
#
# spec file for package kolab-webadmin
#
# Copyright (c) 2014-2021 Aeneas Jaissle <aj@ajaissle.de>
# Copyright (c) 2012 Kolab Systems AG, Zuerich, Switzerland.
#
# 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 http://issues.kolab.org/
#
Name: kolab-webadmin
Version: 3.2.16
Release: 0
Summary: Kolab Groupware Server Web Administration Interface
License: AGPL-3.0+
Group: Productivity/Office/Organizers
Url: https://kolab.org/
Source0: https://cgit.kolab.org/webadmin/snapshot/webadmin-%{name}-%{version}.tar.gz
Source1: hosted-kolab.conf
Source2: kolab-webadmin.conf
BuildArch: noarch
#BuildRequires: apache2
BuildRequires: apache-rpm-macros
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires(pre): /usr/sbin/groupadd /usr/sbin/useradd /usr/sbin/usermod
%if 0%{?suse_version} > 1320
Requires(pre): user(wwwrun)
Requires(pre): group(www)
%endif
Requires: http_daemon
Requires: mod_php_any >= 5.3
Requires: mozldap-tools
Requires: php >= 5.3
Requires: php-smarty >= 3.1.7
Requires: php-pear-HTTP_Request2
Requires: php-pear-Mail
Requires: php-pear-Net_LDAP2
Requires: php-pear-Net_LDAP3
Requires: php-pear-Net_SMTP
Requires: php-pear-Net_Socket
Requires: php-pear-Net_URL2
Requires: php-gettext
Requires: php-ldap
Requires: php-mbstring
Requires: php-mysql
Suggests: apache2
%global kolab_user kolab
%global kolab_user_id 412
%global kolab_group kolab
%global kolab_group_id 412
%description
Kolab is a secure, scalable and reliable groupware server. It is formed by a
number of well-known and proven components and adds intelligent interaction between them.
This is a web based admin- and user interface for the Kolab Groupware Server.
%prep
%setup -q -n webadmin-%{name}-%{version}
# no need to check .htaccess each time, the apache config takes care of the restrictions
find . -name ".htaccess" -delete
%build
%install
%{__install} -d \
%{buildroot}%{apache_datadir}/%{name}/ \
%{buildroot}%{apache_sysconfdir}/conf.d/ \
%{buildroot}%{_localstatedir}/log/%{name}/ \
%{buildroot}%{_localstatedir}/cache/%{name}/
cp -a lib/ public_html/ hosted/ %{buildroot}%{apache_datadir}/%{name}/.
# install apache2 configurations
sed -e "s:__WEBADMINPATH__:%{apache_datadir}/%{name}:g" %{SOURCE1} > %{buildroot}%{apache_sysconfdir}/conf.d/hosted-kolab.conf
sed -e "s:__WEBADMINPATH__:%{apache_datadir}/%{name}:g" %{SOURCE2} > %{buildroot}%{apache_sysconfdir}/conf.d/%{name}.conf
%{__ln_s} %{_localstatedir}/cache/%{name} %{buildroot}%{apache_datadir}/%{name}/cache
%{__ln_s} %{_localstatedir}/log/%{name} %{buildroot}%{apache_datadir}/%{name}/logs
rm -rf %{buildroot}/%{apache_datadir}/%{name}/hosted/skins/images
%{__ln_s} -f %{apache_datadir}/%{name}/public_html/skins/default/images %{buildroot}/%{apache_datadir}/%{name}/hosted/skins/images
%pre
# Add the kolab user and group accounts
getent group %{kolab_group} &>/dev/null || groupadd -r %{kolab_group} -g %{kolab_group_id} &>/dev/null
getent passwd %{kolab_user} &>/dev/null || \
useradd -r -u %{kolab_user_id} -g %{kolab_group} -d %{_localstatedir}/lib/%{kolab_user} -s /sbin/nologin \
-c "Kolab System Account" %{kolab_user} &>/dev/null || :
usermod -G %{kolab_group} %{apache_user}
if [ $1 -gt 1 ]; then
if [ ! -L "%{apache_datadir}/%{name}/hosted/js" -a -d "%{apache_datadir}/%{name}/hosted/js" ]; then
rm -rf %{apache_datadir}/%{name}/hosted/js >/dev/null 2>&1 || :
fi
if [ ! -L "%{apache_datadir}/%{name}/hosted/skins" -a -d "%{apache_datadir}/%{name}/hosted/skins" ]; then
rm -rf %{apache_datadir}/%{name}/hosted/skins >/dev/null 2>&1 || :
fi
if [ ! -L "%{apache_datadir}/%{name}/public_html/skins/minimal/images" -a -d "%{apache_datadir}/%{name}/public_html/skins/minimal/images" ]; then
rm -rf %{apache_datadir}/%{name}/public_html/skins/minimal/images >/dev/null 2>&1 || :
fi
fi
%files
%defattr(-, root, root)
%doc doc/*
%dir %{apache_sysconfdir}
%dir %{apache_sysconfdir}/conf.d
%config(noreplace) %{apache_sysconfdir}/conf.d/%{name}.conf
%config(noreplace) %{apache_sysconfdir}/conf.d/hosted-kolab.conf
%{apache_datadir}/%{name}
%attr(0770,%{apache_user},%{apache_group}) %{_localstatedir}/cache/%{name}
%attr(0770,%{apache_user},%{apache_group}) %{_localstatedir}/log/%{name}
%changelog