diff options
Diffstat (limited to 'debian/anastasis-httpd.postrm')
-rw-r--r-- | debian/anastasis-httpd.postrm | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/debian/anastasis-httpd.postrm b/debian/anastasis-httpd.postrm new file mode 100644 index 0000000..fc96f0e --- /dev/null +++ b/debian/anastasis-httpd.postrm | |||
@@ -0,0 +1,72 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | set -e | ||
4 | |||
5 | pathfind() { | ||
6 | OLDIFS="$IFS" | ||
7 | IFS=: | ||
8 | for p in $PATH; do | ||
9 | if [ -x "$p/$*" ]; then | ||
10 | IFS="$OLDIFS" | ||
11 | return 0 | ||
12 | fi | ||
13 | done | ||
14 | IFS="$OLDIFS" | ||
15 | return 1 | ||
16 | } | ||
17 | |||
18 | apache_remove() { | ||
19 | if [ diff /etc/anastasis/apache.conf /etc/apache2/conf-available/anastasis.conf ] >/dev/null 2>&1; then | ||
20 | rm -f /etc/apache2/conf-available/anastasis.conf | ||
21 | fi | ||
22 | } | ||
23 | |||
24 | nginx_remove() { | ||
25 | if [ diff /etc/taler-exchange/nginx.conf /etc/apache2/conf-available/taler-exchange.conf ] >/dev/null 2>&1; then | ||
26 | rm -f /etc/nginx/conf-available/anastasis.conf | ||
27 | fi | ||
28 | } | ||
29 | |||
30 | if [ -f /usr/share/debconf/confmodule ]; then | ||
31 | . /usr/share/debconf/confmodule | ||
32 | fi | ||
33 | |||
34 | if [ -f /usr/share/dbconfig-common/dpkg/postrm.pgsql ]; then | ||
35 | . /usr/share/dbconfig-common/dpkg/postrm.pgsql | ||
36 | dbc_go anastasis "$@" | ||
37 | fi | ||
38 | |||
39 | if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then | ||
40 | if [ -f /usr/share/debconf/confmodule ]; then | ||
41 | . /usr/share/debconf/confmodule | ||
42 | db_version 2.0 | ||
43 | db_get anastasis/reconfigure-webserver | ||
44 | webservers="$RET" | ||
45 | for webserver in $webservers; do | ||
46 | webserver=${webserver%,} | ||
47 | if [ "$webserver" = "nginx" ]; then | ||
48 | nginx_remove | ||
49 | else | ||
50 | apache_remove | ||
51 | fi | ||
52 | done | ||
53 | fi | ||
54 | fi | ||
55 | |||
56 | case "${1}" in | ||
57 | purge) | ||
58 | rm -f /var/lib/anastasis/master-api-key.txt | ||
59 | rm -rf /var/lib/anastasis/httpd/ | ||
60 | ;; | ||
61 | remove | upgrade | failed-upgrade | abort-install | abort-upgrade | disappear) ;; | ||
62 | |||
63 | \ | ||
64 | *) | ||
65 | echo "postrm called with unknown argument \`${1}'" >&2 | ||
66 | exit 1 | ||
67 | ;; | ||
68 | esac | ||
69 | |||
70 | #DEBHELPER# | ||
71 | |||
72 | exit 0 | ||