This file is indexed.

postinst is in chrony 2.1.1-1.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/sh
# postinst script for chrony
#
# see: dh_installdeb(1)

set -e


# targets: configure|abort-upgrade|abort-remove|abort-deconfigure

case "$1" in
    configure)

        if ! getent passwd _chrony > /dev/null 2>&1
        then
            echo "Creating '_chrony' system user/group for the chronyd daemon…"
            adduser --force-badname \
                    --system \
                    --group \
                    --quiet \
                    --gecos "Chrony daemon" \
                    --home /var/lib/chrony \
                    --no-create-home _chrony
        fi

        # Change the owner of "/var/l{ib,og}/chrony" directories and their
        # subfiles to "_chrony" only if the user has not set the "user"
        # directive in chrony.conf
        if ! grep "^user" /etc/chrony/chrony.conf > /dev/null 2>&1; then
            chown -R _chrony:_chrony /var/lib/chrony
            if [ -d /var/log/chrony ]; then
                chown -R _chrony:_chrony /var/log/chrony
            fi
        fi

        if [ -z "$2" ]
        then
            # As this is a new install, generate a key.
            # Remove any keyfile left by a failed install.
            rm -rf /etc/chrony/chrony.keys
            KEYFILE=`tempfile -m 640 -n /etc/chrony/chrony.keys`
            PASSWORD=`head -c 8 /dev/urandom | tr '\0-\377' 'a-zA-Z0-9a-zA-Z0-9a-zA-Z0-9a-zA-Z0-9@@@@####'`
            echo "1 $PASSWORD" > $KEYFILE
        fi

        if `which ucf >/dev/null`
        then
          ucf --three-way /usr/share/chrony/chrony.conf /etc/chrony/chrony.conf
        fi

        # obsolete, instead use logrotate
        rm -rf /etc/cron.weekly/chrony
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

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

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

# Automatically added by dh_installinit
if [ -x "/etc/init.d/chrony" ]; then
	update-rc.d chrony defaults 83 >/dev/null
fi
if [ -x "/etc/init.d/chrony" ] || [ -e "/etc/init/chrony.conf" ]; then
	invoke-rc.d chrony start || exit $?
fi
# End automatically added section
# Automatically added by dh_installmenu
if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; then
	update-menus
fi
# End automatically added section


exit 0