diff options
Diffstat (limited to 'debian/openssh-server.postrm')
-rw-r--r-- | debian/openssh-server.postrm | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/debian/openssh-server.postrm b/debian/openssh-server.postrm new file mode 100644 index 000000000..32471c718 --- /dev/null +++ b/debian/openssh-server.postrm | |||
@@ -0,0 +1,40 @@ | |||
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 | if type deluser >/dev/null 2>&1; then | ||
35 | deluser --quiet sshd > /dev/null || true | ||
36 | fi | ||
37 | ;; | ||
38 | esac | ||
39 | |||
40 | exit 0 | ||