2 # Horde postrm script using debconf
3 # Originally written for horde by Ola Lundqvist <opal@debian.org>
4 # Adapted for horde2 by Nils Rennebarth <nils@debian.org>
5 # Adapted for Diogenes by Jeremy Lainé <jeremy.laine@m4x.org>
7 remove_from_webconfig () {
10 # Remove symlink to our apache.conf
11 for server in $webservers ; do
12 server=$(echo $server | sed 's/,$//')
13 servers="$server $servers"
14 if [ -s /etc/$server/conf.d/diogenes ] ; then
15 rm -f /etc/$server/conf.d/diogenes
16 restart="$server $restart"
21 if [ -e /usr/share/wwwconfig-common/restart.sh ] ; then
22 . /usr/share/wwwconfig-common/restart.sh
30 # Remove Diogenes from the webserver configuration
32 . /usr/share/debconf/confmodule
36 # Only try to remove Diogenes from the webserver configs if the db key
37 # diogenes/webservers exists. If not, Diogenes had not been installed
38 # correctly so we just skip the webserver part
40 if db_get "diogenes/webservers"; then
46 . /usr/share/debconf/confmodule
50 # Remove ucf-managed files
52 for myfile in /etc/diogenes/apache.conf /etc/diogenes/diogenes.debian.inc.php; do
54 rm -f $myfile $myfile.dpkg-dist $myfile.dpkg-new $myfile.dpkg-old
58 # If we were asked to, purge Diogenes data
60 db_get "diogenes/purge_removes_data"
61 if [ "$RET" = "true" ]; then
63 rm -rf /var/spool/diogenes /var/lib/diogenes
65 # drop the database if we are Automatic mode
66 db_get "diogenes/databasemgr_type"
67 if [ "$RET" = "Automatic" ] ; then
68 db_get "diogenes/databasemgr_server"
70 db_get "diogenes/database_name"
72 # we use the Diogenes user as the "admin", as he is authorized to do a drop
73 db_get "diogenes/database_user"
75 db_get "diogenes/database_pass"
77 if [ -f /usr/share/wwwconfig-common/mysql.get ] && [ -x $(which mysql) ] ; then
78 . /usr/share/wwwconfig-common/mysql.get
79 if eval $mysqlcmd -f -e "\"DROP DATABASE $dbname;\"" ; then