summaryrefslogtreecommitdiff
path: root/debian/anastasis-httpd.postrm
diff options
context:
space:
mode:
Diffstat (limited to 'debian/anastasis-httpd.postrm')
-rw-r--r--debian/anastasis-httpd.postrm72
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 @@
+#!/bin/sh
+
+set -e
+
+pathfind() {
+ OLDIFS="$IFS"
+ IFS=:
+ for p in $PATH; do
+ if [ -x "$p/$*" ]; then
+ IFS="$OLDIFS"
+ return 0
+ fi
+ done
+ IFS="$OLDIFS"
+ return 1
+}
+
+apache_remove() {
+ if [ diff /etc/anastasis/apache.conf /etc/apache2/conf-available/anastasis.conf ] >/dev/null 2>&1; then
+ rm -f /etc/apache2/conf-available/anastasis.conf
+ fi
+}
+
+nginx_remove() {
+ if [ diff /etc/taler-exchange/nginx.conf /etc/apache2/conf-available/taler-exchange.conf ] >/dev/null 2>&1; then
+ rm -f /etc/nginx/conf-available/anastasis.conf
+ fi
+}
+
+if [ -f /usr/share/debconf/confmodule ]; then
+ . /usr/share/debconf/confmodule
+fi
+
+if [ -f /usr/share/dbconfig-common/dpkg/postrm.pgsql ]; then
+ . /usr/share/dbconfig-common/dpkg/postrm.pgsql
+ dbc_go anastasis "$@"
+fi
+
+if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
+ if [ -f /usr/share/debconf/confmodule ]; then
+ . /usr/share/debconf/confmodule
+ db_version 2.0
+ db_get anastasis/reconfigure-webserver
+ webservers="$RET"
+ for webserver in $webservers; do
+ webserver=${webserver%,}
+ if [ "$webserver" = "nginx" ]; then
+ nginx_remove
+ else
+ apache_remove
+ fi
+ done
+ fi
+fi
+
+case "${1}" in
+purge)
+ rm -f /var/lib/anastasis/master-api-key.txt
+ rm -rf /var/lib/anastasis/httpd/
+ ;;
+remove | upgrade | failed-upgrade | abort-install | abort-upgrade | disappear) ;;
+
+\
+ *)
+ echo "postrm called with unknown argument \`${1}'" >&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0