[isns-utils] Migrate to systemd.
Jon Ciesla
limb at fedoraproject.org
Wed Feb 15 20:30:17 UTC 2012
commit 5a3b9a2b5c22990c8a9445da87d5eceea40978a9
Author: Jon Ciesla <limburgher at gmail.com>
Date: Wed Feb 15 14:30:06 2012 -0600
Migrate to systemd.
isns-utils.spec | 59 +++++++++++++++++++++++++++++++++++++++++++-----------
isnsd.service | 9 ++++++++
2 files changed, 56 insertions(+), 12 deletions(-)
---
diff --git a/isns-utils.spec b/isns-utils.spec
index 3a671cf..23d67a0 100644
--- a/isns-utils.spec
+++ b/isns-utils.spec
@@ -1,13 +1,13 @@
Name: isns-utils
Version: 0.91
-Release: 6%{?dist}
+Release: 7%{?dist}
Summary: The iSNS daemon and utility programs
Group: System Environment/Daemons
License: LGPLv2+
URL: http://oss.oracle.com/~okir/open-isns/
Source0: http://oss.oracle.com/~okir/open-isns/open-isns-%{version}.tar.bz2
-Source1: isnsd.init
+Source1: isnsd.service
Patch0: isns-utils-turn-default-dd-on-to-match-msft.patch
Patch1: isns-utils-update-isnsadm-man.patch
Patch2: isns-utils-fix-non-utf8-chars-in-copying.patch
@@ -16,7 +16,11 @@ Patch3: isns-utils-include-limits.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: openssl-devel automake pkgconfig
-Requires: /sbin/chkconfig /sbin/service
+#Requires: /sbin/chkconfig /sbin/service
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+
%description
The iSNS package contains the daemon and tools to setup a iSNS server,
@@ -50,7 +54,7 @@ autoheader
%{__install} -d %{buildroot}%{_sbindir}
%{__install} -d %{buildroot}%{_mandir}/man8
%{__install} -d %{buildroot}%{_mandir}/man5
-%{__install} -d %{buildroot}%{_initrddir}
+%{__install} -d %{buildroot}%{_unitdir}
%{__install} -d %{buildroot}%{_sysconfdir}/isns
%{__install} -d %{buildroot}%{_var}/lib
%{__install} -d %{buildroot}%{_var}/lib/isns
@@ -60,25 +64,53 @@ autoheader
%{__install} -p -m 644 etc/isnsadm.conf %{buildroot}%{_sysconfdir}/isns/isnsadm.conf
%{__install} -p -m 755 isnsd isnsdd isnsadm isnssetup %{buildroot}%{_sbindir}
-%{__install} -p -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/isnsd
+%{__install} -p -m 0755 %{SOURCE1} %{buildroot}%{_unitdir}/isnsd.service
%{__install} -p -m 644 doc/isns_config.5 %{buildroot}/%{_mandir}/man5/
%{__install} -p -m 644 doc/isnsd.8 doc/isnsdd.8 doc/isnsadm.8 %{buildroot}/%{_mandir}/man8/
%post
-/sbin/chkconfig --add isnsd
+#/sbin/chkconfig --add isnsd
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
%postun
-if [ "$1" = "1" ] ; then
- /sbin/service isnsd condrestart > /dev/null 2>&1
+#if [ "$1" = "1" ] ; then
+# /sbin/service isnsd condrestart > /dev/null 2>&1
+#fi
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ /bin/systemctl try-restart isnsd.service >/dev/null 2>&1 || :
fi
+
%preun
-if [ "$1" = "0" ] ; then
- /sbin/chkconfig isnsd stop > /dev/null 2>&1
- /sbin/chkconfig --del isnsd
+#if [ "$1" = "0" ] ; then
+# /sbin/chkconfig isnsd stop > /dev/null 2>&1
+# /sbin/chkconfig --del isnsd
+#fi
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable isnsd.service > /dev/null 2>&1 || :
+ /bin/systemctl stop isnsd.service > /dev/null 2>&1 || :
fi
+
+%triggerun -- isns-utils < 0.91-7
+# 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 isnsd >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del isnsd >/dev/null 2>&1 || :
+/bin/systemctl try-restart isnsd.service >/dev/null 2>&1 || :
+
+
%clean
%{__rm} -rf %{buildroot}
@@ -91,12 +123,15 @@ fi
%{_sbindir}/isnssetup
%{_mandir}/man8/*
%{_mandir}/man5/*
-%{_initrddir}/isnsd
+%{_unitdir}/isnsd.service
%dir %{_sysconfdir}/isns
%dir %{_var}/lib/isns
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/isns/*
%changelog
+* Wed Feb 15 2012 Jon Ciesla <limburgher at gmail.com> - 0.91-7
+- Migrate to systemd, BZ 789707.
+
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.91-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
diff --git a/isnsd.service b/isnsd.service
new file mode 100644
index 0000000..f4ee128
--- /dev/null
+++ b/isnsd.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=ISNS Server
+After=network.target
+
+[Service]
+ExecStart=/usr/sbin/isnsd -f
+
+[Install]
+WantedBy=multi-user.target
More information about the scm-commits
mailing list