postinst is in sitesummary-client 0.1.28+deb9u1.
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 | #!/bin/sh
set -e
. /usr/share/debconf/confmodule
case "$1" in
configure)
PREV_VER=$2
;;
abort-upgrade|abort-remove|abort-deconfigure)
exit 0
;;
esac
# Read the package default, need to match the code in sitesummary-client
[ -f /usr/share/sitesummary/sitesummary-client.conf ] && \
. /usr/share/sitesummary/sitesummary-client.conf
for confdir in \
/usr/share/sitesummary/config.d \
/etc/sitesummary/config.d
do
[ -d $confdir ] || continue
for config in $confdir/* ; do
[ -f $config ] && . $config
done
done
db_get sitesummary-client/collector_url
URL="$RET"
# Only update the URLs if it is different from the current value
if [ "$URL" != "$serverurls" ] ; then
if [ -f /etc/sitesummary/config.d/00debconf ] ; then
if grep -q '^serverurls=' /etc/sitesummary/config.d/00debconf ; then
sed "s%^serverurls=.*\$%serverurls=\"$URL\"%" < /etc/sitesummary/config.d/00debconf > /etc/sitesummary/config.d/00debconf.new && mv /etc/sitesummary/config.d/00debconf.new /etc/sitesummary/config.d/00debconf
else
echo "serverurls=\"$URL\"/" >> /etc/sitesummary/config.d/00debconf
fi
else
mkdir -p /etc/sitesummary/config.d
echo "serverurls=\"$URL\"" > /etc/sitesummary/config.d/00debconf
fi
fi
db_get sitesummary-client/site
SITE="$RET"
# Only replace the site file if the content changed
if [ -f /etc/sitesummary/site ] ; then
OLDSITE="`cat /etc/sitesummary/site`"
if [ "$SITE" != "$OLDSITE" ] ; then
echo "$SITE" > /etc/sitesummary/site
fi
else
echo "$SITE" > /etc/sitesummary/site
fi
db_get sitesummary-client/sitegroup
SITEGROUP="$RET"
# Only replace the sitegroup file if the content changed
if [ -f /etc/sitesummary/sitegroup ] ; then
OLDSITEGROUP="`cat /etc/sitesummary/sitegroup`"
if [ "$SITEGROUP" != "$OLDSITEGROUP" ] ; then
echo "$SITEGROUP" > /etc/sitesummary/sitegroup
fi
else
echo "$SITEGROUP" > /etc/sitesummary/sitegroup
fi
db_get sitesummary-client/hostclass
HOSTCLASS="$RET"
# Only replace the hostclass file if the content changed
if [ -f /etc/sitesummary/hostclass ] ; then
OLDHOSTCLASS="`cat /etc/sitesummary/hostclass`"
if [ "$HOSTCLASS" != "$OLDHOSTCLASS" ] ; then
echo "$HOSTCLASS" > /etc/sitesummary/hostclass
fi
else
echo "$HOSTCLASS" > /etc/sitesummary/hostclass
fi
config=/etc/nagios/nrpe.d/sitesummary-nrpe.cfg
if [ ! -f $config ] ; then
db_get sitesummary-client/enable-nagios-nrpe-config
if [ true = "$RET" ] ; then
mkdir -p $(dirname $config)
cat > $config <<EOF
dont_blame_nrpe=1
include=/etc/nagios/sitesummary-nrpe-commands.cfg
EOF
db_get sitesummary-client/nagios-server
if [ "$RET" ] ; then
echo "allowed_hosts=$RET" >> $config
fi
fi
fi
db_stop
# Switched from cron.d to cron.daily script in version 0.0.12
if dpkg --compare-versions "$PREV_VER" lt "0.0.12" && \
[ -f /etc/cron.d/sitesummary-client ]
then
rm -f /etc/cron.d/sitesummary-client
fi
# Make sure changes to the NRPE configuration take effect right away
if [ -x /etc/init.d/nagios-nrpe-server ] ; then
invoke-rc.d nagios-nrpe-server restart
fi
# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
if [ -x "/etc/init.d/sitesummary-client" ]; then
update-rc.d sitesummary-client start 20 2 3 4 5 . >/dev/null || exit $?
fi
fi
# End automatically added section
|