postrm is in cacti 0.8.7i-2ubuntu1.
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 | #!/bin/sh
set -e
#
# Skip, if we are not in "configure" state
#
if [ "$1" != "remove" ] && [ "$1" != "purge" ]; then
exit 0
fi
## Source debconf library
. /usr/share/debconf/confmodule
db_version 2.0
# source dbconfig-common stuff
if [ -f /usr/share/dbconfig-common/dpkg/postrm.mysql ]; then
. /usr/share/dbconfig-common/dpkg/postrm.mysql
dbc_go cacti $@
fi
#
# retieve various configuration options from debconf
#
db_get cacti/webserver
WWWTYPE="$RET"
case "$WWWTYPE" in
"Apache2"|"All")
webservers="apache2" ;;
*)
webservers="" ;;
esac
includefile=/etc/cacti/apache.conf
#
# remove or purge the whole package
#
case "$1" in
purge)
# cleanup some unsed directores
[ -d "/var/log/cacti" ] && rm -rf /var/log/cacti
[ -d "/var/cache/cacti" ] && rm -rf /var/cache/cacti
# get rid of non conffiles generated in /etc
rm -f /etc/cacti/debian.php /etc/cacti/default-poller
# get rid of ucf entries
if which ucf >/dev/null 2>&1; then
ucf --purge /etc/cacti/apache.conf
ucf --purge /etc/cacti/lighttpd.conf
ucf --purge /etc/cacti/debian.php
fi
rm -f /etc/cacti/apache.conf
rm -f /etc/cacti/debian.php
# remove apache config symlinks and restart apache
for server in $webservers; do
if [ -d "/etc/${server}/conf.d" ]; then
if [ -L "/etc/${server}/conf.d/cacti.conf" ]; then
rm "/etc/${server}/conf.d/cacti.conf"
fi
elif [ -d "/etc/${server}/conf.available/" ]; then
if [ -L "/etc/${server}/conf.available/cacti.conf" ]; then
rm "/etc/${server}/conf.available/cacti.conf"
fi
fi
invoke-rc.d $server reload || true
done
;;
remove)
for server in $webservers; do
if [ -d "/etc/${server}/conf.d" ]; then
if [ -L "/etc/${server}/conf.d/cacti.conf" ]; then
rm "/etc/${server}/conf.d/cacti.conf"
fi
elif [ -d "/etc/${server}/conf.available/" ]; then
if [ -L "/etc/${server}/conf.available/cacti.conf" ]; then
rm "/etc/${server}/conf.available/cacti.conf"
fi
fi
invoke-rc.d $server reload || true
done
;;
esac
# Automatically added by dh_installdebconf
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
db_purge
fi
# End automatically added section
exit 0
|