postrm is in tomcat7 7.0.52-1ubuntu0.16.
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
# 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
# Automatically added by dh_installinit
if [ "$1" = "purge" ] ; then
update-rc.d tomcat7 remove >/dev/null
fi
# In case this system is running systemd, we make systemd reload the unit files
# to pick up changes.
if [ -d /run/systemd/system ] ; then
systemctl --system daemon-reload >/dev/null || true
fi
# End automatically added section
CONFFILE=/etc/default/tomcat7
LR_CONFFILE=/etc/logrotate.d/tomcat7
# Remove cached files and auto-generated catalina.policy
rm -rf /var/cache/tomcat7/*
rm -rf /var/lib/tomcat7/policy
case "$1" in
remove)
# Remove ROOT webapp if not modified
RWLOC="/var/lib/tomcat7/webapps/ROOT"
RWFILES="$RWLOC/index.html $RWLOC/META-INF/context.xml"
if [ "`(cat $RWFILES | md5sum -) 2>/dev/null | cut -d ' ' -f 1`" \
= "0688719927c9ff0b364d2b5bc1eea542" ] ; then
rm $RWFILES
rmdir --ignore-fail-on-non-empty \
/var/lib/tomcat7/webapps/ROOT/META-INF \
/var/lib/tomcat7/webapps/ROOT \
/var/lib/tomcat7/webapps \
/var/lib/tomcat7 || true
fi
if [ -d /var/lib/tomcat7/common ] && [ -z "`(find var/lib/tomcat7/common/classes -type f)`" ] ; then
rmdir --ignore-fail-on-non-empty \
/var/lib/tomcat7/common/classes \
/var/lib/tomcat7/common || true
fi
if [ -d /var/lib/tomcat7/server ] && [ -z "`(find var/lib/tomcat7/server/classes -type f)`" ] ; then
rmdir --ignore-fail-on-non-empty \
/var/lib/tomcat7/server/classes \
/var/lib/tomcat7/server || true
fi
if [ -d /var/lib/tomcat7/shared ] && [ -z "`(find var/lib/tomcat7/shared/classes -type f)`" ] ; then
rmdir --ignore-fail-on-non-empty \
/var/lib/tomcat7/shared/classes \
/var/lib/tomcat7/shared || true
fi
if [ -d "/var/cache/tomcat7" ] ; then
rm -rf /var/cache/tomcat7
fi
;;
purge)
# ignore errors during purge
set +e
if [ -x "/usr/bin/ucf" ]; then
ucf --purge $CONFFILE
ucf --purge $LR_CONFFILE
fi
rm -rf /var/log/tomcat7 /var/lib/tomcat7/temp $CONFFILE $LR_CONFFILE
if [ -d "/var/lib/tomcat7" ] ; then
rmdir --ignore-fail-on-non-empty /var/lib/tomcat7
fi
rmdir --ignore-fail-on-non-empty /etc/tomcat7/policy.d \
/etc/tomcat7/Catalina/localhost /etc/tomcat7/Catalina /etc/tomcat7
# clean up /etc/authbind after conffiles have been removed
rmdir --ignore-fail-on-non-empty /etc/authbind/byuid /etc/authbind
# Remove user/group and log files (don't remove everything under
# /var/lib/tomcat7 because there might be user-installed webapps)
db_get tomcat7/username && TOMCAT7_USER="$RET" || TOMCAT7_USER="tomcat7"
db_get tomcat7/groupname && TOMCAT7_GROUP="$RET" || TOMCAT7_GROUP="tomcat7"
deluser $TOMCAT7_USER
delgroup $TOMCAT7_GROUP
set -e
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
# Nothing to do here
;;
*)
echo "$0 called with unknown argument \`$1'" >&2
exit 1
;;
esac
|