[mod_pubcookie] server startup switched from xinetd to systemd (#737692)

Gabriel L. Somlo somlo at fedoraproject.org
Tue Sep 13 00:41:45 UTC 2011


commit d9d95c35182633c334ac5321ef040a8fad591a6d
Author: Gabriel L. Somlo <somlo at hedwig.ini.cmu.edu>
Date:   Mon Sep 12 20:41:31 2011 -0400

    server startup switched from xinetd to systemd (#737692)

 keyserver.service  |    8 ++++++++
 keyserver.socket   |    9 +++++++++
 keyserver.xinetd   |   13 -------------
 mod_pubcookie.spec |   51 +++++++++++++++++++++++++++++++++++++++++----------
 4 files changed, 58 insertions(+), 23 deletions(-)
---
diff --git a/keyserver.service b/keyserver.service
new file mode 100644
index 0000000..954f91e
--- /dev/null
+++ b/keyserver.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Pubcookie Keyserver 
+After=local-fs.target
+
+[Service]
+Group=tty
+ExecStart=/usr/sbin/keyserver
+StandardInput=socket
diff --git a/keyserver.socket b/keyserver.socket
new file mode 100644
index 0000000..9612fea
--- /dev/null
+++ b/keyserver.socket
@@ -0,0 +1,9 @@
+[Unit]
+Description=Pubcookie Keyserver Activation Socket
+
+[Socket]
+ListenStream=2222
+Accept=true
+
+[Install]
+WantedBy=sockets.target
diff --git a/mod_pubcookie.spec b/mod_pubcookie.spec
index 80769b7..9654e67 100644
--- a/mod_pubcookie.spec
+++ b/mod_pubcookie.spec
@@ -1,6 +1,6 @@
 Name: mod_pubcookie
 Version: 3.3.4a
-Release: 4%{?dist}
+Release: 5%{?dist}
 Summary: A solution for single sign-on authentication to websites
 License: ASL 2.0
 Group: System Environment/Daemons
@@ -9,12 +9,13 @@ Source0: http://pubcookie.org/downloads/pubcookie-%{version}.tar.gz
 Source1: key.config
 Source2: modpubcookie.conf
 Source3: pubcookie_login.conf
-Source4: keyserver.xinetd
-Source5: keyclient.8
-Source6: keyserver.8
+Source4: keyserver.socket
+Source5: keyserver.service
+Source6: keyclient.8
+Source7: keyserver.8
 Patch0: pubcookie-3.3.4a-installdir.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires: httpd-devel openssl-devel openldap-devel krb5-devel
+BuildRequires: httpd-devel openssl-devel openldap-devel krb5-devel systemd-units
 Requires: mod_ssl
 
 %description
@@ -27,7 +28,9 @@ single sign-on authentication to websites throughout an institution.
 Summary: The pubcookie login server components
 Group: System Environment/Daemons
 Requires: %{name} = %{version}-%{release}
-Requires: xinetd
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
 
 %description server
 This package contains the login server portion of pubcookie.
@@ -58,13 +61,37 @@ This package contains the login server portion of pubcookie.
 %{__install} -D -m 0644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/pubcookie/config
 %{__install} -D -m 0644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/httpd/conf.d/modpubcookie.conf
 %{__install} -D -m 0644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/httpd/conf.d/pubcookie_login.conf
-%{__install} -D -m 0644 %{SOURCE4} %{buildroot}/%{_sysconfdir}/xinetd.d/keyserver
-%{__install} -D -m 0644 %{SOURCE5} %{buildroot}/%{_mandir}/man8/keyclient.8
-%{__install} -D -m 0644 %{SOURCE6} %{buildroot}/%{_mandir}/man8/keyserver.8
+%{__install} -D -m 0644 %{SOURCE4} %{buildroot}/%{_unitdir}/keyserver.socket
+%{__install} -D -m 0644 %{SOURCE5} %{buildroot}/%{_unitdir}/keyserver.service
+%{__install} -D -m 0644 %{SOURCE6} %{buildroot}/%{_mandir}/man8/keyclient.8
+%{__install} -D -m 0644 %{SOURCE7} %{buildroot}/%{_mandir}/man8/keyserver.8
 
 %clean
 %{__rm} -rf %{buildroot}
 
+%post server
+if [ $1 -eq 1 ] ; then 
+  # Initial installation 
+  /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
+%preun server
+if [ $1 -eq 0 ] ; then
+  # Package removal, not upgrade
+  /bin/systemctl --no-reload disable keyserver.socket > /dev/null 2>&1 || :
+  /bin/systemctl --no-reload disable keyserver.service > /dev/null 2>&1 || :
+  /bin/systemctl stop keyserver.socket > /dev/null 2>&1 || :
+  /bin/systemctl stop keyserver.service > /dev/null 2>&1 || :
+fi
+
+%postun server
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+  # Package upgrade, not uninstall
+  /bin/systemctl try-restart keyserver.socket >/dev/null 2>&1 || :
+  /bin/systemctl try-restart keyserver.service >/dev/null 2>&1 || :
+fi
+
 %files
 %defattr(-,root,root,-)
 %doc doc/*.txt doc/config.html doc/install-mod_pubcookie.html doc/mod_pubcookie-directives.html
@@ -78,14 +105,18 @@ This package contains the login server portion of pubcookie.
 %files server
 %defattr(-,root,root,-)
 %doc doc/install-filter.html doc/install-login.html doc/krb5-getcred.html
-%config(noreplace) %{_sysconfdir}/xinetd.d/keyserver
 %config(noreplace) %{_sysconfdir}/httpd/conf.d/pubcookie_login.conf
+/lib/systemd/system/keyserver.socket
+/lib/systemd/system/keyserver.service
 %{_sbindir}/keyserver
 %{_mandir}/man8/keyserver.*
 %{_datadir}/pubcookie
 %{_localstatedir}/lib/pubcookie/starter.key
 
 %changelog
+* Mon Sep 12 2011 Gabriel Somlo <somlo at cmu.edu> 3.3.4a-5
+- server startup switched from xinetd to systemd (#737692)
+
 * Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.3.4a-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list