diff options
author | Samuli Piippo <samuli.piippo@theqtcompany.com> | 2015-01-29 10:34:25 +0200 |
---|---|---|
committer | Samuli Piippo <samuli.piippo@theqtcompany.com> | 2015-01-29 15:26:39 +0200 |
commit | 7c2791f226df89f5b0bcffc2964e96db9dee5f0f (patch) | |
tree | cba198834361f73f36a21a9c10410b5ae3d17e47 /recipes | |
parent | 943121c7af2f5db831ded0feb9808f649e58e0b6 (diff) | |
download | meta-boot2qt-7c2791f226df89f5b0bcffc2964e96db9dee5f0f.tar.gz |
Start dbus session bus at boot
Session address is saved to /var/run/dbus/session_bus_address, which is read
in /etc/profile.d/dbus-session-address for interactive login and by adbd for
applications launched from QtCreator.
Change-Id: I8e1f43bdb2f7a7b0450dacf39890cf149459bbf4
Reviewed-by: Rainer Keller <rainer.keller@theqtcompany.com>
Diffstat (limited to 'recipes')
-rwxr-xr-x | recipes/adbd/files/adb-init | 4 | ||||
-rw-r--r-- | recipes/dbus/dbus/dbus-session-address | 5 | ||||
-rw-r--r-- | recipes/dbus/dbus/dbus-session.init | 103 | ||||
-rw-r--r-- | recipes/dbus/dbus_1.6.18.bbappend | 47 | ||||
-rw-r--r-- | recipes/packagegroup/packagegroup-b2qt-embedded-base.bb | 1 |
5 files changed, 160 insertions, 0 deletions
diff --git a/recipes/adbd/files/adb-init b/recipes/adbd/files/adb-init index 92500d7..d8920b8 100755 --- a/recipes/adbd/files/adb-init +++ b/recipes/adbd/files/adb-init | |||
@@ -4,6 +4,10 @@ DAEMON=/usr/bin/adbd | |||
4 | 4 | ||
5 | . /etc/default/adbd | 5 | . /etc/default/adbd |
6 | 6 | ||
7 | if [ -e /var/run/dbus/session_bus_address ]; then | ||
8 | . /var/run/dbus/session_bus_address | ||
9 | fi | ||
10 | |||
7 | case "$1" in | 11 | case "$1" in |
8 | start) | 12 | start) |
9 | if [ "$USE_ETHERNET" = "no" ]; then | 13 | if [ "$USE_ETHERNET" = "no" ]; then |
diff --git a/recipes/dbus/dbus/dbus-session-address b/recipes/dbus/dbus/dbus-session-address new file mode 100644 index 0000000..3f85306 --- /dev/null +++ b/recipes/dbus/dbus/dbus-session-address | |||
@@ -0,0 +1,5 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | if [ -e /var/run/dbus/session_bus_address ]; then | ||
4 | . /var/run/dbus/session_bus_address | ||
5 | fi | ||
diff --git a/recipes/dbus/dbus/dbus-session.init b/recipes/dbus/dbus/dbus-session.init new file mode 100644 index 0000000..11a6757 --- /dev/null +++ b/recipes/dbus/dbus/dbus-session.init | |||
@@ -0,0 +1,103 @@ | |||
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 | |||
28 | test -x $DAEMON || exit 0 | ||
29 | |||
30 | # Source defaults file; edit that file to configure this script. | ||
31 | ENABLED=1 | ||
32 | PARAMS="" | ||
33 | if [ -e /etc/default/dbus ]; then | ||
34 | . /etc/default/dbus | ||
35 | fi | ||
36 | |||
37 | if [ -e $ADDRESSFILE ]; then | ||
38 | . $ADDRESSFILE | ||
39 | fi | ||
40 | |||
41 | test "$ENABLED" != "0" || exit 0 | ||
42 | |||
43 | start_it_up() | ||
44 | { | ||
45 | echo -n "Starting $DESC: " | ||
46 | $DAEMON --auto-syntax > $ADDRESSFILE | ||
47 | echo "$NAME." | ||
48 | } | ||
49 | |||
50 | shut_it_down() | ||
51 | { | ||
52 | echo -n "Stopping $DESC: " | ||
53 | kill $DBUS_SESSION_BUS_PID | ||
54 | echo "$NAME." | ||
55 | } | ||
56 | |||
57 | reload_it() | ||
58 | { | ||
59 | echo -n "Reloading $DESC config: " | ||
60 | dbus-send --print-reply --session --type=method_call \ | ||
61 | --dest=org.freedesktop.DBus \ | ||
62 | / org.freedesktop.DBus.ReloadConfig > /dev/null | ||
63 | # hopefully this is enough time for dbus to reload it's config file. | ||
64 | echo "done." | ||
65 | } | ||
66 | |||
67 | status_it() | ||
68 | { | ||
69 | if kill -0 $DBUS_SESSION_BUS_PID 2>/dev/null; then | ||
70 | echo "$NAME (pid $DBUS_SESSION_BUS_PID) is running..." | ||
71 | return 0 | ||
72 | else | ||
73 | echo "$NAME is stopped" | ||
74 | fi | ||
75 | return 3 | ||
76 | } | ||
77 | |||
78 | case "$1" in | ||
79 | start) | ||
80 | start_it_up | ||
81 | ;; | ||
82 | stop) | ||
83 | shut_it_down | ||
84 | ;; | ||
85 | status) | ||
86 | status_it | ||
87 | exit $? | ||
88 | ;; | ||
89 | reload|force-reload) | ||
90 | reload_it | ||
91 | ;; | ||
92 | restart) | ||
93 | shut_it_down | ||
94 | sleep 1 | ||
95 | start_it_up | ||
96 | ;; | ||
97 | *) | ||
98 | echo "Usage: /etc/init.d/$NAME {start|stop|status|restart|reload|force-reload}" >&2 | ||
99 | exit 1 | ||
100 | ;; | ||
101 | esac | ||
102 | |||
103 | exit 0 | ||
diff --git a/recipes/dbus/dbus_1.6.18.bbappend b/recipes/dbus/dbus_1.6.18.bbappend new file mode 100644 index 0000000..d824989 --- /dev/null +++ b/recipes/dbus/dbus_1.6.18.bbappend | |||
@@ -0,0 +1,47 @@ | |||
1 | ############################################################################# | ||
2 | ## | ||
3 | ## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). | ||
4 | ## | ||
5 | ## This file is part of the Qt Enterprise Embedded Scripts of the Qt | ||
6 | ## framework. | ||
7 | ## | ||
8 | ## $QT_BEGIN_LICENSE$ | ||
9 | ## Commercial License Usage Only | ||
10 | ## Licensees holding valid commercial Qt license agreements with Digia | ||
11 | ## with an appropriate addendum covering the Qt Enterprise Embedded Scripts, | ||
12 | ## may use this file in accordance with the terms contained in said license | ||
13 | ## agreement. | ||
14 | ## | ||
15 | ## For further information use the contact form at | ||
16 | ## http://www.qt.io/contact-us. | ||
17 | ## | ||
18 | ## | ||
19 | ## $QT_END_LICENSE$ | ||
20 | ## | ||
21 | ############################################################################# | ||
22 | |||
23 | FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" | ||
24 | SRC_URI += " \ | ||
25 | file://dbus-session.init \ | ||
26 | file://dbus-session-address \ | ||
27 | " | ||
28 | |||
29 | INITSCRIPT_PACKAGES = "${PN} ${PN}-session-init" | ||
30 | INITSCRIPT_NAME_${PN}-session-init = "dbus-session" | ||
31 | INITSCRIPT_PARAMS_${PN}-session-init = "start 20 5 3 2 . stop 10 0 1 6 ." | ||
32 | |||
33 | PACKAGES =+ "${PN}-session-init" | ||
34 | FILES_${PN}-session-init = " \ | ||
35 | ${sysconfdir}/init.d/dbus-session \ | ||
36 | ${sysconfdir}/profile.d/dbus-session-address \ | ||
37 | " | ||
38 | |||
39 | do_install_append_class-target() { | ||
40 | if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then | ||
41 | install -d ${D}${sysconfdir}/init.d | ||
42 | sed 's:@bindir@:${bindir}:' < ${WORKDIR}/dbus-session.init >${WORKDIR}/dbus-session.init.sh | ||
43 | install -m 0755 ${WORKDIR}/dbus-session.init.sh ${D}${sysconfdir}/init.d/dbus-session | ||
44 | fi | ||
45 | install -d ${D}${sysconfdir}/profile.d | ||
46 | install -m 0755 ${WORKDIR}/dbus-session-address ${D}${sysconfdir}/profile.d/ | ||
47 | } | ||
diff --git a/recipes/packagegroup/packagegroup-b2qt-embedded-base.bb b/recipes/packagegroup/packagegroup-b2qt-embedded-base.bb index dd1ab44..f40173b 100644 --- a/recipes/packagegroup/packagegroup-b2qt-embedded-base.bb +++ b/recipes/packagegroup/packagegroup-b2qt-embedded-base.bb | |||
@@ -51,5 +51,6 @@ RDEPENDS_${PN} = "\ | |||
51 | ttf-opensans \ | 51 | ttf-opensans \ |
52 | ttf-dejavu-common \ | 52 | ttf-dejavu-common \ |
53 | ttf-dejavu-sans \ | 53 | ttf-dejavu-sans \ |
54 | dbus-session-init \ | ||
54 | ${MACHINE_EXTRA_INSTALL} \ | 55 | ${MACHINE_EXTRA_INSTALL} \ |
55 | " | 56 | " |