1 #!/bin/sh |
1 #!/bin/sh |
2 # postrm script for mercurial-server |
2 # postrm script for mercurial-server |
3 # |
|
4 # see: dh_installdeb(1) |
|
5 |
3 |
6 set -e |
4 set -e |
7 |
5 |
8 # summary of how this script can be called: |
6 # Load debconf |
9 # * <postrm> `remove' |
7 . /usr/share/debconf/confmodule |
10 # * <postrm> `purge' |
|
11 # * <old-postrm> `upgrade' <new-version> |
|
12 # * <new-postrm> `failed-upgrade' <old-version> |
|
13 # * <new-postrm> `abort-install' |
|
14 # * <new-postrm> `abort-install' <old-version> |
|
15 # * <new-postrm> `abort-upgrade' <old-version> |
|
16 # * <disappearer's-postrm> `disappear' <overwriter> |
|
17 # <overwriter-version> |
|
18 # for details, see http://www.debian.org/doc/debian-policy/ or |
|
19 # the debian-policy package |
|
20 |
8 |
|
9 # Check if the user wants the repositories removed on purging |
|
10 remove_repositories_on_purge() { |
|
11 db_get mercurial-server/purge_repositories || RET=false |
|
12 if [ "$RET" = "true" ]; then |
|
13 return 0 |
|
14 else |
|
15 return 1 |
|
16 fi |
|
17 } |
21 |
18 |
22 case "$1" in |
19 case "$1" in |
23 purge) |
20 purge) |
24 deluser --quiet --system hg > /dev/null || true |
21 if remove_repositories_on_purge; then |
|
22 echo -n "Removing hg user and purging data..." |
|
23 deluser --remove-home --quiet --system hg > /dev/null || true |
|
24 else |
|
25 echo -n "Removing hg user..." |
|
26 deluser --quiet --system hg > /dev/null || true |
|
27 fi |
25 delgroup --quiet --system hg > /dev/null || true |
28 delgroup --quiet --system hg > /dev/null || true |
|
29 echo done |
26 ;; |
30 ;; |
27 |
31 |
28 remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) |
32 remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) |
29 ;; |
33 ;; |
30 |
34 |