Rev 96 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 96 | Rev 98 | ||
---|---|---|---|
1 | #!/bin/sh |
1 | #!/bin/sh |
2 | # postrm script for lsh-server |
2 | # postrm script for lsh-server |
3 | # |
3 | # |
4 | # see: dh_installdeb(1) |
4 | # see: dh_installdeb(1) |
5 | 5 | ||
6 | set -e |
6 | set -e |
7 | 7 | ||
8 | # summary of how this script can be called: |
8 | # summary of how this script can be called: |
9 | # * <postrm> `remove' |
9 | # * <postrm> `remove' |
10 | # * <postrm> `purge' |
10 | # * <postrm> `purge' |
11 | # * <old-postrm> `upgrade' <new-version> |
11 | # * <old-postrm> `upgrade' <new-version> |
12 | # * <new-postrm> `failed-upgrade' <old-version> |
12 | # * <new-postrm> `failed-upgrade' <old-version> |
13 | # * <new-postrm> `abort-install' |
13 | # * <new-postrm> `abort-install' |
14 | # * <new-postrm> `abort-install' <old-version> |
14 | # * <new-postrm> `abort-install' <old-version> |
15 | # * <new-postrm> `abort-upgrade' <old-version> |
15 | # * <new-postrm> `abort-upgrade' <old-version> |
16 | # * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version> |
16 | # * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version> |
17 | # for details, see http://www.debian.org/doc/debian-policy/ or |
17 | # for details, see http://www.debian.org/doc/debian-policy/ or |
18 | # the debian-policy package |
18 | # the debian-policy package |
19 | 19 | ||
20 | if [ -f /usr/share/debconf/confmodule ] ; then |
20 | if [ -f /usr/share/debconf/confmodule ] ; then |
21 | . /usr/share/debconf/confmodule |
21 | . /usr/share/debconf/confmodule |
22 | 22 | ||
23 | db_get "lsh-server/purge_hostkeys" || true |
23 | db_get "lsh-server/purge_hostkey" || true |
24 | 24 | ||
25 | PURGE_HOSTKEYS="$RET" |
25 | PURGE_HOSTKEYS="$RET" |
26 | fi |
26 | fi |
27 | 27 | ||
28 | case "$1" in |
28 | case "$1" in |
29 | purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) |
29 | purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) |
30 | 30 | ||
31 | for file in /etc/ssh/NOSERVER /etc/ssh/sshd_not_to_be_run ; do |
31 | for file in /etc/ssh/NOSERVER /etc/ssh/sshd_not_to_be_run ; do |
32 | if [ -e "$file" ] && \ |
32 | if [ -e "$file" ] && \ |
33 | grep -q '^LSH_SERVER_CONFIG_GENERATED$' "$file" ; then |
33 | grep -q '^LSH_SERVER_CONFIG_GENERATED$' "$file" ; then |
34 | rm -f "$file" |
34 | rm -f "$file" |
35 | fi |
35 | fi |
36 | done |
36 | done |
37 | 37 | ||
38 | # Try to remove ssh directory - if ssh is purged we should be |
38 | # Try to remove ssh directory - if ssh is purged we should be |
39 | # able to do this ... |
39 | # able to do this ... |
40 | if [ -d "/etc/ssh" ] ; then |
40 | if [ -d "/etc/ssh" ] ; then |
41 | rmdir --ignore-fail-on-non-empty /etc/ssh |
41 | rmdir --ignore-fail-on-non-empty /etc/ssh |
42 | fi |
42 | fi |
43 | 43 | ||
44 | # Try to remove the random seed file. |
44 | # Try to remove the random seed file. |
45 | if [ "$1" = "purge" ] && [ -e "/var/spool/lsh/yarrow-seed-file" ] ; then |
45 | if [ "$1" = "purge" ] && [ -e "/var/spool/lsh/yarrow-seed-file" ] ; then |
46 | rm -f /var/spool/lsh/yarrow-seed-file |
46 | rm -f /var/spool/lsh/yarrow-seed-file |
47 | rmdir --ignore-fail-on-non-empty /var/spool/lsh |
47 | rmdir --ignore-fail-on-non-empty /var/spool/lsh |
48 | fi |
48 | fi |
49 | 49 | ||
50 | ;; |
50 | ;; |
51 | 51 | ||
52 | *) |
52 | *) |
53 | echo "postrm called with unknown argument \`$1'" >&2 |
53 | echo "postrm called with unknown argument \`$1'" >&2 |
54 | exit 1 |
54 | exit 1 |
55 | ;; |
55 | ;; |
56 | esac |
56 | esac |
57 | 57 | ||
58 | if [ "$1" = "purge" ]; then |
58 | if [ "$1" = "purge" ]; then |
59 | case "$PURGE_HOSTKEYS" in |
59 | case "$PURGE_HOSTKEYS" in |
60 | true|TRUE|y*|Y*|"") |
60 | true|TRUE|y*|Y*|"") |
61 | rm -f /etc/lsh_host_key /etc/lsh_host_key.pub |
61 | rm -f /etc/lsh_host_key /etc/lsh_host_key.pub |
62 | ;; |
62 | ;; |
63 | esac |
63 | esac |
64 | 64 | ||
65 | # trash defaults file |
65 | # trash defaults file |
66 | rm -f /etc/default/lsh-server |
66 | rm -f /etc/default/lsh-server |
67 | fi |
67 | fi |
68 | 68 | ||
69 | # dh_installdeb will replace this with shell code automatically |
69 | # dh_installdeb will replace this with shell code automatically |
70 | # generated by other debhelper scripts |
70 | # generated by other debhelper scripts |
71 | 71 | ||
72 | #DEBHELPER# |
72 | #DEBHELPER# |
73 | 73 | ||
74 | exit 0 |
74 | exit 0 |