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