postinst is in nsca 2.9.1-3ubuntu1.
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 | #! /bin/sh
. /usr/share/debconf/confmodule
pkg=nsca
case "$1" in
configure)
db_get nsca/run-nsca-daemon && new_runnsca="$RET"
;;
abort-upgrade|abort-remove|abort-deconfigure)
exit 0
;;
*)
echo "postinst called with unknown argument"
exit 1
;;
esac
# if nsca's init script is already configured, we must reflect
# that as the source of configuration, not debconf itself.
# this function figures that out. note this is slightly
# different from the run_nsca in config, as state 105 is
# treated differently at this point (since we know the files
# are unpacked at this point)
run_nsca(){
set +e
invoke-rc.d --query nsca start 2>/dev/null
invoke_said=$?
set -e
case $invoke_said in
# 101 == disabled
101)
echo "false"
;;
# 104 == enabled
104)
echo "true"
;;
# 105 == we don't know
105)
echo "unknown"
;;
# anything else is "undefined", so we then use our defaults
*)
if which nagios >/dev/null 2>&1 || which nagios3 >/dev/null 2>&1 || which nagios2 >/dev/null 2>&1 ; then
echo "true"
else
echo "false"
fi
;;
esac
}
# do this manually to allow the debconf setting to control it:
# (don't worry, the debconf setting respects the local modifications)
if [ -x "/etc/init.d/nsca" ]; then
old_runnsca=`run_nsca`
# if anything has changed...
if [ "$new_runnsca" != "$old_runnsca" ]; then
update-rc.d -f nsca remove >/dev/null 2>&1
if [ "$new_runnsca" = "false" ]; then
update-rc.d nsca stop 16 2 3 4 5 .
else
update-rc.d nsca defaults >/dev/null
fi
fi
if [ "$new_runnsca" = "false" ]; then
exit 0
fi
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d nsca start
else
/etc/init.d/nsca start
fi
fi
# always reset this question, to make sure we're not depending on it
db_reset nsca/run-nsca-daemon
db_stop
# Automatically added by dh_installinit
if [ -x "/etc/init.d/nsca" ] || [ -e "/etc/init/nsca.conf" ]; then
if [ ! -e "/etc/init/nsca.conf" ]; then
update-rc.d nsca defaults >/dev/null
fi
invoke-rc.d nsca start || exit $?
fi
# End automatically added section
|