aboutsummaryrefslogtreecommitdiff
path: root/debian/postinst
blob: 8a562655cfd3a9e5e45b13e10cce62e36f86c14d (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
#!/bin/bash

set -e

APT_CONF=/etc/apt/apt.conf.d/20services

. /usr/share/debconf/confmodule
db_version 2.0

case "$1" in
    configure)
        db_get whatmaps/enable_service_restarts || true
        DBVAL="$RET"

        # Configuration file doesn't exist but user wants updates enabled so
        # recreate it:
        if [ ! -f $APT_CONF ] && [ $DBVAL = "true" ]; then
            cat << EOF > $APT_CONF
// Set to 1 or true to enable service restarts on security updates
Whatmaps::Enable-Restart "1";

// What updates are considered security updates
Whatmaps::Security-Update-Origins {
   "\${distro_id} stable";
   "\${distro_id} \${distro_codename}-security";
};
EOF
        else
            case $DBVAL in
                "true") VAL=1;;
                     *) VAL=0;;
            esac
            sed -i -e "s,^\(\s*Whatmaps::Enable-Restart\s\+\"\)\S\+\(\"\s*;\),\1${VAL}\2," $APT_CONF
        fi
    ;;
        abort-upgrade|abort-remove|abort-deconfigure)
    ;;

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

#DEBHELPER#

exit 0