File roundcubemail-plugins-kolab.spec of Package roundcubemail-plugins-kolab

#
# spec file for package roundcubemail-plugins-kolab
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2014-2016 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 https://bugs.opensuse.org/
#


%global roundcubepath %{apache_datadir}/roundcubemail
%global roundcubeconfigpath %{_sysconfdir}/roundcubemail
%global roundcubelibpath %{_localstatedir}/lib/roundcubemail

Name:           roundcubemail-plugins-kolab
Version:        3.5.11
Release:        0
Summary:        Kolab Groupware Plugins for Roundcube Webmail
License:        AGPL-3.0-or-later AND GPL-3.0-or-later
Group:          Productivity/Networking/Other
URL:            https://kolab.org/
Source0:        https://cgit.kolab.org/%{name}/snapshot/%{name}-%{version}.tar.gz
# elastic skin - compiled .less
Source1:        libkolab.min.css
BuildRequires:  apache-rpm-macros
BuildRequires:  fdupes
Requires:       php-libkolab3 >= 3.0
Requires:       php-libkolabxml1 >= 1.1
Requires:       php-pear-HTTP_Request2
Requires:       php-pear-Net_URL2
Requires:       roundcubemail >= 1.5
BuildArch:      noarch

%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 collection of Kolab Groupware Plugins for Roundcube Webmail.

%prep
%setup -q

# remove cruft from source archive
find . -type f -name ".gitignore" -delete
# rpmlint: env-script-interpreter
find . -type f -exec sed -i -e 's|\/usr\/bin\/env php|\/usr\/bin\/php|g' {} \;

%build

%install
mkdir -p \
    %{buildroot}%{roundcubeconfigpath} \
    %{buildroot}%{roundcubepath}/plugins
cp -a plugins/* %{buildroot}%{roundcubepath}/plugins

for plugin in calendar html_converter \
              kolab_2fa kolab_activesync kolab_addressbook \
              kolab_auth kolab_auth_proxy \
              kolab_chat kolab_config kolab_delegation \
              kolab_files kolab_folders \
              kolab_notes kolab_shortcuts \
              kolab_sso kolab_tags ldap_authentication \
              libcalendaring libkolab \
              loginfail logon_page \
              odfviewer pdfviewer piwik_analytics \
              tasklist tinymce_config wap_client; do
    if [ -e %{buildroot}%{roundcubepath}/plugins/${plugin}/config.inc.php.dist ]; then
        mv %{buildroot}%{roundcubepath}/plugins/${plugin}/config.inc.php.dist %{buildroot}%{roundcubeconfigpath}/${plugin}.inc.php
        ln -s %{roundcubeconfigpath}/${plugin}.inc.php %{buildroot}%{roundcubepath}/plugins/${plugin}/config.inc.php
    fi
done

# loginfail plugin
cp %{buildroot}%{roundcubepath}/plugins/loginfail/loginfail.html.sample %{buildroot}%{roundcubeconfigpath}/loginfail.html
ln -s %{roundcubeconfigpath}/loginfail.html %{buildroot}%{roundcubepath}/plugins/logon_page/loginfail.html

# logon_page plugin
mv %{buildroot}%{roundcubepath}/plugins/logon_page/logon_page.html %{buildroot}%{roundcubeconfigpath}/logon_page.html
ln -s %{roundcubeconfigpath}/logon_page.html %{buildroot}%{roundcubepath}/plugins/logon_page/logon_page.html

# odfviewer plugin
mkdir -p %{buildroot}%{roundcubelibpath}/plugins/odfviewer
ln -s %{roundcubelibpath}/plugins/odfviewer %{buildroot}%{roundcubepath}/plugins/odfviewer/files

# fdupes
%fdupes %{buildroot}%{roundcubepath}

# elastic skin/css
cp %{SOURCE1} %{buildroot}%{roundcubepath}/plugins/libkolab/skins/elastic/.

%pre
# cruft from snapshot, will be replaced by a link
for plugin in calendar kolab_addressbook tasklist; do
    find %{roundcubepath}/plugins/${plugin}/helpdocs -type d -name "_skin" -delete
done
find %{roundcubepath}/plugins/tasklist/helpdocs -type d -name "kolab" -exec rm -r {} +;

if [ -L "%{apache_datadir}/%{name}/config" ]; then
    rm -rf "%{apache_datadir}/%{name}/config"
fi

%post
if [ -e %{roundcubeconfigpath}/kolab.inc.php ]; then
    echo "The configuration file for the plugin libkolab moved from kolab.inc.php to libkolab.inc.php."
    echo "In order to not lose your configuration, rename %{roundcubeconfigpath}/kolab.inc.php manually."
fi

for plugin in calendar html_converter \
              kolab_2fa kolab_activesync kolab_addressbook \
              kolab_auth kolab_auth_proxy \
              kolab_chat kolab_config kolab_delegation \
              kolab_files kolab_folders \
              kolab_notes kolab_shortcuts \
              kolab_sso kolab_tags ldap_authentication \
              libcalendaring libkolab \
              loginfail logon_page \
              odfviewer pdfviewer piwik_analytics \
              tasklist tinymce_config wap_client; do
    for dir in `find %{roundcubepath}/plugins/${plugin} -type d -name "SQL"`; do
        %{roundcubepath}/bin/updatedb.sh \
            --dir ${dir} \
            --package ${plugin} \
            >/dev/null 2>&1 || :
    done
done

exit 0

%files
%dir %{roundcubeconfigpath}
%attr(0640,%{apache_user},%{apache_group}) %config(noreplace) %{roundcubeconfigpath}/*.php
%attr(0640,%{apache_user},%{apache_group}) %config(noreplace) %{roundcubeconfigpath}/loginfail.html
%attr(0640,%{apache_user},%{apache_group}) %config(noreplace) %{roundcubeconfigpath}/logon_page.html
%dir %{roundcubepath}
%dir %{roundcubepath}/plugins/
%{roundcubepath}/plugins/calendar
%{roundcubepath}/plugins/html_converter
%{roundcubepath}/plugins/kolab_2fa
%{roundcubepath}/plugins/kolab_activesync
%{roundcubepath}/plugins/kolab_addressbook
%{roundcubepath}/plugins/kolab_auth
%{roundcubepath}/plugins/kolab_auth_proxy
%{roundcubepath}/plugins/kolab_chat
%{roundcubepath}/plugins/kolab_config
%{roundcubepath}/plugins/kolab_delegation
%{roundcubepath}/plugins/kolab_files
%{roundcubepath}/plugins/kolab_folders
%{roundcubepath}/plugins/kolab_notes
%{roundcubepath}/plugins/kolab_shortcuts
%{roundcubepath}/plugins/kolab_sso
%{roundcubepath}/plugins/kolab_tags
%{roundcubepath}/plugins/ldap_authentication
%{roundcubepath}/plugins/libkolab
%{roundcubepath}/plugins/libcalendaring
%{roundcubepath}/plugins/loginfail
%{roundcubepath}/plugins/logon_page
%{roundcubepath}/plugins/odfviewer
%{roundcubepath}/plugins/pdfviewer
%{roundcubepath}/plugins/piwik_analytics
%{roundcubepath}/plugins/tasklist
%{roundcubepath}/plugins/tinymce_config
%{roundcubepath}/plugins/wap_client
%attr(-, %{apache_user}, root) %dir %{roundcubelibpath}
%attr(0775,root,%{apache_group}) %dir %{roundcubelibpath}/plugins
%attr(0750,%{apache_user},%{apache_group}) %{roundcubelibpath}/plugins/odfviewer

%changelog
openSUSE Build Service is sponsored by