diff options
Diffstat (limited to 'debian/openssh-server.postrm')
-rw-r--r-- | debian/openssh-server.postrm | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/debian/openssh-server.postrm b/debian/openssh-server.postrm new file mode 100644 index 000000000..f63ba4d46 --- /dev/null +++ b/debian/openssh-server.postrm | |||
@@ -0,0 +1,38 @@ | |||
1 | #!/bin/sh -e | ||
2 | |||
3 | #DEBHELPER# | ||
4 | |||
5 | abort_transfer_conffile () { | ||
6 | CONFFILE="$1" | ||
7 | if [ -e "$CONFFILE.moved-by-preinst" ]; then | ||
8 | echo >&2 "Aborting ownership transfer of conffile $CONFFILE ..." | ||
9 | mv -f "$CONFFILE.moved-by-preinst" "$CONFFILE" | ||
10 | return 0 | ||
11 | fi | ||
12 | } | ||
13 | |||
14 | case $1 in | ||
15 | abort-install|abort-upgrade) | ||
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 | ||
31 | |||
32 | update-rc.d ssh remove >/dev/null | ||
33 | |||
34 | deluser --quiet sshd > /dev/null || true | ||
35 | ;; | ||
36 | esac | ||
37 | |||
38 | exit 0 | ||