postinst is in uptimed 1:0.3.17-4.
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 88 89 90 91 92 93 94 | #! /bin/sh
. /usr/share/debconf/confmodule
db_version 2.0
set -e
if [ "$1" = "configure" ]; then
# Step 1: Assemble a sed(1) script that does the configuration changes we
# want
SEDSCRIPT=`mktemp /tmp/debconfXXXXXX`
db_get 'uptimed/interval'
echo >$SEDSCRIPT "s/^UPDATE_INTERVAL=.*/UPDATE_INTERVAL=$RET/"
db_get 'uptimed/maxrecords'
echo >>$SEDSCRIPT "s/^LOG_MAXIMUM_ENTRIES=.*/LOG_MAXIMUM_ENTRIES=$RET/"
db_get 'uptimed/mail/do_mail'
if [ "$RET" = "Never" ]; then
echo >>$SEDSCRIPT "s/^SEND_EMAIL=.*/SEND_EMAIL=0/"
elif [ "$RET" = "Record" ]; then
echo >>$SEDSCRIPT "s/^SEND_EMAIL=.*/SEND_EMAIL=3/"
elif [ "$RET" = "Milestone" ]; then
echo >>$SEDSCRIPT "s/^SEND_EMAIL=.*/SEND_EMAIL=2/"
else
echo >>$SEDSCRIPT "s/^SEND_EMAIL=.*/SEND_EMAIL=1/"
fi
if [ "$RET" != "Never" ]; then
db_get 'uptimed/mail/address'
echo >>$SEDSCRIPT "s/^EMAIL=.*/EMAIL=$RET/"
fi
# 0.1.6-4 commented these out. Leave until the yet unnamed distro
# after sid
echo >>$SEDSCRIPT "s/^#disabled#MILESTONE=/MILESTONE=/"
db_stop
# Step 2: Process the config file
TEMPFILE=`mktemp /tmp/debconfXXXXXX`
sed -f $SEDSCRIPT </etc/uptimed.conf >$TEMPFILE
rm $SEDSCRIPT
# Step 3: See if anything has changed. If so, install the new configuration
# and restart uptimed if it is already running
if diff /etc/uptimed.conf $TEMPFILE >/dev/null; then
rm $TEMPFILE
NEEDRESTART=no
else
mv /etc/uptimed.conf \
/etc/uptimed.conf.dpkg-old
mv $TEMPFILE /etc/uptimed.conf
NEEDRESTART=yes
fi
if [ ! -d /var/spool/uptimed ]; then
mkdir /var/spool/uptimed
fi
if [ "$NEEDRESTART" = "yes" ]; then
/etc/init.d/uptimed restart-if-running
fi
fi
# change ownership to daemon (run as non-root)
chown daemon:daemon /var/spool/uptimed
if [ -f /var/spool/uptimed/bootid ]; then
chown daemon:daemon /var/spool/uptimed/*
fi
chown root:daemon /etc/uptimed.conf
chmod 644 /etc/uptimed.conf
# Automatically added by dh_systemd_enable
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask uptimed.service >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled uptimed.service; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable uptimed.service >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state uptimed.service >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/uptimed" ] || [ -e "/etc/init/uptimed.conf" ]; then
if [ ! -e "/etc/init/uptimed.conf" ]; then
update-rc.d uptimed defaults 99 >/dev/null
fi
invoke-rc.d uptimed start || exit $?
fi
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/init.d/uptimed.sh 1:0.3.16-3.1 -- "$@"
# End automatically added section
|