alternc.postrm 2.83 KB
Newer Older
1
#! /bin/bash -x
2 3 4

set -e

5 6
. /usr/share/debconf/confmodule

7 8 9 10 11 12 13 14 15 16 17
#     * postrm remove
#     * postrm purge 
#     * old-postrm upgrade new-version
#     * new-postrm failed-upgrade old-version
#     * new-postrm abort-install
#     * new-postrm abort-install old-version
#     * new-postrm abort-upgrade old-version
#     * disappearer's-postrm disappear overwriter overwriter-version

case "$1" in
  purge)
18
    rm -f /etc/alternc/local.sh /etc/alternc/my_mail.cnf /etc/alternc/bureau.conf
19
    rm -f /var/backups/alternc/etc-installed.tar.gz
Alan Garcia's avatar
Alan Garcia committed
20
    rm -f /etc/incron.d/alternc
21

22 23 24 25 26 27
    # FIXME : remove following commented lines if we are sure
    # to not drop database and remove files (except /etc/alternc)
    # when Alternc is purged

    # Maybe tell to user how to do if he want to drop db and/or remove files ?

28
    # Purge database?
29 30 31 32 33 34
    #db_input high alternc/postrm_remove_databases || true
    #db_go
    #db_get alternc/postrm_remove_databases || true
    #if [ "$RET" = "true" ]; then
    #  /usr/bin/mysql --defaults-file=/etc/alternc/my.cnf -Bs -e "DROP DATABASE $ALTERNC_DB"
    #fi
35

36 37 38 39 40 41 42
    # Purge datafiles
    #db_input high alternc/postrm_remove_datafiles || true
    #db_go
    #db_get alternc/postrm_remove_datafiles || true
    #if [ "$RET" = "true" ]; then
    #  rm -rf /var/backups/alternc /var/alternc/dns /var/alternc/html /var/alternc/redir
    #fi
43 44

    # Purge bind zones
45 46 47 48 49 50
    #db_input high alternc/postrm_remove_bind || true
    #db_go
    #db_get alternc/postrm_remove_bind || true
    #if [ "$RET" = "true" ]; then
    #  rm -rf /var/alternc/bind /etc/bind/templates
    #fi
51 52

    # Purge mailboxes
53 54 55 56 57 58
    #db_input high alternc/postrm_remove_mailboxes || true
    #db_go
    #db_get alternc/postrm_remove_mailboxes || true
    #if [ "$RET" = "true" ]; then
    #  rm -rf /var/alternc/mail
    #fi
59

60
    #rm -rf /var/alternc/apacheconf /var/alternc/cgi-bin /var/alternc/bureau /var/alternc/exec.usr /var/alternc/mla /var/alternc/redir /var/alternc/tmp /var/log/alternc
61
    rm -f /etc/apache*/conf.d/override_php.conf /etc/apache*/conf.d/alternc-ssl.conf /etc/apache*/conf.d/alternc.conf
62
    rm -f /etc/php*/conf.d/alternc.ini
63 64 65

    # Restore orignals conf files which have been replaced by Alternc
    # With the oldest tar found
66
    BACKUP=$(ls /var/backups/alternc/etc-original*.tar.gz | head -n 1)
67
    tar -C / -xf "$BACKUP" 2>/dev/null || true
68 69 70 71 72
    
    # Reload services which use these files
    for service in bind9 postfix proftpd dovecot apache2; do
	invoke-rc.d $service force-reload || true
    done
73

74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
    ;;
  remove|upgrade|failed-upgrade|abort-install|abort-upgrade)
    ;;
  disappear)
    ;;
  *)
    echo "postrm called with unknown argument \`$1'" >&2
    exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

90 91 92
# important: postrm freezes withtout that:
db_stop

93 94 95
exit 0

# vim: et sw=4