[partimage/f17] Using native systemd.

Paulo Roma Cavalcanti roma at fedoraproject.org
Sun Jul 15 23:08:49 UTC 2012


commit 2a7392966fccfcb392eecea4c34dce73977f1dfe
Author: Paulo Roma Cavalcanti <roma at cascavel.(none)>
Date:   Sun Jul 15 20:08:21 2012 -0300

    Using native systemd.

 partimage.spec     |   35 +++++++++++++++++++++++------------
 partimaged.service |   13 +++++++++++++
 2 files changed, 36 insertions(+), 12 deletions(-)
---
diff --git a/partimage.spec b/partimage.spec
index 2ae4cbf..126fc36 100644
--- a/partimage.spec
+++ b/partimage.spec
@@ -13,7 +13,7 @@
 Summary: Partition imaging utility, much like Ghost
 Name:    partimage
 Version: 0.6.9
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPLv2+
 Group:   Applications/System
 URL:     http://www.partimage.org/
@@ -21,6 +21,7 @@ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
 Source1: %{name}-man.tar.gz
 Source2: %{name}-scripts.tar.gz
 Source3: README.partimage.html
+Source4: partimaged.service
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: gettext
 BuildRequires: autoconf 
@@ -32,10 +33,9 @@ BuildRequires: zlib-devel
 %{?with_pam:BuildRequires: pam-devel}
 %{?with_ssl:BuildRequires: openssl-devel}
 
-%{?with_pam:Requires: compat-db}
-Requires(post):   chkconfig /sbin/service
-Requires(postun): chkconfig shadow-utils
-Requires(preun):  chkconfig /sbin/service
+Requires(post):   chkconfig, systemd-units
+Requires(postun): chkconfig, shadow-utils, systemd-units
+Requires(preun):  chkconfig, initscripts, systemd-units
 Requires(pre):    shadow-utils
 
 %description
@@ -54,6 +54,7 @@ and supporting the following filesystems:
 %package server
 Summary: Server daemon for remote imaging, much like Ghost
 Group: System Environment/Daemons
+%{?with_pam:Requires: compat-db}
 
 %description server
 Partimage is a Linux/UNIX partition imaging utility,
@@ -136,7 +137,7 @@ EOF
 %makeinstall
 %find_lang %{name}
 
-%{__install} -Dp -m0755 partimaged.init.d %{buildroot}%{_initrddir}/partimaged
+%{__install} -Dp -m0755 %{SOURCE4} %{buildroot}%{_unitdir}/partimaged.service
 %{__install} -Dp -m0644 partimaged.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/partimaged
 %{__install} -Dp -m0644 partimaged.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/partimaged
 
@@ -168,19 +169,26 @@ exit 0
 
 %post server
 if [ $1 -eq 1 ]; then
-        /sbin/chkconfig --add partimaged
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
 fi
-/sbin/service partimaged condrestart &>/dev/null || :
+
+%triggerun -- partimaged < 0.6.9-3
+if /sbin/chkconfig --level 3 partimaged; then
+    /bin/systemctl enable partimaged.service >/dev/null 2>&1 || :
+fi
+/sbin/chkconfig --del partimaged >/dev/null 2>&1 || :
+/bin/systemctl try-restart partimaged.service >/dev/null 2>&1 || :
 
 %preun server
 if [ $1 -eq 0 ]; then
-        /sbin/service partimaged stop &>/dev/null || :
-        /sbin/chkconfig --del partimaged
+    /bin/systemctl --no-reload disable partimaged.service >/dev/null 2>&1 || :
+    /bin/systemctl stop partimaged.service >/dev/null 2>&1 || :
 fi
 
 %postun server
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
 if [ "$1" -ge "1" ]; then
-        /sbin/service partimaged condrestart &>/dev/null || :
+    /bin/systemctl try-restart partimaged.service >/dev/null 2>&1 || :
 fi
 
 %clean
@@ -196,7 +204,7 @@ fi
 %files server
 %defattr(-, root, root, 0755)
 %doc AUTHORS BUGS ChangeLog COPYING FORMAT README* THANKS
-%{_initrddir}/partimaged
+%{_unitdir}/partimaged.service
 %config(noreplace) %{_sysconfdir}/logrotate.d/partimaged
 %config(noreplace) %{_sysconfdir}/sysconfig/partimaged
 %dir %{_datadir}/partimaged
@@ -217,6 +225,9 @@ fi
 %dir %{image_place}
 
 %changelog
+* Sun Jul 15 2012 Paulo Roma <roma at lcg.ufrj.br> - 0.6.9-4
+- Using native systemd.
+
 * Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.6.9-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 
diff --git a/partimaged.service b/partimaged.service
new file mode 100644
index 0000000..f0992da
--- /dev/null
+++ b/partimaged.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=partimaged is a partition imaging daemon
+After=syslog.target network.target
+
+[Service]
+Type=forking
+EnvironmentFile=/etc/sysconfig/partimaged
+ExecStartPre=/bin/touch /var/lock/subsys/partimaged
+ExecStart=/usr/sbin/partimaged --daemon $OPTIONS
+ExecStop=/bin/rm -f /var/lock/subsys/partimaged
+
+[Install]
+WantedBy=multi-user.target


More information about the scm-commits mailing list