Ticket #737: ntp.postinst

File ntp.postinst, 1.3 KB (added by zev, 14 years ago)
Line 
1#!/bin/sh
2
3set -e
4
5if [ "$1" = "configure" ]; then
6        adduser --system --quiet --group --no-create-home ntp || :
7        chown -R ntp:ntp /var/lib/ntp /var/log/ntpstats
8fi
9
10installinit_error() {
11        exit $?
12}
13
14# Automatically added by dh_apparmor
15if [ "$1" = "configure" ]; then
16    APP_PROFILE=/etc/apparmor.d/usr.sbin.ntpd
17    if [ -f "$APP_PROFILE" ]; then
18        # Add the local/ include
19        LOCAL_APP_PROFILE=/etc/apparmor.d/local/usr.sbin.ntpd
20
21        test -e "$LOCAL_APP_PROFILE" || {
22            tmp=`mktemp`
23        cat <<EOM > "$tmp"
24# Site-specific additions and overrides for usr.sbin.ntpd.
25# For more details, please see /etc/apparmor.d/local/README.
26EOM
27            mkdir `dirname $LOCAL_APP_PROFILE` 2>/dev/null || true
28            mv -f "$tmp" "$LOCAL_APP_PROFILE"
29            chmod 644 "$LOCAL_APP_PROFILE"
30        }
31
32        # Reload the profile, including any abstraction updates
33        if aa-status --enabled 2>/dev/null; then
34            apparmor_parser -r -T -W "$APP_PROFILE" || true
35        fi
36    fi
37fi
38# End automatically added section
39# Automatically added by dh_installinit
40if [ -x "/etc/init.d/ntp" ]; then
41        update-rc.d ntp start 23 2 3 4 5 . stop 77 1 . >/dev/null
42        if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
43                invoke-rc.d ntp start || installinit_error
44        else
45                /etc/init.d/ntp start || installinit_error
46        fi
47fi
48# End automatically added section
49