[rwall] added systemd native unit file
Jan Horak
hhorak at fedoraproject.org
Tue Aug 2 10:25:58 UTC 2011
commit a8e18435a05e755ea80286f0f7a5b20ddd341b6d
Author: Honza Horák <hhorak at redhat.com>
Date: Tue Aug 2 12:25:33 2011 +0200
added systemd native unit file
rwall.spec | 41 +++++++++++++++++++++++++++++++++--------
1 files changed, 33 insertions(+), 8 deletions(-)
---
diff --git a/rwall.spec b/rwall.spec
index d5c2aa2..d89d196 100644
--- a/rwall.spec
+++ b/rwall.spec
@@ -1,12 +1,12 @@
Summary: Client for sending messages to a host's logged in users
Name: rwall
Version: 0.17
-Release: 32%{?dist}
+Release: 33%{?dist}
License: BSD
Url: ftp://ftp.linux.org.uk/pub/linux/Networking/netkit/
Group: System Environment/Daemons
Source: ftp://ftp.linux.org.uk/pub/linux/Networking/netkit/netkit-rwall-%{version}.tar.gz
-Source1: rwalld.init
+Source1: rwalld.service
Patch1: netkit-rwalld-0.10-banner.patch
Patch2: netkit-rwall-0.17-strip.patch
Patch3: netkit-rwall-0.17-netgroup.patch
@@ -26,8 +26,12 @@ logged in to a specified host machine.
%package server
Summary: Server for sending messages to a host's logged in users
Group: System Environment/Daemons
-Requires(pre): /sbin/chkconfig /etc/init.d
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+Requires(post): systemd-sysv
Requires: portmap
+BuildRequires: systemd-units
%description server
The rwall command sends a message to all of the users logged into
@@ -73,17 +77,35 @@ make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
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
-install -m 755 %SOURCE1 ${RPM_BUILD_ROOT}%{_initrddir}/rwalld
+
+install -m 755 %{SOURCE1} ${RPM_BUILD_ROOT}%{_unitdir}/
%post server
-/sbin/chkconfig --add rwalld
+if [ $1 = 1 ]; then
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
+# Package with native systemd unit file is installed for the first time
+%triggerun -- rwall-server < 0.17-33
+%{_bindir}/systemd-sysv-convert --save rwalld >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del rwalld >/dev/null 2>&1 || :
+/bin/systemctl try-restart rwalld.service >/dev/null 2>&1 || :
%preun server
if [ $1 = 0 ]; then
- /sbin/chkconfig --del rwalld
+ /bin/systemctl --no-reload disable rwalld.service >/dev/null 2>&1 || :
+ /bin/systemctl stop rwalld.service >/dev/null 2>&1 || :
+fi
+
+%postun server
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ]; then
+ /bin/systemctl try-restart rwalld.service >/dev/null 2>&1 || :
fi
%files
@@ -96,9 +118,12 @@ fi
%{_sbindir}/rpc.rwalld
%{_mandir}/man8/rpc.rwalld.8*
%{_mandir}/man8/rwalld.8*
-%{_initrddir}/rwalld
+%{_unitdir}/*
%changelog
+* Mon Aug 01 2011 Honza Horak <hhorak at redhat.com> - 0.17-33
+- added systemd native unit file
+
* Mon Aug 01 2011 Honza Horak <hhorak at redhat.com> - 0.17-32
- moved privileges drop after port reservation to handle
a bug similar to #247985
More information about the scm-commits
mailing list