dbus.postinst 2.05 KB
Newer Older
1 2
#!/bin/sh
# Copyright © 2003 Colin Walters <walters@debian.org>
3 4 5
# Copyright © 2006 Sjoerd Simons <sjoerd@debian.org>

set -e
6 7 8

MESSAGEUSER=messagebus
MESSAGEHOME=/var/run/dbus
9
LAUNCHER=/usr/lib/dbus-1.0/dbus-daemon-launch-helper
10

11
# This is what the init script would do, but it's simpler (and less
12
# dependent on sysvinit vs. Upstart vs. etc.) if we do it directly.
13
reload_dbus_config() {
14
    [ -S /var/run/dbus/system_bus_socket ] || return 0
15 16 17 18 19 20 21 22 23 24 25
    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

Loic Minier's avatar
Loic Minier committed
26 27
if [ "$1" = configure ]; then
    adduser --system \
Michael Biebl's avatar
Michael Biebl committed
28
            --quiet \
Loic Minier's avatar
Loic Minier committed
29 30 31 32 33
            --home "$MESSAGEHOME" \
            --no-create-home \
            --disabled-password \
            --group "$MESSAGEUSER"

34
    if ! dpkg-statoverride --list "$LAUNCHER" >/dev/null; then
35
        dpkg-statoverride --update --add root "$MESSAGEUSER" 4754 "$LAUNCHER"
Loic Minier's avatar
Loic Minier committed
36
    fi
37

38 39 40 41
    # This is idempotent, so it's OK to do every time. The system bus' init
    # script does this anyway, but you also have to do this before a session
    # bus will work, so we do this here for the benefit of people starting
    # a temporary session bus in a chroot
42
    dbus-uuidgen --ensure
Loic Minier's avatar
Loic Minier committed
43
fi
Michael Biebl's avatar
Michael Biebl committed
44

Michael Biebl's avatar
Michael Biebl committed
45 46 47 48 49
# Remove stop symlinks for runlevel 1 as killprocs already does the job for us.
if [ "$1" = configure ] && dpkg --compare-versions "$2" lt-nl 1.2.24-1; then
    rm -f /etc/rc1.d/K??dbus
fi

50 51 52 53
if [ "$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.
54

55
    if [ -x "/etc/init.d/dbus" ] && /etc/init.d/dbus status > /dev/null; then
Michael Biebl's avatar
Michael Biebl committed
56 57 58 59
        # trigger an update notification which recommends to reboot
        [ -x /usr/share/update-notifier/notify-reboot-required ] && \
            /usr/share/update-notifier/notify-reboot-required || true
    fi
60 61
fi

62
reload_dbus_config
63

64
#DEBHELPER#