[mipv6-daemon] Migrate to systemd.
Jon Ciesla
limb at fedoraproject.org
Wed Apr 25 12:45:44 UTC 2012
commit a5e10800c2be2a4b1009ae6317c0d5b7c0893107
Author: Jon Ciesla <limburgher at gmail.com>
Date: Wed Apr 25 07:45:33 2012 -0500
Migrate to systemd.
mip6d.service | 10 ++++++++++
mipv6-daemon.spec | 48 +++++++++++++++++++++++++++++++++++-------------
2 files changed, 45 insertions(+), 13 deletions(-)
---
diff --git a/mip6d.service b/mip6d.service
new file mode 100644
index 0000000..490b005
--- /dev/null
+++ b/mip6d.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=MIPL Mobile IPv6
+After=network.target
+
+[Service]
+EnvironmentFile=-/etc/sysconfig/mip6d
+ExecStart=/usr/sbin/mip6d $ARGS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/mipv6-daemon.spec b/mipv6-daemon.spec
index 810ee4c..233125c 100644
--- a/mipv6-daemon.spec
+++ b/mipv6-daemon.spec
@@ -1,20 +1,24 @@
Name: mipv6-daemon
Version: 2.0.2.20110203bgit
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Mobile IPv6 (MIPv6) Daemon
Group: System Environment/Daemons
License: GPLv2
URL: http://www.umip.org/
Source0: http://www.infradead.org/~tgr/mip6d/mipv6-daemon-%{version}.tar.gz
-Source1: mip6d.init
+Source1: mip6d.service
Source2: mip6d.sysconfig
Source3: mip6d.conf
#Patch0: foo.patch
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: flex bison indent
-Requires: initscripts, chkconfig
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+# For triggerun
+Requires(post): systemd-sysv
%description
The mobile IPv6 daemon allows nodes to remain
@@ -32,8 +36,8 @@ make %{?_smp_mflags}
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{_initrddir}
-install -m755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/mip6d
+install -d $RPM_BUILD_ROOT%{_unitdir}
+install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/mip6d.service
install -d $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/mip6d
install -m644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/mip6d.conf
@@ -42,24 +46,39 @@ install -m644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/mip6d.conf
rm -rf $RPM_BUILD_ROOT
%preun
-if [ "$1" = 0 ]
-then
- /sbin/service mip6d stop > /dev/null 2>&1 ||:
- /sbin/chkconfig --del mip6d
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable mip6d.service > /dev/null 2>&1 || :
+ /bin/systemctl stop mip6d.service > /dev/null 2>&1 || :
fi
%post
-/sbin/chkconfig --add mip6d
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
%postun
-if [ "$1" -ge "1" ]; then
- /sbin/service mip6d condrestart > /dev/null 2>&1 ||:
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ /bin/systemctl try-restart mip6d.service >/dev/null 2>&1 || :
fi
+%triggerun -- mipv6-daemon < 2.0.2.20110203bgit-4
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply mip6d
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save mip6d >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del mip6d >/dev/null 2>&1 || :
+/bin/systemctl try-restart mip6d.service >/dev/null 2>&1 || :
+
%files
%defattr(-,root,root,-)
%doc AUTHORS BUGS COPYING NEWS README README.IPsec THANKS extras
-%{_initrddir}/mip6d
+%{_unitdir}/mip6d.service
%config(noreplace) %{_sysconfdir}/sysconfig/mip6d
%config(noreplace) %{_sysconfdir}/mip6d.conf
%{_sbindir}/*
@@ -68,6 +87,9 @@ fi
%{_mandir}/man7/*
%changelog
+* Wed Apr 25 2012 Jon Ciesla <limburgher at gmail.com> - 2.0.2.20110203bgit-4
+- Migrate to systemd, BZ 789773.
+
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.0.2.20110203bgit-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
More information about the scm-commits
mailing list