2013-02-08 16:27:05 +00:00
|
|
|
#! /bin/bash
|
2006-04-26 12:28:53 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2006-07-07 11:39:30 +00:00
|
|
|
. /usr/share/debconf/confmodule
|
|
|
|
|
2006-04-26 12:28:53 +00:00
|
|
|
# * 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)
|
2012-08-25 15:02:36 +00:00
|
|
|
rm -f /etc/alternc/local.sh /etc/alternc/my_mail.cnf /etc/alternc/bureau.conf
|
2013-04-23 15:11:00 +00:00
|
|
|
rm -f /var/lib/alternc/backups/etc-installed.tar.gz
|
2013-01-29 09:41:28 +00:00
|
|
|
rm -f /etc/incron.d/alternc
|
2008-10-04 20:25:03 +00:00
|
|
|
|
2012-08-25 15:02:36 +00:00
|
|
|
# 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 ?
|
|
|
|
|
2006-04-26 12:28:53 +00:00
|
|
|
# Purge database?
|
2012-08-25 15:02:36 +00:00
|
|
|
#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
|
2006-07-07 11:39:30 +00:00
|
|
|
|
2012-08-25 15:02:36 +00:00
|
|
|
# Purge datafiles
|
|
|
|
#db_input high alternc/postrm_remove_datafiles || true
|
|
|
|
#db_go
|
|
|
|
#db_get alternc/postrm_remove_datafiles || true
|
|
|
|
#if [ "$RET" = "true" ]; then
|
2013-04-23 15:11:00 +00:00
|
|
|
# rm -rf /var/lib/alternc/backups /var/alternc/dns /var/alternc/html /var/alternc/redir
|
2012-08-25 15:02:36 +00:00
|
|
|
#fi
|
2006-07-07 11:39:30 +00:00
|
|
|
|
|
|
|
# Purge bind zones
|
2012-08-25 15:02:36 +00:00
|
|
|
#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
|
2006-07-07 11:39:30 +00:00
|
|
|
|
|
|
|
# Purge mailboxes
|
2012-08-25 15:02:36 +00:00
|
|
|
#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
|
2006-07-07 11:39:30 +00:00
|
|
|
|
2012-08-25 15:02:36 +00:00
|
|
|
#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
|
2008-10-14 15:29:21 +00:00
|
|
|
rm -f /etc/apache*/conf.d/override_php.conf /etc/apache*/conf.d/alternc-ssl.conf /etc/apache*/conf.d/alternc.conf
|
2008-10-31 17:55:06 +00:00
|
|
|
rm -f /etc/php*/conf.d/alternc.ini
|
2012-08-25 16:02:42 +00:00
|
|
|
|
|
|
|
# Restore orignals conf files which have been replaced by Alternc
|
|
|
|
# With the oldest tar found
|
2013-04-23 15:11:00 +00:00
|
|
|
BACKUP=$(ls /var/lib/alternc/backups/etc-original*.tar.gz | head -n 1)
|
2012-08-25 16:02:42 +00:00
|
|
|
tar -C / -xf "$BACKUP" 2>/dev/null || true
|
2012-08-27 13:17:25 +00:00
|
|
|
|
|
|
|
# Reload services which use these files
|
|
|
|
for service in bind9 postfix proftpd dovecot apache2; do
|
|
|
|
invoke-rc.d $service force-reload || true
|
|
|
|
done
|
2012-08-25 16:02:42 +00:00
|
|
|
|
2006-04-26 12:28:53 +00:00
|
|
|
;;
|
|
|
|
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#
|
|
|
|
|
2012-08-28 14:24:21 +00:00
|
|
|
# important: postrm freezes withtout that:
|
|
|
|
db_stop
|
|
|
|
|
2006-04-26 12:28:53 +00:00
|
|
|
exit 0
|
|
|
|
|
|
|
|
# vim: et sw=4
|