[rusers] provide systemd native unit files Resolves: #722632
Jan Horak
hhorak at fedoraproject.org
Tue Aug 2 08:32:09 UTC 2011
commit 7bcf273bd6fc063e70866419a799fa8b4b0a9b4c
Author: Honza Horák <hhorak at redhat.com>
Date: Tue Aug 2 10:31:51 2011 +0200
provide systemd native unit files
Resolves: #722632
rusers.spec | 54 +++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 41 insertions(+), 13 deletions(-)
---
diff --git a/rusers.spec b/rusers.spec
index a1e642e..0f78ab8 100644
--- a/rusers.spec
+++ b/rusers.spec
@@ -5,14 +5,14 @@
Summary: Displays the users logged into machines on the local network
Name: rusers
Version: 0.17
-Release: 63%{?dist}
+Release: 64%{?dist}
License: BSD
Url: http://rstatd.sourceforge.net/
Group: System Environment/Daemons
Source: ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/netkit-rusers-%{version}.tar.gz
-Source1: rusersd.init
+Source1: rusersd.service
Source2: rstatd.tar.gz
-Source3: rstatd.init
+Source3: rstatd.service
Patch0: rstatd-jbj.patch
Patch1: netkit-rusers-0.15-numusers.patch
Patch2: netkit-rusers-0.17-2.4.patch
@@ -47,8 +47,12 @@ local network.
%package server
Summary: Server for the rusers protocol
Group: System Environment/Daemons
-Requires(pre): /sbin/chkconfig
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+Requires(post): systemd-sysv
Requires: portmap
+BuildRequires: systemd-units
%description server
The rusers program allows users to find out who is logged into various
@@ -115,25 +119,45 @@ rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
mkdir -p ${RPM_BUILD_ROOT}%{_sbindir}
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man{1,8}
-mkdir -p ${RPM_BUILD_ROOT}/etc/rc.d/init.d
+mkdir -p ${RPM_BUILD_ROOT}%{_unitdir}
make INSTALLROOT=${RPM_BUILD_ROOT} install
make INSTALLROOT=${RPM_BUILD_ROOT} install -C rpc.rstatd
-install -m 755 %SOURCE1 ${RPM_BUILD_ROOT}/etc/rc.d/init.d/rusersd
-install -m 755 %SOURCE3 ${RPM_BUILD_ROOT}/etc/rc.d/init.d/rstatd
+install -m 755 %SOURCE1 ${RPM_BUILD_ROOT}%{_unitdir}/rusersd.service
+install -m 755 %SOURCE3 ${RPM_BUILD_ROOT}%{_unitdir}/rstatd.service
%clean
rm -rf ${RPM_BUILD_ROOT}
%post server
-/sbin/chkconfig --add rusersd
-/sbin/chkconfig --add rstatd
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
+%triggerun -- %{name} < 0.17-64
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply httpd
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save rstatd rusersd >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del rstatd rusersd >/dev/null 2>&1 || :
+/bin/systemctl try-restart rstatd.service rusersd.service >/dev/null 2>&1 || :
%preun server
if [ $1 = 0 ]; then
- /sbin/chkconfig --del rusersd
- /sbin/chkconfig --del rstatd
+# Package removal, not upgrade
+ /bin/systemctl --no-reload disable rstatd.service rusersd.service > /dev/null 2>&1 || :
+ /bin/systemctl stop rstatd.service rusersd.service > /dev/null 2>&1 || :
+fi
+
+%postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ /bin/systemctl try-restart rstatd.service rusersd.service >/dev/null 2>&1 || :
fi
%files
@@ -148,10 +172,14 @@ fi
%{_mandir}/man8/*
%{_sbindir}/rpc.rstatd
%{_sbindir}/rpc.rusersd
-%{_initrddir}/rusersd
-%{_initrddir}/rstatd
+%{_unitdir}/rusersd.service
+%{_unitdir}/rstatd.service
%changelog
+* Tue Aug 02 2011 Honza Horak <hhorak at redhat.com> - 0.17-64
+- provide systemd native unit files
+ Resolves: #722632
+
* Tue Aug 02 2011 Honza Horak <hhorak at redhat.com> - 0.17-63
- added rpcbind into LSB header
Resolves: #697862
More information about the scm-commits
mailing list