diff options
Diffstat (limited to 'meta-boot2qt-distro/recipes-core/dbus/dbus/dbus-session.init')
-rw-r--r-- | meta-boot2qt-distro/recipes-core/dbus/dbus/dbus-session.init | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/meta-boot2qt-distro/recipes-core/dbus/dbus/dbus-session.init b/meta-boot2qt-distro/recipes-core/dbus/dbus/dbus-session.init new file mode 100644 index 0000000..0690511 --- /dev/null +++ b/meta-boot2qt-distro/recipes-core/dbus/dbus/dbus-session.init | |||
@@ -0,0 +1,112 @@ | |||
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 session 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 | # Source function library. | ||
20 | #. /etc/init.d/functions | ||
21 | |||
22 | DAEMON=@bindir@/dbus-launch | ||
23 | NAME=dbus-session | ||
24 | ADDRESSFILE=/var/run/dbus/session_bus_address | ||
25 | UUIDDIR=/var/lib/dbus | ||
26 | DESC="session message bus" | ||
27 | APPCONTROLLERPATH="/tmp/b2qt/appcontroller.conf.d" | ||
28 | APPCONTROLLERADDRESSFILE="session_bus_address" | ||
29 | |||
30 | |||
31 | test -x $DAEMON || exit 0 | ||
32 | |||
33 | # Source defaults file; edit that file to configure this script. | ||
34 | ENABLED=1 | ||
35 | PARAMS="" | ||
36 | if [ -e /etc/default/dbus ]; then | ||
37 | . /etc/default/dbus | ||
38 | fi | ||
39 | |||
40 | if [ -e $ADDRESSFILE ]; then | ||
41 | . $ADDRESSFILE | ||
42 | fi | ||
43 | |||
44 | if [ ! -d $APPCONTROLLERPATH ]; then | ||
45 | mkdir -p $APPCONTROLLERPATH | ||
46 | fi | ||
47 | |||
48 | test "$ENABLED" != "0" || exit 0 | ||
49 | |||
50 | start_it_up() | ||
51 | { | ||
52 | echo -n "Starting $DESC: " | ||
53 | $DAEMON --auto-syntax > $ADDRESSFILE | ||
54 | ADDR=`cat $ADDRESSFILE|grep -i DBUS_SESSION_BUS_ADDRESS=` | ||
55 | echo "env=${ADDR%?}" |tr -d \' > ${APPCONTROLLERPATH}/${APPCONTROLLERADDRESSFILE} | ||
56 | echo "$NAME." | ||
57 | } | ||
58 | |||
59 | shut_it_down() | ||
60 | { | ||
61 | echo -n "Stopping $DESC: " | ||
62 | kill $DBUS_SESSION_BUS_PID | ||
63 | echo "$NAME." | ||
64 | } | ||
65 | |||
66 | reload_it() | ||
67 | { | ||
68 | echo -n "Reloading $DESC config: " | ||
69 | dbus-send --print-reply --session --type=method_call \ | ||
70 | --dest=org.freedesktop.DBus \ | ||
71 | / org.freedesktop.DBus.ReloadConfig > /dev/null | ||
72 | # hopefully this is enough time for dbus to reload it's config file. | ||
73 | echo "done." | ||
74 | } | ||
75 | |||
76 | status_it() | ||
77 | { | ||
78 | if kill -0 $DBUS_SESSION_BUS_PID 2>/dev/null; then | ||
79 | echo "$NAME (pid $DBUS_SESSION_BUS_PID) is running..." | ||
80 | return 0 | ||
81 | else | ||
82 | echo "$NAME is stopped" | ||
83 | fi | ||
84 | return 3 | ||
85 | } | ||
86 | |||
87 | case "$1" in | ||
88 | start) | ||
89 | start_it_up | ||
90 | ;; | ||
91 | stop) | ||
92 | shut_it_down | ||
93 | ;; | ||
94 | status) | ||
95 | status_it | ||
96 | exit $? | ||
97 | ;; | ||
98 | reload|force-reload) | ||
99 | reload_it | ||
100 | ;; | ||
101 | restart) | ||
102 | shut_it_down | ||
103 | sleep 1 | ||
104 | start_it_up | ||
105 | ;; | ||
106 | *) | ||
107 | echo "Usage: /etc/init.d/$NAME {start|stop|status|restart|reload|force-reload}" >&2 | ||
108 | exit 1 | ||
109 | ;; | ||
110 | esac | ||
111 | |||
112 | exit 0 | ||