File citadel.spec of Package citadel
# norootforbuild
Name: citadel
Version: 7.86
Release: 0
Group: Productivity/Networking/Email/Servers
License: GPL v3
URL: http://www.citadel.org
Summary: An easy to use groupware server
Source0: %{name}-%{version}.tar.bz2
Source1: %{name}.init
Source2: %{name}.fedora
Source3: sysconfig.%{name}
Source4: citserver.8
Source5: citadel-setup.8
Source6: ctdlmigrate.8
Source7: citadel.1
Source8: citmail.1
Source9: userlist.1
Source10: whobbs.1
Source11: sendcommand.8
Requires: %{name}-common = %{version}
Requires: libcitadel2 = %{version}
BuildRequires: pkgconfig pam-devel libical-devel ncurses-devel zlib-devel
BuildRequires: libsieve1-devel libcitadel2-devel sed
# Take into account the distribution specific differences:
# Variables:
# * data_dir: The datadir (where the files, images, ... are stored)
# * pki: where the keys are stored
%if 0%{?suse_version} != 0
%if 0%{?sles_version} == 10
BuildRequires: curl-devel ncurses
%else
BuildRequires: libncurses5 libcurl-devel
%endif
BuildRequires: openldap2-devel libexpat-devel
BuildRequires: libopenssl-devel
Requires(pre): %fillup_prereq %insserv_prereq pwdutils
%define data_dir %{_var}/lib/%{name}
%define pki ssl
%endif
%if 0%{?sles_version} == 11
BuildRequires: libdb-4_5-devel
%endif
%if 0%{?suse_version} > 1130
BuildRequires: libdb-4_8-devel
%else
BuildRequires: db-devel
%endif
%if 0%{?suse_version} >= 1140
BuildRequires: sysconfig
%endif
%if 0%{?fedora_version} || 0%{?mandriva_version} || 0%{?centos_version} || 0%{?rhel_version}
BuildRequires: byacc db4-devel openldap-devel curl-devel expat-devel
BuildRequires: openssl-devel
Requires(pre): shadow-utils
Requires(post): chkconfig
Requires(preun): chkconfig initscripts
%define data_dir %{_var}/lib/%{name}
%define pki pki
%endif
%if 0%{?mandriva_version}
# remove CFLAG, because it causes errors
%define Werror_cflags %nil
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
%{summary}
Run %{_sbindir}/citadel-setup to configure Citadel.
%package common
Summary: Citadel - common
Group: Productivity/Networking/Email/Servers
%description common
%{summary}. Files shared by the whole Citadel suite.
%package mta
Summary: Citadel - MTA
Group: Productivity/Networking/Email/Servers
Requires: %{name} = %{version}
Requires: %{name}-common = %{version}
Provides: MTA
Conflicts: postfix exim sendmail
%description mta
%{summary}. A sendmail replacement.
%package client
Summary: Citadel - client
Group: Productivity/Networking/Email/Clients
Requires: %{name}-common = %{version}
%description client
%{summary}. A text client.
%package doc
Summary: Citadel - documentation
Group: Documentation/Other
%description doc
%{summary}. Documentation.
%prep
%setup -q
%build
aclocal
autoconf
export CFLAGS="%{optflags} -g -fpie"
export LDFLAGS="-pie"
%configure \
--prefix=%{_libdir}/%{name}/ \
--with-datadir=%{data_dir}/ \
--with-helpdir=%{_datadir}/%{name}/ \
--with-staticdatadir=%{_sysconfdir}/%{name}/ \
--with-spooldir=%{_var}/spool/%{name}/ \
--with-sysconfdir=%{_sysconfdir}/%{name}/ \
--with-rundir=%{_var}/run/%{name}/ \
--with-docdir=%{_docdir}/%{name}/ \
--with-ssldir=%{_sysconfdir}/%{pki}/%{name}/ \
--with-utility-bindir=%{_usr}/lib/%{name}/ \
--with-autosysconfdir=%{data_dir}/data/ \
--with-pam \
--with-db \
--with-zlib \
--with-ldap \
--with-libical \
--with-libsieve \
--enable-debug $(EXTRA_ARGS) $(PROFILE_ARGS) $(THREAD_ARGS)
%{__make} %{?jobs:-j%jobs}
# create the user and group
%pre
getent group citadel >/dev/null || /usr/sbin/groupadd -r citadel
getent passwd citadel >/dev/null || /usr/sbin/useradd -r -g citadel \
-c "citadel system user" -d %{_var}/run/%{name} \
-s /bin/false citadel
exit 0
%install
%{__rm} -rf %{buildroot}
# create pam.d or the pam module will not be installed
install -d %{buildroot}/%{_sysconfdir}/pam.d
make install-new DESTDIR=%{buildroot}
# create the needed directories
install -d %{buildroot}%{_sysconfdir}/%{pki}/%{name}
install -d %{buildroot}/%{data_dir}/data
# install the init scripts and sysconfig files
# on SUSE it's not allowed to store the sysconfig files directly
# the init scripts differ between SUSE and fedorea
%if 0%{?suse_version}
install -Dm0755 %{SOURCE1} %{buildroot}/%{_sysconfdir}/init.d/%{name}
install -Dm0600 %{SOURCE3} %{buildroot}/var/adm/fillup-templates/sysconfig.%{name}
%else #fedora
install -Dm0755 %{SOURCE2} %{buildroot}/%{_sysconfdir}/init.d/%{name}
install -Dm0600 %{SOURCE3} %{buildroot}/%{_sysconfdir}/sysconfig/%{name}
%endif
# remove $remote_fs from init file. mdv doesn't know it.
%if 0%{?mandriva_version}
sed -i -e s/\$remote_fs\ // %{buildroot}/%{_sysconfdir}/init.d/%{name}
%endif
# install the man-pages
install -Dm0644 %{SOURCE4} %{buildroot}/%{_mandir}/man8/citserver.8
install -Dm0644 %{SOURCE5} %{buildroot}/%{_mandir}/man8/citadel-setup.8
install -Dm0644 %{SOURCE6} %{buildroot}/%{_mandir}/man8/ctdlmigrate.8
install -Dm0644 %{SOURCE11} %{buildroot}/%{_mandir}/man8/sendcommand.8
install -Dm0644 %{SOURCE7} %{buildroot}/%{_mandir}/man1/citadel.1
install -Dm0644 %{SOURCE8} %{buildroot}/%{_mandir}/man1/citmail.1
install -Dm0644 %{SOURCE9} %{buildroot}/%{_mandir}/man1/userlist.1
install -Dm0644 %{SOURCE10} %{buildroot}/%{_mandir}/man1/whobbs.1
# some binaries must be in /usr/bin/, so move them
mv %{buildroot}/%{_usr}/lib/%{name}/setup %{buildroot}/%{_sbindir}/%{name}-setup
mv %{buildroot}/%{_usr}/lib/%{name}/userlist %{buildroot}/%{_sbindir}
mv %{buildroot}/%{_usr}/lib/%{name}/ctdlmigrate %{buildroot}/%{_sbindir}
# replace sendmail by a link to citmail
rm -f %{buildroot}/%{_sbindir}/sendmail
ln -sf %{_sbindir}/citmail %{buildroot}/%{_sbindir}/sendmail
%if 0%{?mandriva_version}
ln -sf %{_mandir}/man1/citmail.1 %{buildroot}/%{_mandir}/man1/sendmail.1.lzma
%else
ln -sf %{_mandir}/man1/citmail.1 %{buildroot}/%{_mandir}/man1/sendmail.1.gz
%endif
# On SUSE we need an rc file in /usr/sbin/, so link it
%if 0%{?suse_version}
ln -sf %{_sysconfdir}/init.d/citadel %{buildroot}/%{_sbindir}/rccitadel
%endif
# It's not allowed to have files in /var/run, so remove it.
%{__rm} -rf %{buildroot}/%{_var}/run/%{name}
%{__rm} -f %{buildroot}/%{_usr}/lib/%{name}/citserver.unstripped
# this is obviously wrong, but it's working
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
rm -rf %{buildroot}/%{_docdir}/%{name}
%endif
%clean
%{__rm} -rf %{buildroot}
# install the service and create /var/run if it doesn't exist
%post
%if 0%{?suse_version}
%{fillup_and_insserv -y citadel}
%else #fedora
/sbin/chkconfig --add %{name}
%endif
if [ ! -d %{_var}/run/%{name} ] ; then
mkdir %{_var}/run/%{name}
chown citadel:citadel %{_var}/run/%{name}
fi
# remove the service before uninstall
%preun
%if 0%{?suse_version}
%stop_on_removal %{name}
%else #fedora
if [ $1 -eq 0 ] ; then
/sbin/service %{name} stop >/dev/null 2>&1
/sbin/chkconfig --del %{name}
fi
%endif
# distinguish between update ($1 = 1) and delete ($1 = 0)
%postun
%if 0%{?suse_version}
%restart_on_update %{name}
%insserv_cleanup
%else #fedora
if [ $1 -ge 1 ] ; then
/sbin/service %{name} condrestart >/dev/null 2>&1 || :
fi
%endif
if [ $1 -eq 0 ] ; then
# remove config files generate by citadel itself
rm -f %{data_dir}/data/citadel.config
rm -f %{data_dir}/data/citadel.control
rm -f %{data_dir}/data/refcount_adjustments.dat
rm -rf %{_sysconfdir}/%{name}/netconfigs
echo "%{data_dir}/data not removed, as it may contain your personal data."
echo "%{_sysconfdir}/%{pki}/%{name} not removed. "
fi
%files common
%defattr(-,root,root,-)
%doc COPYING
%attr(-,%{name},%{name}) %dir %config %{_sysconfdir}/%{name}
%files
%defattr(-,root,root)
%doc docs/welcomemail.* database_cleanup.sh
%{_sysconfdir}/init.d/%{name}
%config %{_sysconfdir}/pam.d/citadel
%attr(-,%{name},%{name}) %config %{_sysconfdir}/%{name}/mail.aliases
%attr(-,%{name},%{name}) %config %{_sysconfdir}/%{name}/public_clients
%attr(-,%{name},%{name}) %config %{_sysconfdir}/%{name}/messages
%{_sbindir}/citmail
%{_sbindir}/citserver
%{_sbindir}/sendcommand
%{_sbindir}/citadel-setup
%{_sbindir}/userlist
%{_sbindir}/ctdlmigrate
%{_mandir}/man1/citmail.1*
%{_mandir}/man1/userlist.1*
%{_mandir}/man8/citserver.8*
%{_mandir}/man8/citadel-setup.8*
%{_mandir}/man8/ctdlmigrate.8*
%{_mandir}/man8/sendcommand.8*
%{_usr}/lib/%{name}/
%{_datadir}/%{name}/
%attr(-,%{name},%{name}) %{_var}/spool/%{name}/
%attr(-,%{name},%{name}) %{data_dir}
%if 0%{?suse_version}
/var/adm/fillup-templates/sysconfig.%{name}
%{_sbindir}/rccitadel
%else #fedora
%{_sysconfdir}/sysconfig/%{name}
%endif
%files mta
%defattr(-,root,root)
%{_sbindir}/sendmail
%if 0%{?mandriva_version} == 0
%{_mandir}/man1/sendmail.1*
%endif
%files client
%defattr(-,root,root)
%attr(-,%{name},%{name}) %config %{_sysconfdir}/%{name}/%{name}.rc
%{_bindir}/%{name}
%{_bindir}/whobbs
%{_mandir}/man1/%{name}.1*
%{_mandir}/man1/whobbs.1*
%files doc
%defattr(-,root,root)
%doc COPYING README.txt docs techdoc openldap
%changelog
* Thu May 12 2011 Stefan Jakobs <stefan.jakobs@rus.uni-stuttgart.de> - 7.86-0
- added: support for Mandriva 2010.X
* Wed May 11 2011 Stefan Jakobs <stefan.jakobs@rus.uni-stuttgart.de> - 7.86-0
- added: support for openSUSE 11.2, 11.3 SLE_11
- added: sendcommand man page
* Mon May 5 2011 Stefan Jakobs <stefan.jakobs@rus.uni-stuttgart.de> - 7.86-0
- Update to 7.86 and new manfiles, init scripts.
* Wed Apr 20 2011 TI_Eugene <ti.eugene@gmail.com> - 7.85
- Next version
* Tue Jun 21 2010 TI_Eugene <ti.eugene@gmail.com> - 7.72-0
- Initial build in OBS