postinst is in chrony 1.29-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 83 84 85 86 87 | #!/bin/sh
# postinst script for chrony
#
# see: dh_installdeb(1)
set -e
# targets: configure|abort-upgrade|abort-remove|abort-deconfigure
case "$1" in
configure)
cp /usr/share/chrony/chrony.conf /etc/chrony/chrony.conf.new
MAILUTC=""
# look for real-time clock
. /etc/default/rcS
case "$UTC" in
no|"")
echo "# rtconutc" >> /etc/chrony/chrony.conf.new
;;
yes)
echo "rtconutc" >> /etc/chrony/chrony.conf.new
;;
*)
echo "# rtconutc" >> /etc/chrony/chrony.conf.new
MAILUTC="Chrony do not know how your clock is set: assuming local time.
If this is not correct edit /etc/chrony/chrony.conf. The comments
explain what to do."
;;
esac
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
MAILPASSWORD="The password for chronyc is in $KEYFILE."
if [ `echo $MAILUTC | wc -m` -gt 10 ]
then
# And tell root about the rtc setting
if `which mail >/dev/null`
then
echo "$MAILUTC" | mail -s "Chrony" root
fi
fi
fi
if `which ucf >/dev/null`
then
ucf /etc/chrony/chrony.conf.new /etc/chrony/chrony.conf
rm /etc/chrony/chrony.conf.new
fi
;;
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" ] || [ -e "/etc/init/chrony.conf" ]; then
if [ ! -e "/etc/init/chrony.conf" ]; then
update-rc.d chrony defaults 83 >/dev/null
fi
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
|