[shmpps] convert to systemd
Tom Callaway
spot at fedoraproject.org
Thu Sep 15 18:54:02 UTC 2011
commit 65d009377a0823c92e41a4720778df2abb08ec04
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date: Thu Sep 15 14:53:50 2011 -0400
convert to systemd
shmpps.service | 13 +++++++++++++
shmpps.spec | 53 ++++++++++++++++++++++++++++++++++-------------------
2 files changed, 47 insertions(+), 19 deletions(-)
---
diff --git a/shmpps.service b/shmpps.service
new file mode 100644
index 0000000..c97175a
--- /dev/null
+++ b/shmpps.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=PPS Shared Memory Driver For NTP
+After=syslog.target
+Before=ntpd.service
+
+[Service]
+Type=forking
+EnvironmentFile=-/etc/sysconfig/shmpps
+ExecStart=/usr/sbin/shm_splc2 $OPTIONS
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/shmpps.spec b/shmpps.spec
index 4e8cca8..cd245ee 100644
--- a/shmpps.spec
+++ b/shmpps.spec
@@ -1,20 +1,21 @@
Name: shmpps
Version: 1.03
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Shared Memory driver for PPS time signals
Group: System Environment/Daemons
License: Public Domain and MIT
URL: http://time.qnan.org/
Source0: http://time.qnan.org/%{name}.tar
-Source1: shmpps.init
+Source1: shmpps.service
Source2: shmpps.sysconfig
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: ntp
-Requires(post): /sbin/chkconfig
-Requires(preun): /sbin/chkconfig /sbin/service
-Requires(postun): /sbin/service
+BuildRequires: systemd-units
+Requires(post): systemd-sysv
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
%description
Shared memory (SHM) driver to allow high-resolution pulse-per-second
@@ -34,35 +35,49 @@ sed -i \
make CFLAGS="%{optflags}" LDFLAGS=""
%install
-rm -rf %{buildroot}
install -p -m755 -D shm_splc2 %{buildroot}%{_sbindir}/shm_splc2
-install -p -m755 -D %{SOURCE1} %{buildroot}%{_initrddir}/shmpps
+install -p -m644 -D %{SOURCE1} %{buildroot}%{_unitdir}/shmpps.service
install -p -m644 -D %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/shmpps
-%clean
-rm -rf %{buildroot}
-
%post
-/sbin/chkconfig --add shmpps
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
%preun
-if [ "$1" -eq 0 ]; then
- /sbin/service shmpps stop > /dev/null 2>&1
- /sbin/chkconfig --del shmpps
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable shmpps.service > /dev/null 2>&1 || :
+ /bin/systemctl stop shmpps.service > /dev/null 2>&1 || :
fi
%postun
-if [ "$1" -ge 1 ]; then
- /sbin/service shmpps 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 shmpps.service >/dev/null 2>&1 || :
fi
+%triggerun -- shmpps < 1.03-3
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply shmpps
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save shmpps >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del shmpps >/dev/null 2>&1 || :
+/bin/systemctl try-restart shmpps.service >/dev/null 2>&1 || :
+
%files
-%defattr(-,root,root,-)
%{_sbindir}/shm_splc2
-%{_initrddir}/shmpps
+%{_unitdir}/shmpps.service
%config(noreplace) %{_sysconfdir}/sysconfig/shmpps
%changelog
+* Thu Sep 15 2011 Tom Callaway <spot at fedoraproject.org> - 1.03-3
+- convert to systemd
+
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.03-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
More information about the scm-commits
mailing list