Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / omd / debian / postrm.in
blobacd98af3b9c8c06ffbe6d2e7eb2cca1296c2ce7c
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 || true
48 rm -f $APACHE_OMD_CONF $APACHE_OMD_EMPTY_CONF
49 rm -f /omd
50 if test -f /etc/systemd/system/omd.service; then
51 rm -f /etc/systemd/system/omd.service
53 # Try to remove empty directories
54 if test -d /opt/omd/versions; then
55 rmdir --ignore-fail-on-non-empty /opt/omd/versions
57 if test -d /opt/omd/sites; then
58 rmdir --ignore-fail-on-non-empty /opt/omd/sites
60 if test -d /opt/omd/apache; then
61 rmdir --ignore-fail-on-non-empty /opt/omd/apache
63 if test -d /opt/omd; then
64 rmdir --ignore-fail-on-non-empty /opt/omd
71 echo "postrm called with unknown argument \`$1'" >&2
72 exit 1
74 esac
76 # dh_installdeb will replace this with shell code automatically
77 # generated by other debhelper scripts.
79 #DEBHELPER#
81 exit 0