Skip to content
Snippets Groups Projects
Commit 7c2791f2 authored by Samuli Piippo's avatar Samuli Piippo
Browse files

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: default avatarRainer Keller <rainer.keller@theqtcompany.com>
parent 943121c7
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,10 @@ DAEMON=/usr/bin/adbd
. /etc/default/adbd
if [ -e /var/run/dbus/session_bus_address ]; then
. /var/run/dbus/session_bus_address
fi
case "$1" in
start)
if [ "$USE_ETHERNET" = "no" ]; then
......
#!/bin/sh
if [ -e /var/run/dbus/session_bus_address ]; then
. /var/run/dbus/session_bus_address
fi
#! /bin/sh
### BEGIN INIT INFO
# Provides: dbus
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: D-Bus session message bus
# Description: D-Bus is a simple interprocess messaging system, used
# for sending messages between applications.
### END INIT INFO
#
# -*- coding: utf-8 -*-
# Debian init.d script for D-BUS
# Copyright © 2003 Colin Walters <walters@debian.org>
# set -e
# Source function library.
. /etc/init.d/functions
DAEMON=@bindir@/dbus-launch
NAME=dbus-session
ADDRESSFILE=/var/run/dbus/session_bus_address
UUIDDIR=/var/lib/dbus
DESC="session message bus"
test -x $DAEMON || exit 0
# Source defaults file; edit that file to configure this script.
ENABLED=1
PARAMS=""
if [ -e /etc/default/dbus ]; then
. /etc/default/dbus
fi
if [ -e $ADDRESSFILE ]; then
. $ADDRESSFILE
fi
test "$ENABLED" != "0" || exit 0
start_it_up()
{
echo -n "Starting $DESC: "
$DAEMON --auto-syntax > $ADDRESSFILE
echo "$NAME."
}
shut_it_down()
{
echo -n "Stopping $DESC: "
kill $DBUS_SESSION_BUS_PID
echo "$NAME."
}
reload_it()
{
echo -n "Reloading $DESC config: "
dbus-send --print-reply --session --type=method_call \
--dest=org.freedesktop.DBus \
/ org.freedesktop.DBus.ReloadConfig > /dev/null
# hopefully this is enough time for dbus to reload it's config file.
echo "done."
}
status_it()
{
if kill -0 $DBUS_SESSION_BUS_PID 2>/dev/null; then
echo "$NAME (pid $DBUS_SESSION_BUS_PID) is running..."
return 0
else
echo "$NAME is stopped"
fi
return 3
}
case "$1" in
start)
start_it_up
;;
stop)
shut_it_down
;;
status)
status_it
exit $?
;;
reload|force-reload)
reload_it
;;
restart)
shut_it_down
sleep 1
start_it_up
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|status|restart|reload|force-reload}" >&2
exit 1
;;
esac
exit 0
#############################################################################
##
## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
##
## This file is part of the Qt Enterprise Embedded Scripts of the Qt
## framework.
##
## $QT_BEGIN_LICENSE$
## Commercial License Usage Only
## Licensees holding valid commercial Qt license agreements with Digia
## with an appropriate addendum covering the Qt Enterprise Embedded Scripts,
## may use this file in accordance with the terms contained in said license
## agreement.
##
## For further information use the contact form at
## http://www.qt.io/contact-us.
##
##
## $QT_END_LICENSE$
##
#############################################################################
FILESEXTRAPATHS_append := ":${THISDIR}/${PN}"
SRC_URI += " \
file://dbus-session.init \
file://dbus-session-address \
"
INITSCRIPT_PACKAGES = "${PN} ${PN}-session-init"
INITSCRIPT_NAME_${PN}-session-init = "dbus-session"
INITSCRIPT_PARAMS_${PN}-session-init = "start 20 5 3 2 . stop 10 0 1 6 ."
PACKAGES =+ "${PN}-session-init"
FILES_${PN}-session-init = " \
${sysconfdir}/init.d/dbus-session \
${sysconfdir}/profile.d/dbus-session-address \
"
do_install_append_class-target() {
if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
install -d ${D}${sysconfdir}/init.d
sed 's:@bindir@:${bindir}:' < ${WORKDIR}/dbus-session.init >${WORKDIR}/dbus-session.init.sh
install -m 0755 ${WORKDIR}/dbus-session.init.sh ${D}${sysconfdir}/init.d/dbus-session
fi
install -d ${D}${sysconfdir}/profile.d
install -m 0755 ${WORKDIR}/dbus-session-address ${D}${sysconfdir}/profile.d/
}
......@@ -51,5 +51,6 @@ RDEPENDS_${PN} = "\
ttf-opensans \
ttf-dejavu-common \
ttf-dejavu-sans \
dbus-session-init \
${MACHINE_EXTRA_INSTALL} \
"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment