[cyrus-sasl] Migrate the package to full native systemd unit files, according to the Fedora packaging guidelines.
Jan F. Chadima
jfch2222 at fedoraproject.org
Wed Jun 29 08:41:50 UTC 2011
commit d6a7412cac85b52fdc6bc4af74224b160284c02c
Author: Jan F. Chadima <jfch at eglon.jagda.eu>
Date: Wed Jun 29 10:39:27 2011 +0200
Migrate the package to full native systemd unit files, according to the Fedora
packaging guidelines.
cyrus-sasl.spec | 83 +++++++++++++++++++++++-------------------------------
1 files changed, 35 insertions(+), 48 deletions(-)
---
diff --git a/cyrus-sasl.spec b/cyrus-sasl.spec
index 731963a..8ce5f43 100644
--- a/cyrus-sasl.spec
+++ b/cyrus-sasl.spec
@@ -4,12 +4,11 @@
%define _plugindir2 %{_libdir}/sasl2
%define bootstrap_cyrus_sasl 0
-%define systemd 0
Summary: The Cyrus SASL library
Name: cyrus-sasl
Version: 2.1.23
-Release: 22%{?dist}
+Release: 23%{?dist}
License: BSD with advertising
Group: System Environment/Libraries
# 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.
%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
%setup -q
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 -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
-%if %{systemd}
install -d -m755 $RPM_BUILD_ROOT/%{_unitdir}
-install -m644 -p %{SOURCE5} $RPM_BUILD_ROOT/%{_unitdir}/saslauthd
-%endif
+install -m644 -p %{SOURCE5} $RPM_BUILD_ROOT/%{_unitdir}/saslauthd.service
install -m644 -p %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/saslauthd
install -m755 -d $RPM_BUILD_ROOT/etc/tmpfiles.d
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
getent group %{username} >/dev/null || groupadd -r %{username}
-getent passwd %{username} >/dev/null || \
-useradd -r -g %{username} -d %{homedir} -s /sbin/nologin \
--c \"%{hint}\" %{username}
-exit 0
+getent passwd %{username} >/dev/null || useradd -r -g %{username} -d %{homedir} -s /sbin/nologin -c \"%{hint}\" %{username}
%post
-%if %{systemd}
-if [ -x /bin/systemctl ]; then
- if [ $1 -eq 1 ]; then
- /bin/systemctl daemon-reload >/dev/null 2>&1 || :
- fi
-fi
-%endif
-if [ -x /sbin/chkconfig ]; then
- /sbin/chkconfig --add saslauthd
+if [ $1 -eq 1 ]; then
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
-exit 0
%preun
if [ $1 -eq 0 ]; then
-%if %{systemd}
- if [ -x /bin/systemctl ]; then
- /bin/systemctl disable saslauthd.service >/dev/null 2>&1 || :
- /bin/systemctl stop saslauthd.service >/dev/null 2>&1 || :
- 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
+ /bin/systemctl --no-reload disable saslauthd.service >/dev/null 2>&1 || :
+ /bin/systemctl stop saslauthd.service >/dev/null 2>&1 || :
fi
-exit 0
%postun
-%if %{systemd}
-if [ -x /bin/systemctl ]; then
- /bin/systemctl daemon-reload >/dev/null 2>&1 || :
- if [ $1 -ge 1 ]; then
- /bin/systemctl try-restart saslauthd.service >/dev/null 2>&1 || :
- fi
-fi
-%endif
-if [ -x /sbin/service ];then
- if [ $1 -ne 0 ]; then
- /sbin/service saslauthd condrestart 2>&1 > /dev/null
- fi
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ]; then
+ /bin/systemctl try-restart saslauthd.service >/dev/null 2>&1 || :
fi
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
%postun lib -p /sbin/ldconfig
@@ -390,10 +373,7 @@ exit 0
%{_sbindir}/saslauthd
%{_sbindir}/testsaslauthd
%config(noreplace) /etc/sysconfig/saslauthd
-/etc/rc.d/init.d/saslauthd
-%if %{systemd}
-%{_unitdir}/saslauthd
-%endif
+%{_unitdir}/saslauthd.service
/etc/tmpfiles.d/saslauthd.conf
%ghost /var/run/saslauthd
@@ -446,7 +426,14 @@ exit 0
%{_mandir}/man3/*
%{_sbindir}/sasl2-shared-mechlist
+%files sysvinit
+/etc/rc.d/init.d/saslauthd
+
%changelog
+* Wed Jun 29 2011 Jan F. Chadima <jchadima at 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 at redhat.com> - 2.1.23-22
- repair rimap support (more packets in response)
More information about the scm-commits
mailing list