]> git.pld-linux.org Git - packages/rpm-build-macros.git/blame - macros.upstart
- split macros into language/feature specific files
[packages/rpm-build-macros.git] / macros.upstart
CommitLineData
cdc9189e
JR
1# pre/post script for -upstart subpackages
2#
3# Author: Jacek Konieczny <jajcus@jajcus.net>
4# Author: Elan Ruusamäe <glen@pld-linux.org>
5#
6# Usage:
7# %upstart_post service_name
8# %upstart_postun service_name
9#
10# Sample:
11# %post upstart
12# %upstart_post %{name}
13#
14# %postun upstart
15# %upstart_postun %{name}
16#
17# Requirements:
18# BuildRequires: rpmbuild(macros) >= 1.690
19# Requires: rc-scripts >= 0.4.3
20
21# migrate from init script to upstart job
22%upstart_post() \
23 if [ -x /sbin/initctl ] && [ -f /var/lock/subsys/%1 ]; then \
24 /sbin/service --no-upstart %1 stop \
25 /sbin/service %1 start \
26 fi \
27%{nil}
28
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
31# at this point
32%upstart_postun() \
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; }; \
36 fi \
37%{nil}
This page took 0.025206 seconds and 4 git commands to generate.