summaryrefslogtreecommitdiff
path: root/debian/bluez.postinst
blob: bfef8efaa4d7254ef3b1db2d65e052a2d94afd8e (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
51
52
53
#!/bin/sh
# snippet from http://www.dpkg.org/dpkg/ConffileHandling

# Move a conffile without triggering a dpkg question
mv_conffile() {
    OLDCONFFILE="$1"
    NEWCONFFILE="$2"

    if [ -e "$OLDCONFFILE" ]; then
        echo "Preserving user changes to $NEWCONFFILE ..."
        mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new
        mv -f "$OLDCONFFILE" "$NEWCONFFILE"
    fi
}

set -e
case "$1" in
    configure)
        if [ -e /etc/init.d/bluez-utils ]; then
            update-rc.d -f bluez-utils remove
            # maybe a (medium/low debconf?) notice is best suited here
        fi

        # use MAKEDEV instead of the original bluez script below as per policy 10.6
        if [ -x /dev/MAKEDEV ]; then
            echo "Creating device nodes ..."
            cd /dev && ./MAKEDEV bluetooth 1>/dev/null 2>/dev/null
        fi

        # create bluetooth group if not already present
        if ! getent group bluetooth > /dev/null; then
            addgroup --quiet --system bluetooth
        fi

        # reload dbus config file
        if [ -x /etc/init.d/dbus ]; then
            invoke-rc.d dbus force-reload || true
        fi

        #reload udev rules
        if [ -x /etc/init.d/udev ]; then
            invoke-rc.d udev reload || true
        fi

        ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 0
    ;;
esac

#DEBHELPER#