summaryrefslogtreecommitdiff
path: root/debian/dbus.postinst
blob: 5368bbf09b0173f40962080dc63884461548e909 (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
50
#!/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 \
            --home "$MESSAGEHOME" \
            --no-create-home \
            --disabled-password \
            --group "$MESSAGEUSER"

    chown "$MESSAGEUSER":"$MESSAGEUSER" "$MESSAGEHOME"

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

# fix rc symlink priorities for upgrades from older versions
if [ "$1" = configure ] && dpkg --compare-versions "$2" lt-nl 1.1.4-1; then
    echo "Fixing up dbus startup script runlevels and priorities..." >&2
    # update start scripts to use the proper priority
    for l in 2 3 4 5; do
        old=/etc/rc$l.d/S20dbus
        new=/etc/rc$l.d/S12dbus
        if [ -e $old ] && ! [ -e $new ]; then
            mv -vf $old $new >&2
        fi
    done
    # drop stop scripts in runlevels we don't install anymore
    for l in 0 6; do
        if [ -L /etc/rc$l.d/K20dbus ] && [ "../init.d/dbus"  = "$(readlink /etc/rc$l.d/K20dbus)" ]; then
            rm -vf /etc/rc$l.d/K20dbus >&2
        fi
    done
    # update stop script to use the proper priority
    if [ -e /etc/rc1.d/K20dbus ] && ! [ -e /etc/rc1.d/K88dbus ]; then
        mv -vf /etc/rc1.d/K20dbus /etc/rc1.d/K88dbus >&2
    fi
fi

#DEBHELPER#