Migrate the package to full native systemd unit files, according to the Fedora

packaging guidelines.
This commit is contained in:
Jan F. Chadima 2011-06-29 10:39:27 +02:00
parent 58fe06df1f
commit d6a7412cac

View File

@ -4,12 +4,11 @@
%define _plugindir2 %{_libdir}/sasl2 %define _plugindir2 %{_libdir}/sasl2
%define bootstrap_cyrus_sasl 0 %define bootstrap_cyrus_sasl 0
%define systemd 0
Summary: The Cyrus SASL library Summary: The Cyrus SASL library
Name: cyrus-sasl Name: cyrus-sasl
Version: 2.1.23 Version: 2.1.23
Release: 22%{?dist} Release: 23%{?dist}
License: BSD with advertising License: BSD with advertising
Group: System Environment/Libraries Group: System Environment/Libraries
# Source0 originally comes from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/; # Source0 originally comes from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/;
@ -144,6 +143,18 @@ The %{name}-ldap package contains the Cyrus SASL plugin which supports using
a directory server, accessed using LDAP, for storing shared secrets. a directory server, accessed using LDAP, for storing shared secrets.
%endif %endif
%package sysvinit
Summary: The SysV initscript to manage the cyrus SASL authd.
Group: System Environment/Daemons
Requires: %{name} = %{version}-%{release}
%description sysvinit
The %{name}-sysvinit package contains the SysV init script to manage
the cyrus SASL authd when running a legacy SysV-compatible init system.
###
%prep %prep
%setup -q %setup -q
chmod -x doc/*.html chmod -x doc/*.html
@ -298,10 +309,8 @@ install -m755 -d $RPM_BUILD_ROOT/var/run/saslauthd
# Install the init script for saslauthd and the init script's config file. # Install the init script for saslauthd and the init script's config file.
install -m755 -d $RPM_BUILD_ROOT/etc/rc.d/init.d $RPM_BUILD_ROOT/etc/sysconfig install -m755 -d $RPM_BUILD_ROOT/etc/rc.d/init.d $RPM_BUILD_ROOT/etc/sysconfig
install -m755 -p %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/saslauthd install -m755 -p %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/saslauthd
%if %{systemd}
install -d -m755 $RPM_BUILD_ROOT/%{_unitdir} install -d -m755 $RPM_BUILD_ROOT/%{_unitdir}
install -m644 -p %{SOURCE5} $RPM_BUILD_ROOT/%{_unitdir}/saslauthd install -m644 -p %{SOURCE5} $RPM_BUILD_ROOT/%{_unitdir}/saslauthd.service
%endif
install -m644 -p %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/saslauthd install -m644 -p %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/saslauthd
install -m755 -d $RPM_BUILD_ROOT/etc/tmpfiles.d install -m755 -d $RPM_BUILD_ROOT/etc/tmpfiles.d
install -m644 -p %{SOURCE11} $RPM_BUILD_ROOT/etc/tmpfiles.d/saslauthd.conf install -m644 -p %{SOURCE11} $RPM_BUILD_ROOT/etc/tmpfiles.d/saslauthd.conf
@ -327,57 +336,31 @@ test "$RPM_BUILD_ROOT" != "/" && rm -rf $RPM_BUILD_ROOT
%pre %pre
getent group %{username} >/dev/null || groupadd -r %{username} getent group %{username} >/dev/null || groupadd -r %{username}
getent passwd %{username} >/dev/null || \ getent passwd %{username} >/dev/null || useradd -r -g %{username} -d %{homedir} -s /sbin/nologin -c \"%{hint}\" %{username}
useradd -r -g %{username} -d %{homedir} -s /sbin/nologin \
-c \"%{hint}\" %{username}
exit 0
%post %post
%if %{systemd}
if [ -x /bin/systemctl ]; then
if [ $1 -eq 1 ]; then if [ $1 -eq 1 ]; then
/bin/systemctl daemon-reload >/dev/null 2>&1 || : /bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi fi
fi
%endif
if [ -x /sbin/chkconfig ]; then
/sbin/chkconfig --add saslauthd
fi
exit 0
%preun %preun
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
%if %{systemd} /bin/systemctl --no-reload disable saslauthd.service >/dev/null 2>&1 || :
if [ -x /bin/systemctl ]; then
/bin/systemctl disable saslauthd.service >/dev/null 2>&1 || :
/bin/systemctl stop saslauthd.service >/dev/null 2>&1 || : /bin/systemctl stop saslauthd.service >/dev/null 2>&1 || :
fi fi
%endif
if [ -x /sbin/service ]; then
/sbin/service saslauthd stop >/dev/null 2>&1 || :
fi
if [ -x /sbin/chkconfig ]; then
/sbin/chkconfig --del saslauthd
fi
fi
exit 0
%postun %postun
%if %{systemd}
if [ -x /bin/systemctl ]; then
/bin/systemctl daemon-reload >/dev/null 2>&1 || : /bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ]; then if [ $1 -ge 1 ]; then
/bin/systemctl try-restart saslauthd.service >/dev/null 2>&1 || : /bin/systemctl try-restart saslauthd.service >/dev/null 2>&1 || :
fi fi
fi
%endif
if [ -x /sbin/service ];then
if [ $1 -ne 0 ]; then
/sbin/service saslauthd condrestart 2>&1 > /dev/null
fi
fi
exit 0 exit 0
%triggerun -n cyrus-sasl -- cyrus-sasl < 2.1.23-32
/usr/bin/systemd-sysv-convert --save saslauthd >/dev/null 2>&1 || :
/sbin/chkconfig --del saslauthd >/dev/null 2>&1 || :
/bin/systemctl try-restart saslauthd.service >/dev/null 2>&1 || :
%post lib -p /sbin/ldconfig %post lib -p /sbin/ldconfig
%postun lib -p /sbin/ldconfig %postun lib -p /sbin/ldconfig
@ -390,10 +373,7 @@ exit 0
%{_sbindir}/saslauthd %{_sbindir}/saslauthd
%{_sbindir}/testsaslauthd %{_sbindir}/testsaslauthd
%config(noreplace) /etc/sysconfig/saslauthd %config(noreplace) /etc/sysconfig/saslauthd
/etc/rc.d/init.d/saslauthd %{_unitdir}/saslauthd.service
%if %{systemd}
%{_unitdir}/saslauthd
%endif
/etc/tmpfiles.d/saslauthd.conf /etc/tmpfiles.d/saslauthd.conf
%ghost /var/run/saslauthd %ghost /var/run/saslauthd
@ -446,7 +426,14 @@ exit 0
%{_mandir}/man3/* %{_mandir}/man3/*
%{_sbindir}/sasl2-shared-mechlist %{_sbindir}/sasl2-shared-mechlist
%files sysvinit
/etc/rc.d/init.d/saslauthd
%changelog %changelog
* Wed Jun 29 2011 Jan F. Chadima <jchadima@redhat.com> - 2.1.23-23
- Migrate the package to full native systemd unit files, according to the Fedora
packaging guidelines.
* Wed Jun 1 2011 Jan F. Chadima <jchadima@redhat.com> - 2.1.23-22 * Wed Jun 1 2011 Jan F. Chadima <jchadima@redhat.com> - 2.1.23-22
- repair rimap support (more packets in response) - repair rimap support (more packets in response)