summaryrefslogtreecommitdiff
path: root/debian/dbus.postinst
blob: 29fc2bc6b0d483360d3472898dc46a5c0273c13c (plain)
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
#!/bin/sh
# Copyright © 2003 Colin Walters <walters@debian.org>
# Copyright © 2006 Sjoerd Simons <sjoerd@debian.org>

set -e

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

if [ "$1" = configure ]; then
    adduser --system \
            --quiet \
            --home "$MESSAGEHOME" \
            --no-create-home \
            --disabled-password \
            --group "$MESSAGEUSER"

    if ! dpkg-statoverride --list "$LAUNCHER" >/dev/null 2>&1; then
            chown root:"$MESSAGEUSER" "$LAUNCHER"
            chmod 4754 "$LAUNCHER"
    fi
fi

# 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

if [ "$1" = configure ] && [ -n "$2" ] && [ -x "/etc/init.d/dbus" ]; then
    # Do not restart dbus on upgrades, only on fresh installations.
    # (dh_installinit -r creates a start action)
    # But do reload it so the machine-id can be generated
    if /etc/init.d/dbus status > /dev/null; then
        # trigger an update notification which recommends to reboot
        [ -x /usr/share/update-notifier/notify-reboot-required ] && \
            /usr/share/update-notifier/notify-reboot-required || true
        if [ -x "/etc/init.d/dbus" ]; then
            if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
                invoke-rc.d dbus reload || true
            else
                /etc/init.d/dbus reload || true
            fi
        fi
    fi
fi

#DEBHELPER#