check_logfiles: update to 3.7.1
[omd.git] / debian / postrm.in
blob440d0fb5cc5e4110366bcc9acc56ea7a8da418ab
1 #!/bin/sh
2 # postrm script for omd
4 # see: dh_installdeb(1)
6 set -e
8 # summary of how this script can be called:
9 # * <postrm> `remove'
10 # * <postrm> `purge'
11 # * <old-postrm> `upgrade' <new-version>
12 # * <new-postrm> `failed-upgrade' <old-version>
13 # * <new-postrm> `abort-install'
14 # * <new-postrm> `abort-install' <old-version>
15 # * <new-postrm> `abort-upgrade' <old-version>
16 # * <disappearer's-postrm> `disappear' <overwriter>
17 # <overwriter-version>
18 # for details, see http://www.debian.org/doc/debian-policy/ or
19 # the debian-policy package
21 APACHE_OMD_CONF="/etc/apache2/conf.d/zzz_omd.conf"
22 APACHE_OMD_EMPTY_CONF="/opt/omd/apache/empty.conf"
23 OMD="omd-###OMD_VERSION###"
25 case "$1" in
26 upgrade)
29 remove|failed-upgrade|abort-install|abort-upgrade|disappear)
30 # update-alternatives --remove omd /omd/versions/###OMD_VERSION###
33 purge)
34 ALTERNATIVES=`update-alternatives --list omd 2>/dev/null | egrep -v 'No alternatives'` || /bin/true
35 if [ -z "$ALTERNATIVES" ]; then
36 echo "Removing system group 'omd'"
37 groupdel omd || true
38 echo "Removing global links/directories"
39 # rm -f /usr/bin/omd # -> alternatives
40 # rm -f /usr/share/man/man8/omd.8.gz # -> alternatives
41 # rm -f /etc/init.d/omd # -> alternatives
42 rm -f /etc/default/omd
43 if test -d /etc/apache2/conf-available; then
44 # On e.g. ubuntu 13.10 conf.d is not used anymore, use conf-available
45 APACHE_OMD_CONF="/etc/apache2/conf-available/zzz_omd.conf"
47 ! test -x /usr/sbin/a2disconf || a2disconf zzz_omd
48 rm -f $APACHE_OMD_CONF $APACHE_OMD_EMPTY_CONF
49 rm -f /omd
50 # Try to remove empty directories
51 if test -d /opt/omd/versions; then
52 rmdir --ignore-fail-on-non-empty /opt/omd/versions
54 if test -d /opt/omd/sites; then
55 rmdir --ignore-fail-on-non-empty /opt/omd/sites
57 if test -d /opt/omd/apache; then
58 rmdir --ignore-fail-on-non-empty /opt/omd/apache
60 if test -d /opt/omd; then
61 rmdir --ignore-fail-on-non-empty /opt/omd
68 echo "postrm called with unknown argument \`$1'" >&2
69 exit 1
71 esac
73 # dh_installdeb will replace this with shell code automatically
74 # generated by other debhelper scripts.
76 #DEBHELPER#
78 exit 0