[bootparamd] Migration from SysV daemon handling to systemd (#722629)

Lukáš Nykrýn lnykryn at fedoraproject.org
Mon Sep 5 14:18:04 UTC 2011


commit a75aef2a406cae7127020d35efbab7653971a59d
Author: Lukas Nykryn <lnykryn at redhat.com>
Date:   Mon Sep 5 16:16:53 2011 +0200

    Migration from SysV daemon handling to systemd (#722629)

 bootparamd.init    |   83 ----------------------------------------------------
 bootparamd.service |   12 +++++++
 bootparamd.spec    |   38 ++++++++++++++++-------
 3 files changed, 38 insertions(+), 95 deletions(-)
---
diff --git a/bootparamd.service b/bootparamd.service
new file mode 100755
index 0000000..6c63d05
--- /dev/null
+++ b/bootparamd.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Bootparamd Netboot Sun Workstations From Linux
+Requires=syslog.target network.target
+ConditionPathExists=/etc/bootparams
+
+[Service]
+Type=forking
+ExecStart=/usr/sbin/rpc.bootparamd
+StandardError=syslog
+
+[Install]
+WantedBy=multi-user.target
diff --git a/bootparamd.spec b/bootparamd.spec
index 0bcdd9f..24b924a 100644
--- a/bootparamd.spec
+++ b/bootparamd.spec
@@ -1,11 +1,11 @@
 Summary: A server process which provides boot information to diskless clients
 Name: bootparamd
 Version: 0.17
-Release: 31%{?dist}
+Release: 32%{?dist}
 License: BSD
 Group: System Environment/Daemons
 Source: ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/netkit-%{name}-%{version}.tar.gz
-Source1: bootparamd.init
+Source1: bootparamd.service
 Patch: bootparamd-manpage-63567.patch
 Patch1: bootparamd-resolver.patch
 Patch2: bootparamd-debug.patch
@@ -15,9 +15,10 @@ Patch5: bootparamd-get-router.patch
 Patch6: bootparamd-err.patch
 Patch7: bootparamd-byteorder.patch
 
-Requires(post): /sbin/chkconfig
-Requires(preun): /sbin/chkconfig
-Requires(preun): /sbin/service
+BuildRequires: systemd-units
+Requires(post):	systemd-units
+Requires(post):	systemd-sysv
+Requires(preun):systemd-units
 Requires: portmap
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -69,8 +70,8 @@ mkdir -p %{buildroot}%{_bindir}
 mkdir -p %{buildroot}%{_mandir}/man{1,8}
 mkdir -p %{buildroot}%{_sbindir}
 
-install -d %{buildroot}%{_initrddir}
-install -m 755 %SOURCE1 %{buildroot}%{_initrddir}/bootparamd
+mkdir -p "${RPM_BUILD_ROOT}%{_unitdir}/"
+cp -a "%{SOURCE1}" "${RPM_BUILD_ROOT}%{_unitdir}/"
 
 make INSTALLROOT=%{buildroot} install
 
@@ -78,23 +79,36 @@ make INSTALLROOT=%{buildroot} install
 rm -rf %{buildroot}
 
 %post
-/sbin/chkconfig --add bootparamd
+if [ "${1}" = "1" ]
+then	#	Initial installation.
+	/bin/systemctl daemon-reload > /dev/null 2>&1 || :
+fi
 
 %preun
-if [ $1 = 0 ]; then
-  /sbin/service bootparamd stop >/dev/null 2>&1
-  /sbin/chkconfig --del bootparamd
+if [ $1 = 0 ]; then	#	Package removal, not upgrade.
+	/bin/systemctl --no-reload disable bootparamd.service > /dev/null 2>&1 || :
+	/bin/systemctl stop bootparamd.service > /dev/null 2>&1 || :
 fi
 
+
+%triggerun -- bootparamd < 0.17-31
+%{_bindir}/systemd-sysv-convert --save bootparamd > /dev/null 2>&1 || :
+/sbin/chkconfig --del bootparamd > /dev/null 2>&1 || :
+/bin/systemctl try-restart bootparamd.service > /dev/null 2>&1 || :
+
+
 %files
 %defattr(-,root,root)
 %{_sbindir}/rpc.bootparamd
 %{_bindir}/callbootd
 %{_mandir}/man8/rpc.bootparamd.*
 %{_mandir}/man8/bootparamd.*
-%{_initrddir}/bootparamd
+%{_unitdir}/*
 
 %changelog
+* Thu Sep 05 2011 Lukas Nykryn <lnykryn at redhat.com> - 0.17-32
+- Migration from SysV daemon handling to systemd (#722629)
+
 * Thu Aug 11 2011 Lukas Nykryn <lnykryn at redhat.com> - 0.17-31
 - fixed byte order
 - reverted changes in get-router.patch - it was impossible to build package


More information about the scm-commits mailing list