summaryrefslogtreecommitdiff
path: root/debian/anastasis-httpd.postrm
blob: fc96f0e42216c65431920c201387bb343fd71559 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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