postrm is in tomcat8 8.0.32-1ubuntu1.
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 | #!/bin/sh
set -e
# Automatically added by dh_installinit
if [ "$1" = "purge" ] ; then
update-rc.d tomcat8 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
# 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
CONFFILE=/etc/default/tomcat8
LR_CONFFILE=/etc/logrotate.d/tomcat8
# Remove cached files and auto-generated catalina.policy
rm -rf /var/cache/tomcat8/*
case "$1" in
remove)
# Remove ROOT webapp if not modified
RWLOC="/var/lib/tomcat8/webapps/ROOT"
RWFILES="$RWLOC/index.html $RWLOC/META-INF/context.xml"
if [ "`(cat $RWFILES | md5sum -) 2>/dev/null | cut -d ' ' -f 1`" \
= "9e0c02ed7d64301d7c57380900ecce4f" ] ; then
rm $RWFILES
rmdir --ignore-fail-on-non-empty \
/var/lib/tomcat8/webapps/ROOT/META-INF \
/var/lib/tomcat8/webapps/ROOT \
/var/lib/tomcat8/webapps \
/var/lib/tomcat8 || true
fi
if [ -d /var/lib/tomcat8/common ] && [ -z "`(find var/lib/tomcat8/common/classes -type f)`" ] ; then
rmdir --ignore-fail-on-non-empty \
/var/lib/tomcat8/common/classes \
/var/lib/tomcat8/common || true
fi
if [ -d /var/lib/tomcat8/server ] && [ -z "`(find var/lib/tomcat8/server/classes -type f)`" ] ; then
rmdir --ignore-fail-on-non-empty \
/var/lib/tomcat8/server/classes \
/var/lib/tomcat8/server || true
fi
if [ -d /var/lib/tomcat8/shared ] && [ -z "`(find var/lib/tomcat8/shared/classes -type f)`" ] ; then
rmdir --ignore-fail-on-non-empty \
/var/lib/tomcat8/shared/classes \
/var/lib/tomcat8/shared || true
fi
if [ -d /var/lib/tomcat8/lib ] && [ -z "`(find var/lib/tomcat8/lib/classes -type f)`" ] ; then
rmdir --ignore-fail-on-non-empty \
/var/lib/tomcat8/lib/classes \
/var/lib/tomcat8/lib || true
fi
if [ -d "/var/cache/tomcat8" ] ; then
rm -rf /var/cache/tomcat8
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/tomcat8 /var/lib/tomcat8/temp $CONFFILE $LR_CONFFILE
if [ -d "/var/lib/tomcat8" ] ; then
rmdir --ignore-fail-on-non-empty /var/lib/tomcat8
fi
rmdir --ignore-fail-on-non-empty /etc/tomcat8/policy.d \
/etc/tomcat8/Catalina/localhost /etc/tomcat8/Catalina /etc/tomcat8
# clean up /etc/authbind after conffiles have been removed
rmdir --ignore-fail-on-non-empty /etc/authbind/byuid /etc/authbind
# Put all files owned by group tomcat8 back into root group before deleting
# the tomcat8 user and group
chown -Rhf root:root /etc/tomcat8/ || true
# Remove user/group and log files (don't remove everything under
# /var/lib/tomcat8 because there might be user-installed webapps)
db_get tomcat8/username && TOMCAT8_USER="$RET" || TOMCAT8_USER="tomcat8"
db_get tomcat8/groupname && TOMCAT8_GROUP="$RET" || TOMCAT8_GROUP="tomcat8"
deluser $TOMCAT8_USER
delgroup $TOMCAT8_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
|