[ocspd] * Tue Jul 12 2011 Patrick Monnerat <pm at datasphere.ch> 1.5.1-0.9.rc1 - Migration from SysV daemon han

Patrick Monnerat monnerat at fedoraproject.org
Tue Jul 12 12:31:09 UTC 2011


commit 2721c246ed65d7fd57ba4766c1b5cb32e67ec5c0
Author: Patrick Monnerat <pm at datasphere.ch>
Date:   Tue Jul 12 14:30:14 2011 +0200

    * Tue Jul 12 2011 Patrick Monnerat <pm at datasphere.ch> 1.5.1-0.9.rc1
    - Migration from SysV daemon handling to systemd (BZ# 720521).

 ocspd.service |   12 ++++++++
 ocspd.spec    |   80 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 82 insertions(+), 10 deletions(-)
---
diff --git a/ocspd.service b/ocspd.service
new file mode 100755
index 0000000..8ac9c06
--- /dev/null
+++ b/ocspd.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=OpenCA OCSP Responder
+After=syslog.target network.target
+
+[Service]
+Type=forking
+PIDFile=/var/run/ocspd.pid
+EnvironmentFile=-/etc/sysconfig/ocspd
+ExecStart=/usr/sbin/ocspd -d -c /etc/ocspd/ocspd.conf
+
+[Install]
+WantedBy=multi-user.target
diff --git a/ocspd.spec b/ocspd.spec
index 3070954..08fae7b 100644
--- a/ocspd.spec
+++ b/ocspd.spec
@@ -4,11 +4,12 @@
 
 Name:		ocspd
 Version:	1.5.1
-Release:	0.8.%{alphatag}%{?dist}
+Release:	0.9.%{alphatag}%{?dist}
 Summary:	OpenCA OCSP Daemon
 License:	ASL 1.0
 Group:		System Environment/Daemons
 Source:		http://downloads.sourceforge.net/openca/openca-ocspd-%{version}%{revision}.tar.gz
+Source1:	ocspd.service
 Patch1:		openca-ocspd-1.5.1-bufresponse.patch
 Patch2:		openca-ocspd-1.5.1-misc.patch
 Patch3:		openca-ocspd-1.5.1-badcomment.patch
@@ -17,10 +18,10 @@ URL:		http://www.openca.org/projects/ocspd
 Obsoletes:	openca-ocspd <= %{version}-%{release}
 Provides:	openca-ocspd = %{version}-%{release}
 Requires(pre):	shadow-utils
-Requires(post):	chkconfig
-Requires(preun):chkconfig
-Requires(preun):initscripts
-Requires(postun):initscripts
+Requires(post):	systemd-units
+Requires(post):	systemd-sysv
+Requires(preun):systemd-units
+Requires(postun):systemd-units
 BuildRequires:	openssl-devel
 BuildRequires:	openldap-devel
 BuildRequires:	automake autoconf
@@ -32,14 +33,20 @@ verify the status of a certificate using OCSP clients (such as
 Mozilla/Firefox/Thunderbird/Apache).
 
 
+#-------------------------------------------------------------------------------
 %prep
+#-------------------------------------------------------------------------------
+
 %setup -q -n openca-ocspd-%{version}%{revision}
 %patch1 -p1 -b .bufresponse
 %patch2 -p1 -b .misc
 %patch3 -p1 -b .badcomment
 %patch4 -p1 -b .openssl
 
+
+#-------------------------------------------------------------------------------
 %build
+#-------------------------------------------------------------------------------
 
 #	Need automake/autoconf rebuild because of above patches.
 
@@ -58,17 +65,36 @@ autoconf
 make %{?_smp_mflags}
 
 
+#-------------------------------------------------------------------------------
 %install
+#-------------------------------------------------------------------------------
+
 rm -rf "${RPM_BUILD_ROOT}"
 
 make DESTDIR="${RPM_BUILD_ROOT}" install
 
 
+#	Remove SysV init scripts directory.
+
+rm -rf "${RPM_BUILD_ROOT}%{_initrddir}"
+
+#	Install systemd init script.
+
+mkdir -p "${RPM_BUILD_ROOT}%{_unitdir}/"
+cp -a "%{SOURCE1}" "${RPM_BUILD_ROOT}%{_unitdir}/"
+
+
+#-------------------------------------------------------------------------------
 %clean
+#-------------------------------------------------------------------------------
+
 rm -rf "${RPM_BUILD_ROOT}"
 
 
+#-------------------------------------------------------------------------------
 %pre
+#-------------------------------------------------------------------------------
+
 getent group ocspd >/dev/null || groupadd -r ocspd
 getent passwd ocspd >/dev/null ||
 	useradd -r -g ocspd -d "%{_sysconfdir}/ocspd"			\
@@ -76,24 +102,52 @@ getent passwd ocspd >/dev/null ||
 exit 0
 
 
+#-------------------------------------------------------------------------------
 %post
-/sbin/chkconfig --add ocspd
+#-------------------------------------------------------------------------------
 
+if [ "${1}" = "1" ]
+then	#	Initial installation.
+	/bin/systemctl daemon-reload > /dev/null 2>&1 || :
+fi
 
+
+#-------------------------------------------------------------------------------
 %preun
+#-------------------------------------------------------------------------------
+
 if [ "${1}" = "0" ]
-then	/sbin/service ocspd stop >/dev/null 2>&1 || :
-	/sbin/chkconfig --del ocspd
+then	#	Package removal, not upgrade.
+	/bin/systemctl --no-reload disable ocspd.service > /dev/null 2>&1 || :
+	/bin/systemctl stop ocspd.service > /dev/null 2>&1 || :
 fi
 
 
+#-------------------------------------------------------------------------------
 %postun
+#-------------------------------------------------------------------------------
+
+/bin/systemctl daemon-reload > /dev/null 2>&1 || :
+
 if [ "${1}" -gt "0" ]
-then	/sbin/service ocspd condrestart >/dev/null 2>&1 || :
+then	#	Package upgrade, not uninstall.
+	/bin/systemctl try-restart ocspd.service > /dev/null 2>&1 || :
 fi
 
 
+#-------------------------------------------------------------------------------
+%triggerun -- ocspd < 1.5.1-0.9
+#-------------------------------------------------------------------------------
+
+%{_bindir}/systemd-sysv-convert --save ocspd > /dev/null 2>&1 || :
+/sbin/chkconfig --del ocspd > /dev/null 2>&1 || :
+/bin/systemctl try-restart ocspd.service > /dev/null 2>&1 || :
+
+
+#-------------------------------------------------------------------------------
 %files
+#-------------------------------------------------------------------------------
+
 %defattr(-, root, root, -)
 %doc AUTHORS COPYING ChangeLog README
 %{_sbindir}/*
@@ -102,11 +156,17 @@ fi
 %attr(700, ocspd, root) %dir %{_sysconfdir}/ocspd/private
 %config(noreplace) %{_sysconfdir}/ocspd/ocspd.conf
 %config(noreplace) %{_sysconfdir}/sysconfig/*
-%{_initrddir}/*
+%{_unitdir}/*
 %{_mandir}/*/*
 
 
+#-------------------------------------------------------------------------------
 %changelog
+#-------------------------------------------------------------------------------
+
+* Tue Jul 12 2011 Patrick Monnerat <pm at datasphere.ch> 1.5.1-0.9.rc1
+- Migration from SysV daemon handling to systemd (BZ# 720521).
+
 * Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.5.1-0.8.rc1
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list