File iRony.spec of Package iRony

#
# spec file for package iRony
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2014-2016 Aeneas Jaissle <aj@ajaissle.de>
# Copyright (c) 2013 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 https://bugs.opensuse.org/
#


%global roundcubepath %{apache_datadir}/roundcubemail
%global roundcubeconfigpath %{_sysconfdir}/roundcubemail

Name:           iRony
Version:        0.4.7
Release:        0
Summary:        DAV for Kolab Groupware
License:        AGPL-3.0-or-later
Group:          Productivity/Networking/Other
Url:            https://kolab.org
Source0:        https://cgit.kolab.org/%{name}/snapshot/%{name}-%{version}.tar.gz
Source1:        %{name}-httpd.conf
Source2:        %{name}.logrotate
# PATCH-FIX-UPSTREAM iRony-0.3.0_use_global_rc-framework.patch
Patch10:        %{name}-0.3.0_use_global_rc-framework.patch
BuildRequires:  apache-rpm-macros
BuildRequires:  chwala >= 0.5.2
# Requiring the configuration from roundcubemail
BuildRequires:  roundcubemail >= 1.3
# Requiring the plugins 'kolab_auth', 'kolab_folders', 'libkolab' from roundcubemail-plugins-kolab
BuildRequires:  roundcubemail-plugins-kolab >= 3.3.6
BuildArch:      noarch

Requires:       chwala >= 0.5.2
Requires:       http_daemon
Requires:       php >= 5.4.1
Requires:       php-kolab-Net_LDAP3 >= 1.0.7
Requires:       php-pear-Auth_SASL >= 1.1.0
Requires:       php-pear-Mail_Mime >= 1.10.0
Requires:       php-pear-Net_IDNA2 >= 0.2.0
Requires:       php-pear-Net_LDAP2 >= 2.2.0
Requires:       php-pear-Net_SMTP >= 1.7.1
Requires:       php-pear-Net_Socket >= 0.1.1
Requires:       php-sabre-dav >= 2.1.6

# Requiring the configuration from roundcubemail
Requires:       roundcubemail >= 1.3
# Requiring the plugins 'kolab_auth', 'kolab_folders', 'libkolab', 'libcalendaring' from roundcubemail-plugins-kolab
Requires:       roundcubemail-plugins-kolab >= 3.3.6

Recommends:     logrotate

%description
iRony is the CardDAV, CalDAV and WebDAV storage access provider for the
Kolab Groupware solution.

%prep
%setup -q
%patch10 -p1

# Remove some cruft
find . -type f -name ".gitignore" -delete
find . -type f -name ".*.yml" -delete

%build

%install
install -d \
    %{buildroot}%{apache_sysconfdir}/conf.d \
    %{buildroot}%{_sysconfdir}/logrotate.d \
    %{buildroot}%{_sysconfdir}/%{name} \
    %{buildroot}%{apache_datadir}/%{name} \
    %{buildroot}%{apache_datadir}/%{name}/config \
    %{buildroot}%{_localstatedir}/cache/%{name} \
    %{buildroot}%{_localstatedir}/lib/%{name} \
    %{buildroot}%{_localstatedir}/log/%{name}

# apache config
sed -e "s#__IRONY_ROOT__#%{apache_datadir}/%{name}#g" %{SOURCE1} > \
  %{buildroot}%{apache_sysconfdir}/conf.d/%{name}.conf

mkdir %{buildroot}%{apache_datadir}/%{name}/lib
cp -a lib/Kolab %{buildroot}%{apache_datadir}/%{name}/lib/Kolab
cp -a public_html %{buildroot}%{apache_datadir}/%{name}/public_html

# configuration
cp -a config/dav.inc.php.sample %{buildroot}%{_sysconfdir}/%{name}/dav.inc.php

# configuration links
ln -s %{_sysconfdir}/%{name}/dav.inc.php %{buildroot}%{apache_datadir}/%{name}/config/dav.inc.php

# var links
ln -s %{_localstatedir}/cache/%{name} %{buildroot}%{apache_datadir}/%{name}/temp
ln -s %{_localstatedir}/log/%{name} %{buildroot}%{apache_datadir}/%{name}/logs

# logrotate config
install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}

# roundcube plugins
install -d %{buildroot}%{apache_datadir}/%{name}/lib/plugins
for plugin in kolab_auth kolab_folders libkolab libcalendaring; do
    ln -s %{roundcubepath}/plugins/${plugin} %{buildroot}%{apache_datadir}/%{name}/lib/plugins/${plugin}
    echo ".1."
done

# roundcube configuration
for config in config defaults; do
    ln -s %{roundcubeconfigpath}/${config}.inc.php %{buildroot}%{apache_datadir}/%{name}/config/${config}.inc.php
done

# library links
ln -s %{apache_datadir}/chwala/lib %{buildroot}%{apache_datadir}/%{name}/lib/FileAPI

%pre
if [ -L "%{apache_datadir}/%{name}/config" ]; then
    rm -rf "%{apache_datadir}/%{name}/config"
fi
for plugin in kolab_auth kolab_folders libkolab libcalendaring; do
    if [ -d "%{apache_datadir}/%{name}/lib/plugins/${plugin}" ]; then
        if ! [ -L "%{apache_datadir}/%{name}/lib/plugins/${plugin}" ]; then
            rm -rf "%{apache_datadir}/%{name}/lib/plugins/${plugin}"
        fi
    fi
done

%files
%doc README.md config/dav.inc.php.sample
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{apache_sysconfdir}/conf.d/%{name}.conf
%attr(0750,root,%{apache_group}) %dir %{_sysconfdir}/%{name}
%attr(0640,root,%{apache_group}) %config(noreplace) %{_sysconfdir}/%{name}/dav.inc.php
%dir %{apache_datadir}/%{name}
%{apache_datadir}/%{name}/config/
%{apache_datadir}/%{name}/lib/
%{apache_datadir}/%{name}/public_html/
%{apache_datadir}/%{name}/logs
%{apache_datadir}/%{name}/temp
%attr(0750,%{apache_user},root) %{_localstatedir}/cache/%{name}
%attr(0750,%{apache_user},root) %{_localstatedir}/lib/%{name}
%attr(0750,%{apache_user},root) %{_localstatedir}/log/%{name}

%changelog
openSUSE Build Service is sponsored by