egroupware/debian/phpgroupware.postrm

106 lines
2.7 KiB
Plaintext
Raw Normal View History

#! /bin/sh
# postrm script for phpgroupware
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <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' <r>overwrit>r> <new-version>
# for details, see /usr/share/doc/packaging-manual/
. /usr/share/debconf/confmodule
db_version 2.0
db_get "phpgroupware/webserver" || true
webserver="$RET"
# Allows us to loop and substitute in one pass
case $webserver in
Apache) webservers="apache" ;;
Apache-SSL) webservers="apache-ssl" ;;
Both) webservers="apache apache-ssl" ;;
*) webservers="" ;;
esac
includefile=/etc/phpgroupware/apache.conf
case "$1" in
purge)
db_get "phpgroupware/postrm"
if [ "$RET" = "true" ] ; then
# Get database configuration
db_get "phpgroupware/db/user/name"
dbuser="$RET"
db_get "phpgroupware/db/user/password"
dbpass="$RET"
db_get "phpgroupware/db/host"
dbserver="$RET"
db_get "phpgroupware/db/name"
dbname="$RET"
db_get "phpgroupware/db/admin/name"
dbadmin="$RET"
db_get "phpgroupware/db/admin/password"
dbadmpass="$RET"
db_get "phpgroupware/db/type"
case "$RET" in
PostgresQL) dbtype="pgsql" ;;
MySql) dbtype="mysql" ;;
mSQL) dbtype="mysql" ;;
ODBC_compliant) dbtype="odbc" ;;
Sybase) dbtype="sybase" ;;
MSsql) dbtype="mssql" ;;
Oracle) dbtype="oracle" ;;
esac
. /usr/share/wwwconfig-common/${dbtype}-dropuser.sh
. /usr/share/wwwconfig-common/${dbtype}-dropdb.sh
rm -rf /var/lib/phpgroupware/
fi
rm -rf /etc/phpgroupware
for server in $webservers ; do
conffile="/etc/$server/httpd.conf"
. /usr/share/wwwconfig-common/apache-uninclude.sh
if [ "$status" = "purge" ] ;
then restart="$restart $server"
fi
done
servers="exim apache-ssl apache mysql postresql"
. /usr/share/wwwconfig-common/restart.sh
for dir in /usr/share/phpgroupware-core /var/www/phpgroupware ; do
if [ -d ${dir} ] ; then rm -rf ${dir} ; fi
done
;;
remove)
for dir in /usr/share/phpgroupware-core /var/www/phpgroupware ; do
if [ -d ${dir} ] ; then rm -rf ${dir} ; fi
done
;;
upgrade)
for dir in /usr/share/phpgroupware-core /var/www/phpgroupware ; do
if [ -d ${dir} ] ; then rm -rf ${dir} ; fi
done
;;
failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 0
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0