diff options
Diffstat (limited to 'debian/openssh-server.postrm')
-rw-r--r-- | debian/openssh-server.postrm | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/debian/openssh-server.postrm b/debian/openssh-server.postrm index e7a437260..f63ba4d46 100644 --- a/debian/openssh-server.postrm +++ b/debian/openssh-server.postrm | |||
@@ -2,26 +2,37 @@ | |||
2 | 2 | ||
3 | #DEBHELPER# | 3 | #DEBHELPER# |
4 | 4 | ||
5 | if [ "$1" = "purge" ] | 5 | abort_transfer_conffile () { |
6 | then | 6 | CONFFILE="$1" |
7 | # Remove all non-conffiles that ssh might create, so that we can | 7 | if [ -e "$CONFFILE.moved-by-preinst" ]; then |
8 | # smoothly remove /etc/ssh if and only if the user hasn't dropped some | 8 | echo >&2 "Aborting ownership transfer of conffile $CONFFILE ..." |
9 | # other files in there. Conffiles have already been removed at this | 9 | mv -f "$CONFFILE.moved-by-preinst" "$CONFFILE" |
10 | # point. | 10 | return 0 |
11 | rm -f /etc/ssh/ssh_host_key /etc/ssh/ssh_host_key.pub | 11 | fi |
12 | rm -f /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub | 12 | } |
13 | rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub | ||
14 | rm -f /etc/ssh/sshd_config | ||
15 | rm -f /etc/ssh/sshd_not_to_be_run | ||
16 | rmdir --ignore-fail-on-non-empty /etc/ssh | ||
17 | fi | ||
18 | 13 | ||
19 | if [ "$1" = "purge" ] ; then | 14 | case $1 in |
20 | update-rc.d ssh remove >/dev/null | 15 | abort-install|abort-upgrade) |
21 | fi | 16 | abort_transfer_conffile /etc/default/ssh |
17 | abort_transfer_conffile /etc/init.d/ssh | ||
18 | abort_transfer_conffile /etc/pam.d/ssh | ||
19 | ;; | ||
20 | purge) | ||
21 | # Remove all non-conffiles that ssh might create, so that we | ||
22 | # can smoothly remove /etc/ssh if and only if the user | ||
23 | # hasn't dropped some other files in there. Conffiles have | ||
24 | # already been removed at this point. | ||
25 | rm -f /etc/ssh/ssh_host_key /etc/ssh/ssh_host_key.pub | ||
26 | rm -f /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub | ||
27 | rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub | ||
28 | rm -f /etc/ssh/sshd_config | ||
29 | rm -f /etc/ssh/sshd_not_to_be_run | ||
30 | rmdir --ignore-fail-on-non-empty /etc/ssh | ||
22 | 31 | ||
23 | if [ "$1" = "purge" ] ; then | 32 | update-rc.d ssh remove >/dev/null |
24 | deluser --quiet sshd > /dev/null || true | 33 | |
25 | fi | 34 | deluser --quiet sshd > /dev/null || true |
35 | ;; | ||
36 | esac | ||
26 | 37 | ||
27 | exit 0 | 38 | exit 0 |