##
## kolab.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2007 OpenPKG Foundation e.V.
## Copyright (c) 2000-2007 Ralf S. Engelschall
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package version
%define V_ei_maj 1.0
%define V_ei 1.0.25
%define V_cf 1.0.4
# package information
Name: kolab
Summary: Kolab Groupware Server
URL: http://kolab.kde.org/
Vendor: Erfrakon, Intevation, Code Fusion
Packager: OpenPKG Foundation e.V.
Distribution: OpenPKG Community
Class: EVAL
Group: Mail
License: GPL
Version: 20041215
Release: 20070622
# package options
%option with_genuine no
# list of sources
Source0: http://www.erfrakon.de/projects/kolab/download/kolab-server-%{V_ei_maj}/src/kolab-%{V_ei_maj}-%{V_ei}.src.rpm
Source1: ftp://ftp.zfos.org/brew/kolab/DST/cfkolab-%{V_cf}.tar.bz2
Source2: rc.kolab
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20060823
PreReq: OpenPKG, openpkg >= 20060823, openldap >= 2.2.5-20040419, postfix, imapd, sasl, apache, proftpd, perl, perl-ldap
PreReq: sasl >= 2.1.15-20031122, sasl::with_ldap = yes, sasl::with_login = yes
PreReq: proftpd >= 1.2.9-20031031, proftpd::with_ldap = yes
PreReq: gdbm >= 1.8.3-20030213, gdbm::with_ndbm = yes
PreReq: postfix >= 2.0.16-20031028, postfix::with_ldap = yes, postfix::with_sasl = yes, postfix::with_ssl = yes
PreReq: imapd >= 2.2.3-20040202, imapd::with_group = yes
PreReq: apache >= 1.3.29-20031124, apache::with_mod_ldap = yes, apache::with_mod_dav = yes, apache-php, apache-php::with_gdbm = yes, apache-php::with_gettext = yes, apache-php::with_imap = yes, apache-php::with_openldap = yes, apache-php::with_xml = yes, apache::with_mod_ssl = yes
%if "%{with_genuine}" == "no"
PreReq: perl-kolab, perl-db
%endif
AutoReq: no
AutoReqProv: no
%description
The Kolab Server is a Free Software groupware server
that provides groupware features to either KDE Kolab clients
or Microsoft Outlook[tm] clients running on Windows[tm]
by use of a proprietary plug-ins. In addition it is a robust
and flexible general IMAP mail server with LDAP addressbooks.
Kolab %{V_ei_maj}, genuine Engine and Admin Interface %{V_ei}
The Code Fusion fork adds functionality such as integration with
Active Directory, a more modularised backend, separation of the
daemon and the configuration generator and more.
Code Fusion Engine %{V_cf}, shares Admin Interface (see above)
%track
prog kolab-ei = {
version = %{V_ei_maj}-%{V_ei}
url = http://www.erfrakon.de/projects/kolab/download/kolab-server-%{V_ei_maj}/src/
regex = kolab-(%{V_ei_maj}-\d+\.\d+\.\d{1,7})\.src\.rpm
}
prog kolab-cf = {
version = %{V_cf}
url = ftp://ftp.zfos.org/brew/kolab/DST/
regex = cfkolab-(__VER__)\.tar\.bz2
}
%prep
%setup -q -c -T
%{l_bzip2} -c -d %{SOURCE1} | %{l_tar} xf -
%{l_rpm2cpio} <%{SOURCE0} | cpio -iv kolab-%{V_ei_maj}.tar.gz
%if "%{with_genuine}" == "no"
%{l_gzip} -c -d kolab-%{V_ei_maj}.tar.gz | %{l_tar} xf - admin/
mv cfkolab-%{V_cf}/* .
%{l_shtool} subst \
-e "s;^\(# kolab_bootstrap Version .*\);\1, openpkg=kolab-%{version}-%{release}, kolab=%{V_ei_maj}, admin=%{V_ei}, cf-engine=%{V_cf};" \
kolab_bootstrap
%{l_shtool} subst \
-e "s;\(>Version \).[^<]*<;\1%{V_ei_maj}-%{V_ei}-cf%{V_cf}<;" \
admin/kolab/index.php
%else
%{l_gzip} -c -d kolab-%{V_ei_maj}.tar.gz | %{l_tar} xf -
%{l_shtool} subst \
-e "s;^\(# kolab_bootstrap Version .*\);\1, openpkg=kolab-%{version}-%{release}, kolab=%{V_ei_maj}, admin=%{V_ei} using ei-engine;" \
kolab_bootstrap
%{l_shtool} subst \
-e "s;\(>Version \).[^<]*<;\1%{V_ei_maj}-%{V_ei}-ei<;" \
admin/kolab/index.php
awk slapd.conf.template.NEW && mv slapd.conf.template.NEW slapd.conf.template
%{l_shtool} subst \
-e 's;@@@kolab_prefix@@@;@l_prefix@;g' \
-e 's;@@@l_\([mnrs]\)usr@@@;@l_\1usr@;g' \
-e 's;@@@l_\([mnrs]\)grp@@@;@l_\1grp@;g' \
-e 's;@@@l_\([mnrs]\)uid@@@;@l_\1uid@;g' \
-e 's;@@@l_\([mnrs]\)gid@@@;@l_\1gid@;g' \
kolab_sslcert.sh kolab kolab_bootstrap *.template
%{l_shtool} subst \
-e 's;hostname -f;hostname;' \
kolab kolab_bootstrap
%{l_shtool} subst \
-e 's;chown root.root;chown @l_susr@:@l_sgrp@;' \
kolab
%{l_shtool} subst \
-e 's;libexec/slapd;libexec/openldap/slapd;' \
-e 's;etc/rc.d/rc.kolab start;etc/rc all start;' \
-e 's:print " running:my $cfg; open(FH, "<@l_prefix@/etc/rc.conf") || die; $cfg .= $_ while (); close(FH); $cfg =~ s/\\n((openldap_url|sasl_authmech)\\S*=[^\\n]*)/#\\1\\n/sg; $cfg .= "openldap_url=\\"\\"\\nsasl_authmech=\\"ldap\\"\\n"; open(FH, ">@l_prefix@/etc/rc.conf") || die; print FH $cfg; close(FH); undef $cfg; print " running:' \
-e 's;killall -INT slapd >/dev/null 2>&1;$kolab_prefix/etc/openpkg rc openldap stop;' \
-e 's;\(system("killall -9 slapd >/dev/null 2>&1")\);#\1;' \
kolab_bootstrap
%endif
%{l_shtool} subst \
-e 's;var/openldap/\(sl[aur]*pd.pid\);var/openldap/run/\1;' \
-e 's;^lastmod.*on$;;' \
slapd.conf.template
%{l_shtool} subst \
-e 's;openssl passwd kolab;openssl rand -base64 12;' \
-e 's;openssl passwd nobody;openssl rand -base64 30;' \
kolab_bootstrap
%build
%install
rm -rf $RPM_BUILD_ROOT
%{l_shtool} mkdir -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/kolab \
$RPM_BUILD_ROOT%{l_prefix}/var/kolab/log \
$RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/cgi-bin \
$RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/icons
%{l_shtool} mkdir -p -m 777 \
$RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/admin \
$RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/freebusy \
$RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/locks
%{l_shtool} install -c -m 744 %{l_value -s -a} \
kolab_sslcert.sh kolab kolab_bootstrap workaround.sh \
$RPM_BUILD_ROOT%{l_prefix}/etc/kolab/
%{l_shtool} install -c -m 644 %{l_value -s -a} \
kolab.conf *.template \
$RPM_BUILD_ROOT%{l_prefix}/etc/kolab/
%if "%{with_genuine}" == "no"
%{l_shtool} mkdir -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/openldap/schema \
$RPM_BUILD_ROOT%{l_prefix}/sbin
%{l_shtool} install -c -m 744 %{l_value -s -a} \
kolabd kolabconf \
$RPM_BUILD_ROOT%{l_prefix}/sbin/
%{l_shtool} install -c -m 644 %{l_value -s -a} \
kolab.globals \
$RPM_BUILD_ROOT%{l_prefix}/etc/kolab/
%{l_shtool} install -c -m 644 %{l_value -s -a} \
kolab.schema kolab-cf.schema \
$RPM_BUILD_ROOT%{l_prefix}/etc/openldap/schema/
%else
%{l_shtool} install -c -m 644 %{l_value -s -a} \
kolab.schema \
$RPM_BUILD_ROOT%{l_prefix}/etc/kolab/
%endif
cp -r admin/* $RPM_BUILD_ROOT%{l_prefix}/var/kolab/www/admin/
# install run-command script
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
%if "%{with_genuine}" == "no"
%{l_shtool} install -c -m 755 %{l_value -s -a} \
-e 's;@kolab_daemon@;/sbin/kolabd;' \
%{SOURCE rc.kolab} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
%else
%{l_shtool} install -c -m 755 %{l_value -s -a} \
-e 's;@kolab_daemon@;/etc/kolab/kolab;' \
%{SOURCE rc.kolab} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
%endif
# generate file list
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
'%config %{l_prefix}/etc/kolab/*.pem' \
'%config %{l_prefix}/etc/kolab/*.schema' \
'%config %{l_prefix}/etc/kolab/kolab.conf'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT
%post
echo "please run '$RPM_INSTALL_PREFIX/etc/kolab/kolab_bootstrap -b'"