Rev 96 | Details | Compare with Previous | 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 | |||
| 98 | magnus | 23 | db_get "lsh-server/purge_hostkey" || true |
| 2 | magnus | 24 | |
| 25 | PURGE_HOSTKEYS="$RET" |
||
| 26 | fi |
||
| 27 | |||
| 28 | case "$1" in |
||
| 29 | purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) |
||
| 30 | |||
| 31 | for file in /etc/ssh/NOSERVER /etc/ssh/sshd_not_to_be_run ; do |
||
| 32 | if [ -e "$file" ] && \ |
||
| 33 | grep -q '^LSH_SERVER_CONFIG_GENERATED$' "$file" ; then |
||
| 34 | rm -f "$file" |
||
| 35 | fi |
||
| 36 | done |
||
| 37 | |||
| 38 | # Try to remove ssh directory - if ssh is purged we should be |
||
| 39 | # able to do this ... |
||
| 40 | if [ -d "/etc/ssh" ] ; then |
||
| 41 | rmdir --ignore-fail-on-non-empty /etc/ssh |
||
| 42 | fi |
||
| 43 | |||
| 44 | # Try to remove the random seed file. |
||
| 45 | if [ "$1" = "purge" ] && [ -e "/var/spool/lsh/yarrow-seed-file" ] ; then |
||
| 46 | rm -f /var/spool/lsh/yarrow-seed-file |
||
| 47 | rmdir --ignore-fail-on-non-empty /var/spool/lsh |
||
| 48 | fi |
||
| 49 | |||
| 50 | ;; |
||
| 51 | |||
| 52 | *) |
||
| 53 | echo "postrm called with unknown argument \`$1'" >&2 |
||
| 54 | exit 1 |
||
| 55 | ;; |
||
| 56 | esac |
||
| 57 | |||
| 58 | if [ "$1" = "purge" ]; then |
||
| 59 | case "$PURGE_HOSTKEYS" in |
||
| 96 | magnus | 60 | true|TRUE|y*|Y*|"") |
| 2 | magnus | 61 | rm -f /etc/lsh_host_key /etc/lsh_host_key.pub |
| 62 | ;; |
||
| 63 | esac |
||
| 64 | |||
| 65 | # trash defaults file |
||
| 66 | rm -f /etc/default/lsh-server |
||
| 67 | fi |
||
| 68 | |||
| 69 | # dh_installdeb will replace this with shell code automatically |
||
| 70 | # generated by other debhelper scripts |
||
| 71 | |||
| 72 | #DEBHELPER# |
||
| 73 | |||
| 74 | exit 0 |