diff options
Diffstat (limited to 'meta/recipes-core/dbus/dbus-1.6.8/dbus-1.init')
-rw-r--r-- | meta/recipes-core/dbus/dbus-1.6.8/dbus-1.init | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/meta/recipes-core/dbus/dbus-1.6.8/dbus-1.init b/meta/recipes-core/dbus/dbus-1.6.8/dbus-1.init new file mode 100644 index 0000000000..64f2170255 --- /dev/null +++ b/meta/recipes-core/dbus/dbus-1.6.8/dbus-1.init | |||
@@ -0,0 +1,116 @@ | |||
1 | #! /bin/sh | ||
2 | ### BEGIN INIT INFO | ||
3 | # Provides: dbus | ||
4 | # Required-Start: $remote_fs $syslog | ||
5 | # Required-Stop: $remote_fs $syslog | ||
6 | # Default-Start: 2 3 4 5 | ||
7 | # Default-Stop: 1 | ||
8 | # Short-Description: D-Bus systemwide message bus | ||
9 | # Description: D-Bus is a simple interprocess messaging system, used | ||
10 | # for sending messages between applications. | ||
11 | ### END INIT INFO | ||
12 | # | ||
13 | # -*- coding: utf-8 -*- | ||
14 | # Debian init.d script for D-BUS | ||
15 | # Copyright © 2003 Colin Walters <walters@debian.org> | ||
16 | |||
17 | set -e | ||
18 | |||
19 | DAEMON=@bindir@/dbus-daemon | ||
20 | NAME=dbus | ||
21 | DAEMONUSER=messagebus # must match /etc/dbus-1/system.conf | ||
22 | PIDFILE=/var/run/messagebus.pid # must match /etc/dbus-1/system.conf | ||
23 | UUIDDIR=/var/lib/dbus | ||
24 | DESC="system message bus" | ||
25 | EVENTDIR=/etc/dbus-1/event.d | ||
26 | |||
27 | test -x $DAEMON || exit 0 | ||
28 | |||
29 | # Source defaults file; edit that file to configure this script. | ||
30 | ENABLED=1 | ||
31 | PARAMS="" | ||
32 | if [ -e /etc/default/dbus ]; then | ||
33 | . /etc/default/dbus | ||
34 | fi | ||
35 | |||
36 | test "$ENABLED" != "0" || exit 0 | ||
37 | |||
38 | start_it_up() | ||
39 | { | ||
40 | mkdir -p "`dirname $PIDFILE`" | ||
41 | if [ -e $PIDFILE ]; then | ||
42 | PIDDIR=/proc/$(cat $PIDFILE) | ||
43 | if [ -d ${PIDDIR} -a "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then | ||
44 | echo "$DESC already started; not starting." | ||
45 | else | ||
46 | echo "Removing stale PID file $PIDFILE." | ||
47 | rm -f $PIDFILE | ||
48 | fi | ||
49 | fi | ||
50 | |||
51 | if [ ! -d $UUIDDIR ]; then | ||
52 | mkdir -p $UUIDDIR | ||
53 | chown $DAEMONUSER $UUIDDIR | ||
54 | chgrp $DAEMONUSER $UUIDDIR | ||
55 | fi | ||
56 | |||
57 | dbus-uuidgen --ensure | ||
58 | |||
59 | echo -n "Starting $DESC: " | ||
60 | start-stop-daemon --start --quiet --pidfile $PIDFILE \ | ||
61 | --user $DAEMONUSER --exec $DAEMON -- --system $PARAMS | ||
62 | echo "$NAME." | ||
63 | if [ -d $EVENTDIR ]; then | ||
64 | run-parts --arg=start $EVENTDIR | ||
65 | fi | ||
66 | } | ||
67 | |||
68 | shut_it_down() | ||
69 | { | ||
70 | if [ -d $EVENTDIR ]; then | ||
71 | # TODO: --reverse when busybox supports it | ||
72 | run-parts --arg=stop $EVENTDIR | ||
73 | fi | ||
74 | echo -n "Stopping $DESC: " | ||
75 | start-stop-daemon --stop --quiet --pidfile $PIDFILE \ | ||
76 | --user $DAEMONUSER | ||
77 | # We no longer include these arguments so that start-stop-daemon | ||
78 | # can do its job even given that we may have been upgraded. | ||
79 | # We rely on the pidfile being sanely managed | ||
80 | # --exec $DAEMON -- --system $PARAMS | ||
81 | echo "$NAME." | ||
82 | rm -f $PIDFILE | ||
83 | } | ||
84 | |||
85 | reload_it() | ||
86 | { | ||
87 | echo -n "Reloading $DESC config: " | ||
88 | dbus-send --print-reply --system --type=method_call \ | ||
89 | --dest=org.freedesktop.DBus \ | ||
90 | / org.freedesktop.DBus.ReloadConfig > /dev/null | ||
91 | # hopefully this is enough time for dbus to reload it's config file. | ||
92 | echo "done." | ||
93 | } | ||
94 | |||
95 | case "$1" in | ||
96 | start) | ||
97 | start_it_up | ||
98 | ;; | ||
99 | stop) | ||
100 | shut_it_down | ||
101 | ;; | ||
102 | reload|force-reload) | ||
103 | reload_it | ||
104 | ;; | ||
105 | restart) | ||
106 | shut_it_down | ||
107 | sleep 1 | ||
108 | start_it_up | ||
109 | ;; | ||
110 | *) | ||
111 | echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload}" >&2 | ||
112 | exit 1 | ||
113 | ;; | ||
114 | esac | ||
115 | |||
116 | exit 0 | ||