Files
buildroot/package/dbus/S30dbus-daemon
Fiona Klute 3e007e27d0 package/dbus: move PID file to /run/dbus-daemon.pid
This makes it more obvious which service the PID file belongs to, and
thanks to the /var/run -> /run symlink fixes the check-package
warning.

Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2026-01-01 14:24:29 +01:00

71 lines
1.2 KiB
Bash

#!/bin/sh
DAEMON="dbus-daemon"
PIDFILE="/var/run/$DAEMON.pid"
start() {
printf 'Starting system %s: ' "$DAEMON"
# Create needed directories
mkdir -p /run/dbus
mkdir -p /tmp/dbus
# Generate /var/lib/dbus/machine-id if needed
dbus-uuidgen --ensure
start-stop-daemon --start --pidfile "$PIDFILE" \
--exec "/usr/bin/$DAEMON" \
-- --system --syslog
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
stop() {
printf 'Stopping %s: ' "$DAEMON"
start-stop-daemon --stop --pidfile "$PIDFILE" --exec "/usr/bin/$DAEMON"
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
return "$status"
fi
while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \
--exec "/usr/bin/$DAEMON"; do
sleep 0.1
done
rm -f "$PIDFILE"
return "$status"
}
reload() {
printf "Reloading %s config: " "$DAEMON"
start-stop-daemon --stop --signal HUP -q --pidfile "$PIDFILE" \
--exec "/usr/bin/$DAEMON"
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
restart() {
stop
start
}
case "$1" in
start|stop|reload|restart)
"$1"
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
;;
esac