kumquat-buildroot/package/dbus/S30dbus
Norbert Lange 6b9a75a5bd package/dbus: use /run for runtime data
All init systems supported by Buildroot have a /run directory and have
a symlink for /var/run -> /run.

Use the /run directory directly.

Signed-off-by: Norbert Lange <nolange79@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-07-18 21:37:36 +02:00

72 lines
1.6 KiB
Bash

#!/bin/sh
#
# messagebus: The D-BUS systemwide message bus
#
# chkconfig: 345 97 03
# description: This is a daemon which broadcasts notifications of system events \
# and other messages. See http://www.freedesktop.org/software/dbus/
#
# processname: dbus-daemon
# pidfile: /run/messagebus.pid
#
# Create needed directories.
[ -d /run/dbus ] || mkdir -p /run/dbus
[ -d /var/lock/subsys ] || mkdir -p /var/lock/subsys
[ -d /tmp/dbus ] || mkdir -p /tmp/dbus
RETVAL=0
start() {
printf "Starting system message bus: "
dbus-uuidgen --ensure
dbus-daemon --system
RETVAL=$?
echo "done"
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dbus-daemon
}
stop() {
printf "Stopping system message bus: "
## we don't want to kill all the per-user $processname, we want
## to use the pid file *only*; because we use the fake nonexistent
## program name "$servicename" that should be safe-ish
killall dbus-daemon
RETVAL=$?
echo "done"
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/dbus-daemon
rm -f /run/messagebus.pid
fi
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/lock/subsys/$servicename ]; then
stop
start
fi
;;
reload)
echo "Message bus can't reload its configuration, you have to restart it"
RETVAL=$?
;;
*)
echo "Usage: $0 {start|stop|restart|condrestart|reload}"
;;
esac
exit $RETVAL