[smokeping/f16] convert to systemd
Tom Callaway
spot at fedoraproject.org
Fri Sep 9 15:10:20 UTC 2011
commit 4f823a58c5bba529254abc912a07d575eb5acd48
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date: Fri Sep 9 11:10:09 2011 -0400
convert to systemd
smokeping.service | 11 +++++++++++
smokeping.spec | 43 ++++++++++++++++++-------------------------
2 files changed, 29 insertions(+), 25 deletions(-)
---
diff --git a/smokeping.service b/smokeping.service
new file mode 100644
index 0000000..2118a4a
--- /dev/null
+++ b/smokeping.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Latency Logging and Graphing System
+After=syslog.target network.target
+
+[Service]
+ExecStart=/usr/sbin/smokeping --nodaemon
+ExecReload=/bin/kill -HUP $MAINPID
+StandardError=syslog
+
+[Install]
+WantedBy=multi-user.target
diff --git a/smokeping.spec b/smokeping.spec
index 59699d9..c5609a5 100644
--- a/smokeping.spec
+++ b/smokeping.spec
@@ -7,12 +7,12 @@
Summary: Latency Logging and Graphing System
Name: smokeping
Version: 2.4.2
-Release: 12%{?dist}
+Release: 13%{?dist}
License: GPLv2+
Group: Applications/Internet
URL: http://oss.oetiker.ch/smokeping/
Source0: %{url}/pub/%{name}-%{version}.tar.gz
-Source1: smokeping.init
+Source1: smokeping.service
Source2: smokeping-httpd.conf.d
Source3: http://oss.oetiker.ch/smokeping-demo/img/smokeping.png
Source4: http://oss.oetiker.ch/smokeping-demo/img/rrdtool.png
@@ -25,6 +25,7 @@ Patch3: smokeping-2.3.5-silence.patch
Patch4: smokeping-2.4.2-jsonrpc-strict.patch
Patch5: smokeping-2.4.2-scriptname.patch
BuildRequires: glibc-common
+BuildRequires: systemd-units
Requires: perl >= 5.6.1
Requires: rrdtool >= 1.0.33
Requires: fping >= 2.4b2
@@ -33,11 +34,9 @@ Requires: traceroute
Requires: perl(Config::Grammar)
Requires: webserver
Requires: net-tools
-Requires(post): chkconfig
-Requires(preun): chkconfig initscripts
-Requires(postun): initscripts
+Requires(post): systemd-sysv
BuildArch: noarch
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
%description
SmokePing is a latency logging and graphing system. It consists of a
daemon process which organizes the latency measurements and a CGI
@@ -78,7 +77,7 @@ find doc -name *.[1-9] -delete
%{buildroot}%{_localstatedir}/lib/%{name}/{rrd,images} \
%{buildroot}%{_localstatedir}/run/%{name}
-%{__install} -Dp -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name}
+%{__install} -Dp -m 0755 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
%{__install} -Dp -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf
%{__install} -p -m 0644 %{SOURCE3} %{SOURCE4} %{buildroot}%{_datadir}/%{name}/htdocs
@@ -104,31 +103,22 @@ done
find %{buildroot}%{_datadir}/%{name} -name *.pm | xargs chmod 0644
-%clean
-%{__rm} -rf %{buildroot}
-
-%post
-if [ $1 = 1 ] ; then
- /sbin/chkconfig --add %{name}
-fi
+%triggerun -- smokeping < 2.4.2-13
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply smokeping
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save smokeping >/dev/null 2>&1 ||:
-%preun
-if [ $1 = 0 ] ; then
- /sbin/service %{name} stop >/dev/null 2>&1 || :
- /sbin/chkconfig --del %{name}
-fi
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del smokeping >/dev/null 2>&1 || :
+/bin/systemctl try-restart smokeping.service >/dev/null 2>&1 || :
-%postun
-if [ $1 -ge 1 ] ; then
- /sbin/service %{name} condrestart >/dev/null 2>&1 || :
-fi
%files
-%defattr(-, root, root, -)
%doc doc CHANGES CONTRIBUTORS COPYRIGHT COPYING README TODO README.fedora
%{_sbindir}/smokeping
%{_bindir}/tSmoke
-%{_initrddir}/%{name}
+%{_unitdir}/%{name}.service
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/*
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
@@ -140,6 +130,9 @@ fi
%attr(0755, apache, root) %{_localstatedir}/lib/%{name}/images
%changelog
+* Fri Sep 9 2011 Tom Callaway <spot at fedoraproject.org> - 2.4.2-13
+- convert to systemd
+
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.4.2-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
More information about the scm-commits
mailing list