[Pound/f16] convert to systemd

Tom Callaway spot at fedoraproject.org
Fri Sep 16 19:17:47 UTC 2011


commit f13b38e1d63fab47f7204365ef747db1f47dbb46
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date:   Fri Sep 16 15:17:34 2011 -0400

    convert to systemd

 Pound.spec    |   53 +++++++++++++++++++++++++++++++++--------------------
 pound.service |   11 +++++++++++
 2 files changed, 44 insertions(+), 20 deletions(-)
---
diff --git a/Pound.spec b/Pound.spec
index b0bb8a0..10be837 100644
--- a/Pound.spec
+++ b/Pound.spec
@@ -6,15 +6,14 @@
 
 Name:        Pound
 Version:     2.6
-Release:     0.1%{?dist}.%{alphatag}
+Release:     0.2%{?dist}.%{alphatag}
 Summary:     Reverse proxy and load balancer
-
 Group:       System Environment/Daemons
 License:     GPLv3
 URL:         http://www.apsis.ch/pound
 
-
 BuildRequires: openssl-devel, pcre-devel
+BuildRequires: systemd-units
 
 # tcmalloc doesn't exist on ppc64 yet (#238390)
 # or sparc arches
@@ -24,12 +23,13 @@ BuildRequires: google-perftools-devel
 
 Requires(pre):    %{_sbindir}/useradd
 Requires(pre):    %{_sbindir}/groupadd
-Requires(post):   /sbin/chkconfig
-Requires(preun):  /sbin/chkconfig, /sbin/service
-Requires(postun): /sbin/service
+Requires(post):   systemd-sysv
+Requires(post):   systemd-units
+Requires(preun):  systemd-units
+Requires(postun): systemd-units
 
 Source0:  http://www.apsis.ch/pound/%{name}-%{version}%{alphatag}.tgz
-Source1:  pound.init
+Source1:  pound.service
 Source2:  pound.cfg
 Patch0:   pound-remove-owner.patch
 
@@ -51,19 +51,15 @@ give away
 make %{?_smp_mflags}
 
 %install
-rm -rf %{buildroot}
 make install DESTDIR=%{buildroot}
 
 %{__install} -d %{buildroot}%{pound_home}
-%{__install} -p -D -m 755 %{SOURCE1} %{buildroot}%{_initrddir}/pound
+%{__install} -p -D -m 755 %{SOURCE1} %{buildroot}%{_unitdir}/pound.service
 %{__install} -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/pound.cfg 
 
 mkdir -p %{buildroot}%{_sysconfdir}/pki/tls/certs
 touch %{buildroot}%{_sysconfdir}/pki/tls/certs/pound.pem
 
-%clean
-rm -rf %{buildroot}
-
 %pre
 %{_sbindir}/groupadd -f -r %{pound_group}
 id %{pound_user} >/dev/null 2>&1 || \
@@ -71,8 +67,10 @@ id %{pound_user} >/dev/null 2>&1 || \
     -c "Pound user" %{pound_user}
 
 %post
-/sbin/chkconfig --add pound
-
+if [ $1 -eq 1 ] ; then 
+    # Initial installation 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 # generate dummy certificate
 exec > /dev/null 2> /dev/null
 if [ ! -f %{_sysconfdir}/pki/tls/certs/pound.pem ] ; then
@@ -94,29 +92,44 @@ fi
 exit 0
 
 %preun
-if [ $1 = 0 ]; then
-    /sbin/service pound stop >/dev/null 2>&1
-    /sbin/chkconfig --del pound
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable pound.service > /dev/null 2>&1 || :
+    /bin/systemctl stop pound.service > /dev/null 2>&1 || :
 fi
 
 %postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
 if [ $1 -ge 1 ] ; then
-    /sbin/service pound condrestart > /dev/null 2>&1 || :
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart pound.service >/dev/null 2>&1 || :
 fi
 
+%triggerun -- pound < 2.6-0.2.c
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply pound
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save pound >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del pound >/dev/null 2>&1 || :
+/bin/systemctl try-restart pound.service >/dev/null 2>&1 || :
+
 %files
-%defattr(-,root,root,-)
 %doc CHANGELOG FAQ GPL.txt README
 %{_mandir}/man8/pound.8*
 %{_mandir}/man8/poundctl.8*
 %{_sbindir}/pound
 %{_sbindir}/poundctl
-%{_initrddir}/pound
+%{_unitdir}/pound.service
 %config(noreplace) %{_sysconfdir}/pound.cfg
 %ghost %config(noreplace) %{_sysconfdir}/pki/tls/certs/pound.pem
 %attr(-,%{pound_user},%{pound_group}) %dir %{pound_home}
 
 %changelog
+* Fri Sep 16 2011 Tom Callaway <spot at fedoraproject.org> 2.6-0.2.c
+- convert to systemd
+
 * Wed Feb 09 2011 Ruben Kerkhof <ruben at rubenkerkhof.com> 2.6-0.1.c
 - Upstream released new version
 - Drop upstreamed OpenSSL patch
diff --git a/pound.service b/pound.service
new file mode 100644
index 0000000..fd50f1b
--- /dev/null
+++ b/pound.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Pound Reverse Proxy And Load-balancer
+After=syslog.target network.target
+
+[Service]
+Type=forking
+PIDFile=/var/run/pound.pid
+ExecStart=/usr/sbin/pound
+
+[Install]
+WantedBy=multi-user.target


More information about the scm-commits mailing list