File: dbus.postinst

package info (click to toggle)
dbus 1.16.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,028 kB
  • sloc: ansic: 106,011; xml: 9,270; sh: 1,954; python: 242; makefile: 227; cpp: 27
file content (65 lines) | stat: -rw-r--r-- 2,256 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
# Copyright © 2003 Colin Walters <walters@debian.org>
# Copyright © 2006 Sjoerd Simons <sjoerd@debian.org>

set -e

MESSAGEUSER=messagebus
LAUNCHER=/usr/lib/dbus-1.0/dbus-daemon-launch-helper

# This is what the init script would do, but it's simpler (and less
# dependent on sysvinit vs. Upstart vs. etc.) if we do it directly.
reload_dbus_config() {
    [ -S /run/dbus/system_bus_socket ] || return 0

    dbus-send --print-reply --system --type=method_call \
        --dest=org.freedesktop.DBus \
        / org.freedesktop.DBus.ReloadConfig > /dev/null || true
}

if [ "$1" = triggered ]; then
    reload_dbus_config
    exit 0
fi

if [ "$1" = configure ]; then
    # This respects $DPKG_ROOT
    if ! dpkg-statoverride --list "$LAUNCHER" >/dev/null; then
        dpkg-statoverride --update --add root "$MESSAGEUSER" 4754 "$LAUNCHER"
    fi
fi

if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = configure ] && [ -n "$2" ]; then
    # On upgrades, we only reload config, and don't restart (restarting the
    # system bus is not supported by upstream). The code added by
    # dh_installinit -r creates a start action, below.

    # Unconditionally recommend a reboot, without bothering with any checks.
    # If the system is running and dbus is installed, it is very likely
    # that a reboot is needed in most cases on upgrade.
    echo "A reboot may be required to replace a running dbus-daemon." >&2
    echo "Please reboot the system when convenient." >&2

    # trigger an update notification that recommends a reboot
    # (used by unattended-upgrades etc.)
    touch /run/reboot-required || true

    if ! grep -Fqsx dbus /run/reboot-required.pkgs; then
        echo dbus >> /run/reboot-required.pkgs || true
    fi

    # same thing for the older update-notifier interface
    [ -x /usr/share/update-notifier/notify-reboot-required ] && \
        /usr/share/update-notifier/notify-reboot-required || true
fi

#DEBHELPER#

# Do this after the debhelper-generated bits so that dpkg-maintscript-helper
# will have finished moving configuration files around. We only need to do
# this for upgrades, not new installations.
if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = configure ] && [ -n "$2" ]; then
    reload_dbus_config
fi

# vim:set sw=4 sts=4 et: