Debian Codegraph @

debian/dbus.postinst

raw
1 #!/bin/sh
2 # Copyright © 2003 Colin Walters <[email protected]>
3 # Copyright © 2006 Sjoerd Simons <[email protected]>
4
5 set -e
6
7 MESSAGEUSER=messagebus
8 LAUNCHER=/usr/lib/dbus-1.0/dbus-daemon-launch-helper
9
10 # This is what the init script would do, but it's simpler (and less
11 # dependent on sysvinit vs. Upstart vs. etc.) if we do it directly.
12 reload_dbus_config() {
13 [ -S /run/dbus/system_bus_socket ] || return 0
14
15 dbus-send --print-reply --system --type=method_call \
16 --dest=org.freedesktop.DBus \
17 / org.freedesktop.DBus.ReloadConfig > /dev/null || true
18 }
19
20 if [ "$1" = triggered ]; then
21 reload_dbus_config
22 exit 0
23 fi
24
25 if [ "$1" = configure ]; then
26 # This respects $DPKG_ROOT
27 if ! dpkg-statoverride --list "$LAUNCHER" >/dev/null; then
28 dpkg-statoverride --update --add root "$MESSAGEUSER" 4754 "$LAUNCHER"
29 fi
30 fi
31
32 if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = configure ] && [ -n "$2" ]; then
33 # On upgrades, we only reload config, and don't restart (restarting the
34 # system bus is not supported by upstream). The code added by
35 # dh_installinit -r creates a start action, below.
36
37 # Unconditionally recommend a reboot, without bothering with any checks.
38 # If the system is running and dbus is installed, it is very likely
39 # that a reboot is needed in most cases on upgrade.
40 echo "A reboot may be required to replace a running dbus-daemon." >&2
41 echo "Please reboot the system when convenient." >&2
42
43 # trigger an update notification that recommends a reboot
44 # (used by unattended-upgrades etc.)
45 touch /run/reboot-required || true
46
47 if ! grep -Fqsx dbus /run/reboot-required.pkgs; then
48 echo dbus >> /run/reboot-required.pkgs || true
49 fi
50
51 # same thing for the older update-notifier interface
52 [ -x /usr/share/update-notifier/notify-reboot-required ] && \
53 /usr/share/update-notifier/notify-reboot-required || true
54 fi
55
56 #DEBHELPER#
57
58 # Do this after the debhelper-generated bits so that dpkg-maintscript-helper
59 # will have finished moving configuration files around. We only need to do
60 # this for upgrades, not new installations.
61 if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = configure ] && [ -n "$2" ]; then
62 reload_dbus_config
63 fi
64
65 # vim:set sw=4 sts=4 et: