]> git.pld-linux.org Git - packages/rpm-build-macros.git/commitdiff
- %upstart_post and %upstart_postun added
authorJacek Konieczny <jajcus@pld-linux.org>
Tue, 11 May 2010 15:58:58 +0000 (15:58 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    rpm.macros -> 1.560

rpm.macros

index fc8fa1019e985ce42de5312854849c0e8de36e3a..dd3a397ecec93362e746d3a24e021970847d68fc 100644 (file)
@@ -1887,4 +1887,39 @@ else: \
 /usr/share/cacti/cli/import_template.php --filename=%1 || :; \
 }%{nil}
 
+# pre/post script for -upstart subpackages
+#
+# Author: Jacek Konieczny <jajcus@jajcus.net>
+#
+# Usage:
+#      %upstart_post service_name
+#   %upstart_postun service_name
+#
+# Sample:
+# %post upstart
+# %upstart_post %{name}
+#
+# %postun upstart
+# %upstart_postun %{name}
+#
+# Requirements:
+# BuildRequires:       rpmbuild(macros) >= 1.560
+# Requires:                    rc-scripts >= 0.4.3
+
+# migrate from init script to upstart job
+%define        upstart_post() \
+       if [ -f /var/lock/subsys/"%1" ] ; then \
+               /sbin/service --no-upstart "%1" stop \
+               /sbin/service "%1" start \
+       fi
+
+# restart the job after upgrade or migrate to init script on removal
+# cannot be stopped with 'service' as /etc/init/$name.conf may be missing
+# at this point
+%define        upstart_postun() \
+       if [ -x /sbin/initctl ] && /sbin/initctl status "%1" 2>/dev/null | grep -q 'running' ; then \
+               /sbin/initctl stop "%1" >/dev/null 2>&1 \
+               [ -f "/etc/rc.d/init.d/%1" -o -f "/etc/init/%1.conf" ] && { echo -n "Re-" ; /sbin/service "%1" start ; } ; \
+       fi
+
 # vim:ts=4 sw=4 noet ft=spec
This page took 0.053633 seconds and 4 git commands to generate.