Blob Blame History Raw
#
# Releasing with this .spec, for fun and profit;
#
# = Beta Release or Release Candidate =
#
# 1. Set beta_or_rc to 1
# 2. Set actual_release to the actual_release value of the previous
#    build attempt, +1
#    - The release tag in case of a beta_or_rc release is (statically)
#      prefixed with "0.", so that the first final release ("1") is always
#      newer (in rpm-compver).
# 3. Set the SVN revision to the current SVN revision;
#    - This ensures a future SVN revision is always *more* recent in
#      rpm-compver
#    - Lacking a unique zarafa-<version>.svn<revision>.tar.gz source
#      tarball, setting the correct SVN revision in the .spec is
#      critical in order to be able to determine exactly what was in
#      the tarball at the time of this build. You may recover the exact
#      SVN revision used from the resulting SRPM and RPMs because it ends
#      up in the RPM release tag.
# 4. Update %%changelog, considering the following;
#    - Possibly change only the release tag for the most recent changelog
#      %%changelog entry, if appropriate
#    - Add a message about the changes to either the product or the RPM
#      packaging
# 5. Build locally
# 6. Build in mock for;
#    a) fedora-rawhide-x86_64,
#    b) fedora-12-x86_64,
#    c) fedora-11-x86_64,
#    d) epel-5-x86_64,
#    e) epel-4-x86_64
#
#    or scratch build in koji;
#
#    for tag in dist-f13 dist-f12-updates-candidate dist-f11-updates-candidate \
#               dist-5E-epel dist-4E-epel; do
#        echo "- $tag: `koji build --scratch --nowait $tag $srpm 2>&1 | grep \"Task info\" | awk '{print $3}'`"
#    done
#
# 7. Should builds fail, repeat the process.
#
# = Final Release =
#
# NOTE: A final release of a version, or multiple final releases of the
# same version, of Zarafa 6.30.10 requires one unique tarball, probably
# named similar to zarafa-6.30.10.tar.gz.
#
# Once this tarball is used for an RPM package that is actually released,
# the .tar.gz source should not change anymore. You may, though, include
# patches for the 6.30.10 RPM package in this .spec and bumping the release
# number.
#
# When you do so, however, you will need to take into account upgrade paths
# between distribution versions. E.g., when releasing 6.30.10-2 to F-11, you
# would also need to release 6.30.10-2 to F-12.
#
# An alternative is to release 6.30.10.1 with a zarafa-6.30.10.1.tar.gz (yet
# again ensuring there is an upgrade path to later distribution versions)
#
# The point behind this has to do with reproducibility, though admittedly,
# the Source RPM corresponding to the binary RPM (comparing the
# <version>-<release>.src.rpm vs. the installed
# <version>-<release>.<arch>.rpm) does reveal the actual SVN revision number,
# and should thus also build the exact same thing running in production (euh,
# at customers, that is).
#
# 1. Set beta_or_rc to 0
# 2. Set actual_release to 1, or the value of actual_release of
#    the previous stable release, +1 in case have already released
#    this SVN revision as a stable product.
# 3. Set the SVN revision to the current SVN revision;
#    - Lacking a unique zarafa-<version>.svn<revision>.tar.gz source
#      tarball, setting the correct SVN revision in the .spec is
#      critical in order to be able to determine exactly what was in
#      the tarball at the time of this build. You may recover the exact
#      SVN revision used from the resulting SRPM, as the .spec in that
#      SRPM contains the SVN revision number (but not the resulting RPMs
#      just for the sake of appearance).
# 4. Update %%changelog, considering the following;
#    - Remove all %%changelog stamps that have a beta_or_rc type of versioning,
#      again just for appearances sake, possibly preserving the important
#      messages from each beta_or_rc type of changelog entries, e.g.:
#
#      * Some Time Your Name <your@email> - 6.30.10-0.1svn12345
#      - Improve packaging
#
#      might, in a final release, become:
#
#      * Some Time Zarafa Release Engineering <releng@zarafa.com> - 6.30.10-1
#      - Release 6.30.10
#      - Improve packaging
#
#    - Possibly change only the release tag for the most recent changelog
#      %%changelog entry, if appropriate. This is assuming there is no
#      important or significant changes between the beta_or_rc and the final
#      product.
#    - Add a message about the changes to either the product or the RPM
#      packaging if appropriate.
# 5. Build locally
# 6. Build in mock for;
#    a) fedora-rawhide-x86_64,
#    b) fedora-12-x86_64,
#    c) fedora-11-x86_64,
#    d) epel-5-x86_64,
#    e) epel-4-x86_64
#
#    or scratch build in koji;
#
#    for tag in dist-f13 dist-f12-updates-candidate dist-f11-updates-candidate \
#               dist-5E-epel dist-4E-epel; do
#        echo "- $tag: `koji build --scratch --nowait $tag $srpm 2>&1 | grep \"Task info\" | awk '{print $3}'`"
#    done
#
# 7. When mock or koji scratch builds fail, repeat the process.
#

%define beta_or_rc      0
%define actual_release  1
%define svnrevision     19435
%define with_ldap       1
%define with_xmlto      1

Summary:            Zarafa Outlook Sharing and Open Source Collaboration
Name:               zarafa
Version:            6.30.12
%if %{beta_or_rc}
Release:            0.%{actual_release}.svn%{svnrevision}%{?dist}
%else
Release:            %{actual_release}%{?dist}
%endif
# Red Hat Legal has been advised by email from Zarafa that no license is
# required in order to use the letter string "zarafa" (combined with other
# words) in the package naming, to refer to the software as "Zarafa" to
# indicate its intended purpose, and to modify packages with bug fixes and
# enhancements.
License:            AGPLv3 with exceptions
Group:              Applications/Productivity
URL:                http://www.zarafa.com/
# http://www.zarafa.com/download-community -> "Zarafa Source Package"
Source0:            %{name}-%{version}.tar.gz
Source1:            %{name}.ini

Patch0:             zarafa-6.30.4-package.patch
# Patch 1, 2 and 3 were sent to upstream
Patch1:             zarafa-6.30.4-perl.patch
Patch2:             zarafa-6.30.10-undefined-symbol.patch
Patch3:             zarafa-6.30.10-chmod.patch
# Patch 4 and 5 are backports from upstream
Patch4:             zarafa-6.30.10-fortify.patch
Patch5:             zarafa-6.30.10-long-ulong.patch
# http://www.brodowski.org/zarafa/php-mapi/6.30.10.18495/18495_patch.diff
Patch10:            zarafa-6.30.4-brodowski.patch

BuildRequires:      bison
BuildRequires:      gcc-c++
BuildRequires:      byacc
BuildRequires:      flex
BuildRequires:      gettext
BuildRequires:      libical-devel >= 0.42
BuildRequires:      libvmime07-devel
BuildRequires:      libxml2-devel
BuildRequires:      mysql-devel >= 4.1
BuildRequires:      ncurses-devel
BuildRequires:      pam-devel
BuildRequires:      php-devel
BuildRequires:      libtool, automake, autoconf

%if 0%{?fedora} > 8
BuildRequires:      libcurl-devel
BuildRequires:      perl-devel
%else
BuildRequires:      curl-devel
BuildRequires:      perl
%endif

%if 0%{?fedora} >= 12
BuildRequires:      libuuid-devel
%endif

%if %{with_ldap}
BuildRequires:      openldap-devel
%endif

%if %{with_xmlto}
BuildRequires:      xmlto
%endif

# The normal zarafa package pulls in all of zarafa
Requires:           zarafa(ical) = %{version}-%{release}
Requires:           zarafa(dagent) = %{version}-%{release}
Requires:           zarafa(gateway) = %{version}-%{release}
Requires:           zarafa(monitor) = %{version}-%{release}
Requires:           zarafa(server) = %{version}-%{release}
Requires:           zarafa(spooler) = %{version}-%{release}
Requires:           zarafa(utils) = %{version}-%{release}
Requires:           zarafa(config) = %{version}-%{release}

BuildRoot:          %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%description
Zarafa Outlook Sharing is a Microsoft Exchange replacement. The Open Source
Collaboration provides an integration with your existing Linux mail server,
native mobile phone support by ActiveSync compatibility and a webaccess with
'Look & Feel' similar to Outlook using Ajax. Including an IMAP4 and a POP3
gateway as well as an iCal/CalDAV gateway, Zarafa can combine the usability
with the stability and flexibility of a Linux server.

The proven Zarafa groupware solution is using MAPI objects, provides a MAPI
client library as well as programming interfaces for C++, PHP and Perl. The
other Zarafa related packages need to be installed to gain all the features
and benefits of Zarafa Outlook Sharing and Open Source Collaboration.

##
## Zarafa Client
##
%package client
Summary:            Zarafa Client Library
Group:              System Environment/Libraries
Requires:           zarafa(common) = %{version}-%{release}
Provides:           zarafa(client) = %{version}-%{release}

%description client
Zarafa client libraries for use with integrated MAPI clients.

##
## Zarafa Common files
##
%package common
Summary:            Zarafa common files
Group:              System Environment/Daemons
Requires(pre):      shadow-utils
Provides:           zarafa(common) = %{version}-%{release}

%description common
Common files and directories required by most Zarafa packages.

##
## Zarafa Delivery Agent
##
%package dagent
Summary:            Zarafa Delivery Agent
Group:              System Environment/Daemons
Requires:           zarafa(client) = %{version}-%{release}
Requires:           zarafa(common) = %{version}-%{release}
Requires(post):     /sbin/chkconfig
Requires(preun):    /sbin/service
Requires(preun):    /sbin/chkconfig
Requires(postun):   /sbin/service
Provides:           zarafa(dagent) = %{version}-%{release}
Provides:           zarafa(config::dagent) = %{version}-%{release}

%description dagent
The delivery agent delivers e-mails into the Zarafa server.
It can be used to trigger the local mailer or act as the LMTP
server.

##
## Zarafa Development Headers
##
%package devel
Summary:            Development files for several Zarafa libraries
Group:              Development/Libraries
Requires:           %{name} = %{version}-%{release}, pkgconfig
Requires:           zarafa(common) = %{version}-%{release}
Provides:           %{name}-static = %{version}-%{release}

%description devel
The zarafa-devel package includes header files and libraries necessary for
developing programs which use features from the Zarafa Outlook Sharing and
Open Source Collaboration. The proven Zarafa groupware solution is using
MAPI objects, provides a MAPI client library and programming interfaces for
C++, PHP and Perl.

##
## Zarafa Gateway
##
%package gateway
Summary:            Zarafa Gateway server (POP3/IMAP access)
Group:              System Environment/Daemons
Requires:           zarafa(client) = %{version}-%{release}
Requires:           zarafa(common) = %{version}-%{release}
Requires(post):     /sbin/chkconfig
Requires(preun):    /sbin/service
Requires(preun):    /sbin/chkconfig
Requires(postun):   /sbin/service
Provides:           zarafa(gateway) = %{version}-%{release}
Provides:           zarafa(config::gateway) = %{version}-%{release}

%description gateway
The gateway enables other e-mail clients to connect through
POP3 or IMAP to the Zarafa server to read their e-mail. With
IMAP, it is also possible to view the contents of shared
folders and subfolders. The gateway can be configured to
listen for POP3, POP3S, IMAP and/or IMAPS.

##
## Zarafa iCal/CalDAV server
##
%package ical
Summary:            The Zarafa iCal/CalDAV gateway
Group:              System Environment/Daemons
Requires:           zarafa(client) = %{version}-%{release}
Requires:           zarafa(common) = %{version}-%{release}
Requires(post):     /sbin/chkconfig
Requires(preun):    /sbin/service
Requires(preun):    /sbin/chkconfig
Requires(postun):   /sbin/service
Provides:           zarafa(ical) = %{version}-%{release}
Provides:           zarafa(caldav) = %{version}-%{release}
Provides:           zarafa(config::ical) = %{version}-%{release}
Provides:           zarafa(config::caldav) = %{version}-%{release}

%description ical
The iCal/CalDAV gateway enables users to retrieve their
calendar using iCalendar compliant clients. The iCal/CalDAV
gateway can be configured to listen for HTTP and HTTPS
requests.

##
## Zarafa CalDAV package, merely an alias for zarafa-ical
##
%package caldav
Summary:            The Zarafa iCal/CalDAV gateway
Group:              System Environment/Daemons
Requires:           zarafa(ical) = %{version}-%{release}

%description caldav
The iCal/CalDAV gateway enables users to retrieve their
calendar using iCalendar compliant clients. The iCal/CalDAV
gateway can be configured to listen for HTTP and HTTPS
requests.

##
## Zarafa Monitor Service
##
%package monitor
Summary:            Zarafa Monitoring service
Group:              System Environment/Daemons
Requires:           zarafa(client) = %{version}-%{release}
Requires:           zarafa(common) = %{version}-%{release}
Requires(post):     /sbin/chkconfig
Requires(preun):    /sbin/service
Requires(preun):    /sbin/chkconfig
Requires(postun):   /sbin/service
Provides:           zarafa(monitor) = %{version}-%{release}
Provides:           zarafa(config::monitor) = %{version}-%{release}

%description monitor
The monitor checks user mailbox sizes. When a quotum is reached
the monitor sends a quota notification email.

##
## Zarafa Backend Server
##
%package server
Summary:            Zarafa Backend Server
Group:              System Environment/Daemons
Requires:           zarafa(common) = %{version}-%{release}
Requires(post):     /sbin/chkconfig
Requires(preun):    /sbin/service
Requires(preun):    /sbin/chkconfig
Requires(postun):   /sbin/service
Provides:           zarafa(server) = %{version}-%{release}
Provides:           zarafa(config) = %{version}-%{release}
Provides:           zarafa(config::server) = %{version}-%{release}

%description server
The Zarafa groupware backend server

##
## Zarafa Spooler Service
##
%package spooler
Summary:            Zarafa Spooler Service
Group:              System Environment/Daemons
Requires:           zarafa(client) = %{version}-%{release}
Requires:           zarafa(common) = %{version}-%{release}
Requires(post):     /sbin/chkconfig
Requires(preun):    /sbin/service
Requires(preun):    /sbin/chkconfig
Requires(postun):   /sbin/service
Provides:           zarafa(spooler) = %{version}-%{release}
Provides:           zarafa(config::spooler) = %{version}-%{release}

%description spooler
The spooler sends all pending Zarafa e-mail to the recipients,
from the Outbox of a user/all users.

##
## Zarafa Utilities
##
%package utils
Summary:            Zarafa Utilities
Group:              Applications/System
Requires:           zarafa(client) = %{version}-%{release}
Requires:           zarafa(common) = %{version}-%{release}
Provides:           zarafa(utils) = %{version}-%{release}

%description utils
Administration utilities for the Zarafa Groupware environment
including reporting and password management.

##
## MAPI System Libraries
##
%package -n libmapi
Summary:            Mapi libraries by Zarafa
Group:              System Environment/Libraries
Requires:           zarafa(client) = %{version}-%{release}
Requires(post):     /sbin/ldconfig
Requires(postun):   /sbin/ldconfig

%description -n libmapi
MAPI libraries by Zarafa.

##
## MAPI Perl extension
##
%package -n perl-libmapi
Summary:            Perl Mapi extension libraries by Zarafa
Group:              System Environment/Libraries
Requires:           perl

%description -n perl-libmapi
Perl MAPI extension libraries by Zarafa.

##
## MAPI PHP Extension
##
%package -n php-mapi
Summary:            A PHP Mapi client by Zarafa
Group:              Applications/Communications
# Bug: Without mod_ssl, reloading httpd causes core dump
Requires:           mod_ssl
Requires:           php >= 4.3
Provides:           php(mapi) = %{version}-%{release}

%description -n php-mapi
PHP MAPI extension by Zarafa to enable MAPI communication in PHP.

%prep
%setup -q
%patch0 -p1 -b .package
%patch1 -p1 -b .perl
%patch2 -p1 -b .symbol
%patch3 -p1 -b .chmod
%patch4 -p1 -b .fortify
%patch5 -p1 -b .long-ulong
#%%patch10 -p5 -b .brodowski

# Needed to get rid of rpath
libtoolize --force
autoreconf --force --install

%build
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -g -ggdb"
export CFLAGS
%configure \
    --with-userscript-prefix=%{_sysconfdir}/%{name}/userscripts \
    --with-quotatemplate-prefix=%{_sysconfdir}/%{name}/quotamail \
%if 0%{?rhel} > 0
    --enable-release \
%endif
    --disable-static \
    --disable-testtools \
    --enable-perl
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
make \
%if 0%{?rhel} > 0
    docdir=%{_datadir}/doc/%{name}/ \
    datarootdir=%{_datadir} \
%endif
    DESTDIR=$RPM_BUILD_ROOT \
    INSTALL='install -p' \
    install

# Nuke all overlefts from licensed, managed or other proprietary items
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/report-ca
rm -f $RPM_BUILD_ROOT%{_mandir}/man?/zarafa-{backup,restore,report,ldapms.cfg,licensed{,.cfg}}.*

# Move all the initscripts to their appropriate place and
# ensure that all services are off by default at boot time
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/
for service in server spooler dagent gateway monitor ical; do
    if [ -f $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/%{name}-$service.init.fc ]; then
        sed -e 's@345@-@' $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/%{name}-$service.init.fc > \
            $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/%{name}-$service
        chmod 755 $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/%{name}-$service
        touch -c -r $RPM_BUILD_ROOT{%{_datadir}/doc/%{name}/%{name}-$service.init.fc,%{_sysconfdir}/rc.d/init.d/%{name}-$service}
    fi
done

# Move the configuration files to their correct place and handle
# /usr/lib vs. /usr/lib64 for all architectures correct and set
# run_as_user, run_as_group and local_admin_users values correct
for config in $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/*.cfg; do
    config=$(basename $config)
    if [ -f $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/$config ]; then
        sed -e 's@\(run_as_\(user\|group\)[[:space:]]*=\).*@\1 %{name}@' -e 's@/usr/lib/zarafa@%{_libdir}/%{name}@' \
            -e 's@\(local_admin_users[[:space:]]*=[[:space:]]*root.*\)@\1 %{name}@' \
                $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/$config > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/$config
        chmod 640 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/$config
        touch -c -r $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/$config $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/$config
    fi
done

# Move the logrotate configuration file to it's correct place
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
sed -e 's@\(}\)@        create 0644 %{name} %{name}\n\1@' -e '1,6d' \
  $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/%{name}.logrotate > $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}
touch -c -r $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/%{name}.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}

# Install the PHP module configuration file appropriate
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/php.d/
install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/php.d/%{name}.ini

# Create missing userscript directories for packaging them
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/userscripts/{create,delete}{user,group,company}.d/

# Move the userscripts to their correct place and symlink them
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/userscripts/
for userscript in companies_common.sh groups_common.sh users_common.sh \
            createcompany creategroup createuser deletecompany deletegroup deleteuser; do
    mv -f $RPM_BUILD_ROOT{%{_sysconfdir},%{_datadir}}/%{name}/userscripts/$userscript
    ln -sf ../../..%{_datadir}/%{name}/userscripts/$userscript $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/userscripts/$userscript
done

# Create the data directory and install some files into
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/
install -p -m 755 installer/linux/db-{calc-storesize,convert-attachments-to-files} $RPM_BUILD_ROOT%{_datadir}/%{name}/
install -p -m 755 installer/linux/ssl-certificates.sh $RPM_BUILD_ROOT%{_datadir}/%{name}/

# Create the default log and lib directory for packaging
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/{log,lib}/%{name}/

# Remove all libtool .la files to avoid packaging of them
rm -f $RPM_BUILD_ROOT%{_libdir}/{,php/modules,%{name}}/*.la

# Remove files that are anyway in %doc or %{_datadir}/%{name}/
rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/

%find_lang %{name}

%clean
rm -rf $RPM_BUILD_ROOT

%pre common
getent group %{name} > /dev/null || %{_sbindir}/groupadd -r %{name}
getent passwd %{name} > /dev/null || %{_sbindir}/useradd -r -g %{name} -d %{_localstatedir}/lib/%{name} -s /sbin/nologin -c "Zarafa Service Account" %{name}
exit 0

%post dagent
[ $1 -eq 1 ] && /sbin/chkconfig --add %{name}-dagent
# Ensure correct log file ownership after upgrade from official packages
chown %{name}:%{name} %{_localstatedir}/log/%{name}/dagent.* > /dev/null 2>&1 || :

%post ical
[ $1 -eq 1 ] && /sbin/chkconfig --add %{name}-ical
# Ensure correct log file ownership after upgrade from official packages
chown %{name}:%{name} %{_localstatedir}/log/%{name}/ical.* > /dev/null 2>&1 || :

%post gateway
[ $1 -eq 1 ] && /sbin/chkconfig --add %{name}-gateway
# Ensure correct log file ownership after upgrade from official packages
chown %{name}:%{name} %{_localstatedir}/log/%{name}/gateway.* > /dev/null 2>&1 || :

%post monitor
[ $1 -eq 1 ] && /sbin/chkconfig --add %{name}-monitor
# Ensure correct log file ownership after upgrade from official packages
chown %{name}:%{name} %{_localstatedir}/log/%{name}/monitor.* > /dev/null 2>&1 || :

%post server
[ $1 -eq 1 ] && /sbin/chkconfig --add %{name}-server
# Ensure correct log file ownership after upgrade from official packages
chown %{name}:%{name} %{_localstatedir}/log/%{name}/server.* > /dev/null 2>&1 || :

%post spooler
[ $1 -eq 1 ] && /sbin/chkconfig --add %{name}-spooler
# Ensure correct log file ownership after upgrade from official packages
chown %{name}:%{name} %{_localstatedir}/log/%{name}/spooler.* > /dev/null 2>&1 || :

%post -n libmapi -p /sbin/ldconfig

%preun dagent
if [ $1 -eq 0 ]; then
    /sbin/service %{name}-dagent stop > /dev/null 2>&1 || :
    /sbin/chkconfig --del %{name}-dagent
fi

%preun ical
if [ $1 -eq 0 ]; then
    /sbin/service %{name}-ical stop > /dev/null 2>&1 || :
    /sbin/chkconfig --del %{name}-ical
fi

%preun gateway
if [ $1 -eq 0 ]; then
    /sbin/service %{name}-gateway stop > /dev/null 2>&1 || :
    /sbin/chkconfig --del %{name}-gateway
fi

%preun monitor
if [ $1 -eq 0 ]; then
    /sbin/service %{name}-monitor stop > /dev/null 2>&1 || :
    /sbin/chkconfig --del %{name}-monitor
fi

%preun server
if [ $1 -eq 0 ]; then
    /sbin/service %{name}-server stop > /dev/null 2>&1 || :
    /sbin/chkconfig --del %{name}-server
fi

%preun spooler
if [ $1 -eq 0 ]; then
    /sbin/service %{name}-spooler stop > /dev/null 2>&1 || :
    /sbin/chkconfig --del %{name}-spooler
fi

%postun dagent
if [ $1 -ne 0 ]; then
    /sbin/service %{name}-dagent condrestart > /dev/null 2>&1 || :
fi

%postun ical
if [ $1 -ne 0 ]; then
    /sbin/service %{name}-ical condrestart > /dev/null 2>&1 || :
fi

%postun gateway
if [ $1 -ne 0 ]; then
    /sbin/service %{name}-gateway condrestart > /dev/null 2>&1 || :
fi

%postun monitor
if [ $1 -ne 0 ]; then
    /sbin/service %{name}-monitor condrestart > /dev/null 2>&1 || :
fi

%postun server
if [ $1 -ne 0 ]; then
    /sbin/service %{name}-server condrestart > /dev/null 2>&1 || :
fi

%postun spooler
if [ $1 -ne 0 ]; then
    /sbin/service %{name}-spooler condrestart > /dev/null 2>&1 || :
fi

%postun -n libmapi -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc installer/licenseagreement/AGPL-3

%files caldav
%defattr(-,root,root,-)
%doc installer/licenseagreement/AGPL-3

%files client
%defattr(-,root,root,-)
%doc installer/licenseagreement/AGPL-3
%{_libdir}/libzarafaclient.so

%files common
%defattr(-,root,root,-)
%doc installer/licenseagreement/AGPL-3 doc/performance-tuning.txt
%dir %{_sysconfdir}/%{name}/
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%dir %{_libdir}/%{name}/
%{_mandir}/man1/%{name}.1*
%dir %{_datadir}/%{name}/
%dir %attr(0755,%{name},%{name}) %{_localstatedir}/lib/%{name}/
%dir %attr(0755,%{name},%{name}) %{_localstatedir}/log/%{name}/

%files dagent
%defattr(-,root,root,-)
%doc installer/licenseagreement/AGPL-3 installer/linux/createuser.dotforward
%{_bindir}/%{name}-autorespond
%{_bindir}/%{name}-dagent
%config(noreplace) %attr(0640,%{name},%{name}) %{_sysconfdir}/%{name}/dagent.cfg
%{_sysconfdir}/rc.d/init.d/%{name}-dagent
%{_mandir}/man1/%{name}-dagent.1*
%{_mandir}/man5/%{name}-dagent.cfg.5*

%files devel
%defattr(-,root,root,-)
%doc installer/licenseagreement/AGPL-3
%{_libdir}/libicalmapi.so
%{_libdir}/libinetmapi.so
%{_libdir}/libmapi.so
%{_libdir}/libperlmapi.so
%{_libdir}/libcommon_mapi.a
%{_libdir}/libcommon_ssl.a
%{_libdir}/libcommon_util.a
%{_libdir}/libfreebusy.a
%{_includedir}/icalmapi/
%{_includedir}/inetmapi/
%{_includedir}/mapi4linux/
%{_includedir}/%{name}/
%{_libdir}/pkgconfig/%{name}.pc

%files gateway
%defattr(-,root,root,-)
%doc installer/licenseagreement/AGPL-3
%{_bindir}/%{name}-gateway
%config(noreplace) %attr(0640,%{name},%{name}) %{_sysconfdir}/%{name}/gateway.cfg
%{_sysconfdir}/rc.d/init.d/%{name}-gateway
%{_mandir}/man1/%{name}-gateway.1*
%{_mandir}/man5/%{name}-gateway.cfg.5*

%files ical
%defattr(-,root,root,-)
%doc installer/licenseagreement/AGPL-3
%{_bindir}/%{name}-ical
%config(noreplace) %attr(0640,%{name},%{name}) %{_sysconfdir}/%{name}/ical.cfg
%{_sysconfdir}/rc.d/init.d/%{name}-ical
%{_mandir}/man1/%{name}-ical.1*
%{_mandir}/man5/%{name}-ical.cfg.5*

%files monitor
%defattr(-,root,root,-)
%doc installer/licenseagreement/AGPL-3
%{_bindir}/%{name}-monitor
%config(noreplace) %attr(0640,%{name},%{name}) %{_sysconfdir}/%{name}/monitor.cfg
%dir %{_sysconfdir}/%{name}/quotamail/
%config(noreplace) %{_sysconfdir}/%{name}/quotamail/companyhard.mail
%config(noreplace) %{_sysconfdir}/%{name}/quotamail/companysoft.mail
%config(noreplace) %{_sysconfdir}/%{name}/quotamail/companywarning.mail
%config(noreplace) %{_sysconfdir}/%{name}/quotamail/userhard.mail
%config(noreplace) %{_sysconfdir}/%{name}/quotamail/usersoft.mail
%config(noreplace) %{_sysconfdir}/%{name}/quotamail/userwarning.mail
%{_sysconfdir}/rc.d/init.d/%{name}-monitor
%{_mandir}/man1/%{name}-monitor.1*
%{_mandir}/man5/%{name}-monitor.cfg.5*

%files server -f %{name}.lang
%defattr(-,root,root,-)
%doc installer/licenseagreement/AGPL-3
%{_bindir}/%{name}-server
%config(noreplace) %attr(0640,%{name},%{name}) %{_sysconfdir}/%{name}/server.cfg
%config(noreplace) %attr(0640,%{name},%{name}) %{_sysconfdir}/%{name}/unix.cfg
%{_sysconfdir}/rc.d/init.d/%{name}-server
%dir %{_sysconfdir}/%{name}/userscripts/
%{_sysconfdir}/%{name}/userscripts/createuser
%{_sysconfdir}/%{name}/userscripts/creategroup
%{_sysconfdir}/%{name}/userscripts/createcompany
%{_sysconfdir}/%{name}/userscripts/deleteuser
%{_sysconfdir}/%{name}/userscripts/deletegroup
%{_sysconfdir}/%{name}/userscripts/deletecompany
%{_sysconfdir}/%{name}/userscripts/*common.sh
%dir %{_sysconfdir}/%{name}/userscripts/createuser.d/
%dir %{_sysconfdir}/%{name}/userscripts/creategroup.d/
%dir %{_sysconfdir}/%{name}/userscripts/createcompany.d/
%dir %{_sysconfdir}/%{name}/userscripts/deleteuser.d/
%dir %{_sysconfdir}/%{name}/userscripts/deletegroup.d/
%dir %{_sysconfdir}/%{name}/userscripts/deletecompany.d/
%config(noreplace) %{_sysconfdir}/%{name}/userscripts/createcompany.d/00createpublic
%config(noreplace) %{_sysconfdir}/%{name}/userscripts/createuser.d/00createstore
%{_datadir}/%{name}/userscripts/
%{_libdir}/%{name}/dbplugin.so
%{_libdir}/%{name}/unixplugin.so
%{_mandir}/man1/%{name}-server.1*
%{_mandir}/man5/%{name}-server.cfg.5*
%{_mandir}/man5/%{name}-unix.cfg.5*
%if %{with_ldap}
%doc installer/ldap/%{name}.schema
%config(noreplace) %attr(0640,%{name},%{name}) %{_sysconfdir}/%{name}/ldap.active-directory.cfg
%config(noreplace) %attr(0640,%{name},%{name}) %{_sysconfdir}/%{name}/ldap.openldap.cfg
%{_libdir}/%{name}/ldapplugin.so
%{_mandir}/man5/%{name}-ldap.cfg.5*
%endif

%files spooler
%defattr(-,root,root,-)
%doc installer/licenseagreement/AGPL-3
%{_bindir}/%{name}-spooler
%config(noreplace) %attr(0640,%{name},%{name}) %{_sysconfdir}/%{name}/spooler.cfg
%{_sysconfdir}/rc.d/init.d/%{name}-spooler
%{_mandir}/man1/%{name}-spooler.1*
%{_mandir}/man5/%{name}-spooler.cfg.5*

%files utils
%defattr(-,root,root,-)
%doc installer/licenseagreement/AGPL-3
%{_bindir}/%{name}-admin
%{_bindir}/%{name}-fsck
%{_bindir}/%{name}-passwd
%{_bindir}/%{name}-stats
%{_datadir}/%{name}/db-calc-storesize
%{_datadir}/%{name}/db-convert-attachments-to-files
%{_datadir}/%{name}/ssl-certificates.sh
%{_mandir}/man1/%{name}-admin.1*
%{_mandir}/man1/%{name}-fsck.1*
%{_mandir}/man1/%{name}-passwd.1*
%{_mandir}/man1/%{name}-stats.1*

%files -n libmapi
%defattr(-,root,root,-)
%doc installer/licenseagreement/AGPL-3
%{_libdir}/libicalmapi.so.*
%{_libdir}/libinetmapi.so.*
%{_libdir}/libmapi.so.*

%files -n perl-libmapi
%defattr(-,root,root,-)
%doc installer/licenseagreement/AGPL-3
%{_libdir}/libperlmapi.so.*

%files -n php-mapi
%defattr(-,root,root,-)
%doc installer/licenseagreement/AGPL-3
%config(noreplace) %{_sysconfdir}/php.d/%{name}.ini
%{_datadir}/php/mapi/
%if 0%{?rhel}%{?fedora} > 4
%{_libdir}/php/modules/mapi.so
%else
%{_libdir}/php4/mapi.so
%endif

%changelog
* Sat Mar 20 2010 Robert Scheck <robert@fedoraproject.org> 6.30.12-1
- Upgrade to 6.30.12

* Fri Mar 19 2010 Robert Scheck <robert@fedoraproject.org> 6.30.11-1
- Upgrade to 6.30.11

* Tue Feb 23 2010 Robert Scheck <robert@fedoraproject.org> 6.30.10-2
- Backported a patch from trunk to avoid the crash of zarafa-server
  when creating new user with db or unix plugin (#564282, #567262)
- Backported another patch from trunk to avoid the crash of httpd
  caused by PHP mapi.so during the logon in the webaccess (#564129)

* Sat Feb 06 2010 Robert Scheck <robert@fedoraproject.org> 6.30.10-1
- Upgrade to 6.30.10 (#498194)
- Initial spec file for Fedora and Red Hat Enterprise Linux (thanks
  to Jeroen van Meeuwen, John van der Kamp and Steve Hardy)