pkg://chrony_1.21z-5_i386.deb:327490/postinst
info downloads
#!/bin/sh
set -e
# postinst for Chrony John Hasler jhasler@debian.org 2000-2006
# Any possessor of a copy of this program may treat it as if it
# were in the public domain. I waive all rights.
install-info --quiet --description="Set your clock from the Net" \
--section General "General Commands" \
/usr/share/info/chrony.info
if [ -x /usr/bin/update-menus ] ; then
/usr/bin/update-menus
fi
update-rc.d chrony defaults 83 >/dev/null
cp /usr/share/chrony/chrony.conf /etc/chrony/chrony.conf.new
# Fix up chrony.conf.new.
. /etc/default/rcS
case "$UTC" in
no|"") echo "# rtconutc" >> /etc/chrony/chrony.conf.new
MAILUTC="Chrony has been configured to assume that your real-time clock is on local time.
If this is not correct edit /etc/chrony/chrony.conf. The comments explain
what to do."
;;
yes) echo "rtconutc" >> /etc/chrony/chrony.conf.new
MAILUTC="Chrony has been configured to assume that your real-time clock is on UTC time.
If this is not correct edit /etc/chrony/chrony.conf. The comments explain
what to do."
;;
*) echo "# Can't tell how your clock is set: assuming local time." >> /etc/chrony/chrony.conf.new
MAILUTC="Can't tell 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 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."
# And tell root about the key and the rtc setting.
if `which /usr/bin/mail > /dev/null`; then
/usr/bin/mail -s "Chrony" root <<EOF
$MAILPASSWORD
$MAILUTC
In the chrony.conf included in this package:
Chrony has been configured on the assumption that you are using either a dialup
connection or a PPPoE DSL connection. It will be brought online when PPP
comes up and offline when it goes down. If this is not correct you should edit
/etc/chrony/chrony.conf. The comments explain what to do. For more
information on configuring Chrony use the command 'info chrony'.
You can also change the default time servers in /etc/chrony/chrony.conf.
Updating of the real-time clock has been enabled but some systems that use
either the genrtc driver or have HPET hardware clocks have problems. To
disable real-time clock updating edit /etc/chrony/chrony.conf. The
comments explain what to do.
EOF
fi
else
# If we are upgrading from an old version retrieve the files saved by the preinst.
# If we are upgrading from a recent version no need to do anything.
if dpkg --compare-versions "$2" lt-nl 1.21-3 ; then
if [ -f /etc/chrony/chrony.keys."$2" ]; then
mv /etc/chrony/chrony.keys."$2" /etc/chrony/chrony.keys
fi
if [ -f /etc/chrony/chrony.conf."$2" ]; then
mv /etc/chrony/chrony.conf."$2" /etc/chrony/chrony.conf
fi
fi
fi
ucf --sum-file /usr/share/chrony/chrony.conf.md5sum /etc/chrony/chrony.conf.new /etc/chrony/chrony.conf
rm /etc/chrony/chrony.conf.new
invoke-rc.d chrony start
exit 0