summaryrefslogtreecommitdiff
path: root/debian/acmetool.postrm
blob: 3e65bbcbc348b760ff10cea41b1441d310344ff7 (plain) (blame)
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
#!/bin/sh
# postrm script for acmetool

set -e

if [ "$1" = "purge" ] ; then
  if [ -f "/etc/cron.d/acmetool" ]; then
    rm -f "/etc/cron.d/acmetool"
    if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
      invoke-rc.d cron reload || true
    else
      /etc/init.d/cron reload || true
    fi
  fi

  if [ -f "/var/spool/cron/crontabs/acme" ]; then
    rm -f "/var/spool/cron/crontabs/acme"
  fi

  if [ -d "/usr/lib/acme/hooks/" ]; then
    for hook in /usr/lib/acme/hooks/*; do
      grep -q '#!acmetool-managed!#' "$hook" && rm -f "$hook" || true
    done
    rmdir --ignore-fail-on-non-empty /usr/lib/acme/hooks || true
  fi

  if [ -d "/var/lib/acme" ]; then
    echo "**************************************************************************************"
    echo "* the acmetool state directory will be kept, if you want to really delete all your   *"
    echo "* certificates and configurations you need to remove it manually using the following *"
    echo "* command:       rm -rf /var/lib/acme                                                *"
    echo "**************************************************************************************"
  fi
fi

#DEBHELPER#

exit 0