Release diogenes-0.9.22
[diogenes.git] / diogenes.postrm
... / ...
CommitLineData
1#!/bin/sh -e
2# Diogenes 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>
6
7remove_from_webconfig () {
8 webservers="$RET"
9
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_servers="$server $restart_servers"
17 fi
18 done
19
20 # Restart servers
21 if [ -n "$restart_servers" ]; then
22 for server in $restart_servers; do
23 if [ -x /etc/init.d/$server ]; then
24 if which invoke-rc.d >/dev/null 2>&1; then
25 invoke-rc.d $server reload
26 else
27 /etc/init.d/$server reload
28 fi
29 fi
30 done
31 fi
32}
33
34. /usr/share/debconf/confmodule
35db_version 2.0
36# source dbconfig-common shell library, and call the hook function
37if [ -f /usr/share/dbconfig-common/dpkg/postrm.mysql ]; then
38 . /usr/share/dbconfig-common/dpkg/postrm.mysql
39 dbc_go diogenes $@
40fi
41
42ACTION=$1
43case "$ACTION" in
44remove)
45
46 #
47 # Only try to remove Diogenes from the webserver configs if the db key
48 # diogenes/webservers exists. If not, Diogenes had not been installed
49 # correctly so we just skip the webserver part
50 #
51 if db_get "diogenes/webservers"; then
52 remove_from_webconfig
53 fi
54 ;;
55
56purge)
57
58 #
59 # Remove ucf-managed files
60 #
61 for myfile in /etc/diogenes/apache.conf /etc/diogenes/diogenes.debian.inc.php; do
62 ucf --purge $myfile
63 rm -f $myfile $myfile.dpkg-dist $myfile.dpkg-new $myfile.dpkg-old
64 done
65
66 #
67 # If we were asked to, purge Diogenes data
68 #
69 db_get "diogenes/purge_removes_data"
70 if [ "$RET" = "true" ]; then
71 # remove files
72 rm -rf /var/spool/diogenes /var/lib/diogenes
73 fi
74 ;;
75
76*)
77 ;;
78esac
79
80
81#DEBHELPER#
82
83exit 0