1 # pre/post script for -upstart subpackages
3 # Author: Jacek Konieczny <jajcus@jajcus.net>
4 # Author: Elan Ruusamäe <glen@pld-linux.org>
7 # %upstart_post service_name
8 # %upstart_postun service_name
12 # %upstart_post %{name}
15 # %upstart_postun %{name}
18 # BuildRequires: rpmbuild(macros) >= 1.690
19 # Requires: rc-scripts >= 0.4.3
21 # migrate from init script to upstart job
23 if [ -x /sbin/initctl ] && [ -f /var/lock/subsys/%1 ]; then \
24 /sbin/service --no-upstart %1 stop \
25 /sbin/service %1 start \
29 # restart the job after upgrade or migrate to init script on removal
30 # cannot be stopped with 'service' as /etc/init/$name.conf may be missing
33 if [ -x /sbin/initctl ] && /sbin/initctl status %1 2>/dev/null | grep -q 'running' ; then \
34 /sbin/initctl stop %1 >/dev/null 2>&1 \
35 [ -f /etc/rc.d/init.d/%1 -o -f /etc/init/%1.conf ] && { echo -n "Re-"; /sbin/service %1 start; }; \