postinst is in watchdog 5.15-2.
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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | #!/bin/sh
set -e
if [ "$1" = configure ]
then
. /usr/share/debconf/confmodule
if [ -x "`which MAKEDEV`" ]; then
# do we have to create the device?
if [ ! -c /dev/watchdog ]
then
(cd /dev; MAKEDEV misc || true)
fi
# do we have to create the temperature device?
if [ ! -c /dev/temperature ]
then
(cd /dev; MAKEDEV misc || true)
fi
fi
# one version set some incorrect permissions
if [ -k /var/log/watchdog ]
then
chmod 750 /var/log/watchdog
fi
default_format="\
# Start watchdog at boot time? 0 or 1
run_watchdog=%s
# Start wd_keepalive after stopping watchdog? 0 or 1
run_wd_keepalive=%s
# Load module before starting watchdog
watchdog_module=%s
# Specify additional watchdog options here (see manpage).
"
# Determine whether to start watchdog at boot time.
db_get watchdog/run
case $RET in
false) run_watchdog=0;;
*) run_watchdog=1;;
esac
db_get watchdog/module
module=$RET
# Determine whether to start wd_keepalive after stopping watchdog.
db_get watchdog/run_keepalive
case $RET in
false) run_wd_keepalive=0;;
*) run_wd_keepalive=1;;
esac
# Create an up-to-date copy of the default file.
{
# If it already exists, preserve everything except our comment
# and $run_watchdog.
if [ -f /etc/default/watchdog ]
then
printf "$default_format" '.*' '.*' '.*' \
| grep -vxf - /etc/default/watchdog \
| grep -v watchdog_options || true
fi
# Append our comment and the current value.
printf "$default_format" "$run_watchdog" "$run_wd_keepalive" "\"$module\""
# And finally preserve the watchdog_options setting.
if [ -f /etc/default/watchdog ]
then
grep watchdog_options /etc/default/watchdog || true
fi
} > /etc/default/watchdog.dpkg-new
# Replace the original atomically.
mv /etc/default/watchdog.dpkg-new /etc/default/watchdog
# Restart if so configured.
db_get watchdog/restart
if [ "$RET" = true ]
then
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d watchdog restart
else
/etc/init.d/watchdog stop > /dev/null 2>&1
/etc/init.d/watchdog start
fi
fi
#
# stop debconf
#
db_stop
fi
#
# remove old links
#
if dpkg --compare-versions "$2" lt 5.2.4-3
then
if [ -L /etc/rc2.d/S10watchdog -a \
-L /etc/rc3.d/S10watchdog -a \
-L /etc/rc4.d/S10watchdog -a \
-L /etc/rc5.d/S10watchdog -a \
-L /etc/rc0.d/K80watchdog -a \
-L /etc/rc1.d/K80watchdog -a \
-L /etc/rc6.d/K80watchdog ]; then
update-rc.d -f watchdog remove
fi
fi
if dpkg --compare-versions "$2" lt 5.4-11
then
if [ -L /etc/rc2.d/S09wd_keepalive -a \
-L /etc/rc3.d/S09wd_keepalive -a \
-L /etc/rc4.d/S09wd_keepalive -a \
-L /etc/rc5.d/S09wd_keepalive -a \
-L /etc/rc0.d/K91wd_keepalive -a \
-L /etc/rc1.d/K91wd_keepalive -a \
-L /etc/rc6.d/K91wd_keepalive ]; then
update-rc.d -f wd_keepalive remove
fi
fi
if dpkg --compare-versions "$2" lt 5.6-5
then
if [ -f /var/lib/insserv/using-insserv ]; then
rm -f /etc/rc0.d/K*wd_keepalive
rm -f /etc/rc1.d/K*wd_keepalive
rm -f /etc/rc6.d/K*wd_keepalive
fi
fi
# Not automatically added by dh_installinit (--noscripts)
update-rc.d watchdog defaults 89 11 >/dev/null
update-rc.d wd_keepalive start 09 2 3 4 5 . >/dev/null
# Automatically added by dh_systemd_enable
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask watchdog.service >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled watchdog.service; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable watchdog.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 watchdog.service >/dev/null || true
fi
# End automatically added section
|