diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-01-29 18:46:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-01-29 19:55:47 +0000 |
commit | 17517821b9bd34df19aab20cdc9593887886a649 (patch) | |
tree | d3d2363a8236179f327ed68dc286376f6a77502f | |
parent | Generalizing postinst script. (diff) | |
download | progress-linux-17517821b9bd34df19aab20cdc9593887886a649.tar.xz progress-linux-17517821b9bd34df19aab20cdc9593887886a649.zip |
Adding postrm script to remove apt and ssh configuration.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rwxr-xr-x | debian/progress-linux.postrm | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/debian/progress-linux.postrm b/debian/progress-linux.postrm new file mode 100755 index 0000000..c5a43d7 --- /dev/null +++ b/debian/progress-linux.postrm @@ -0,0 +1,65 @@ +#!/bin/sh + +set -e + +PROJECT="progress-linux" +DOMAIN="progress-linux.org" + +Remove_apt_sources () +{ + # apt sources + rm -f "/etc/apt/sources.list.d/${PROJECT}.list" +} + +Remove_apt_preferences () +{ + # apt preferences + rm -f "/etc/apt/preferences.d/${PROJECT}.pref" +} + +Remove_apt_keys () +{ + # apt keys + rm -f "/etc/apt/trusted.gpg.d/${PROJECT}.gpg" +} + +Remove_ssh_known_hosts () +{ + # ssh cert-authority + grep -v "^@cert-authority \*.${DOMAIN}" /etc/ssh/ssh_known_hosts > /etc/ssh/ssh_known_hosts.tmp + + if [ "$(md5sum /etc/ssh/ssh_known_hosts.tmp | cut -d' ' -f1)" = "2a2b4fdd70705b2029b35a24217138e6" ] + then + rm -f /etc/ssh/ssh_known_hosts.tmp + rm -f /etc/ssh/ssh_known_hosts + + rmdir /etc/ssh 2>&1 || true + else + mv -f /etc/ssh/ssh_known_hosts.tmp /etc/ssh/ssh_known_hosts + fi +} + +case "${1}" in + remove) + # apt + Remove_apt_sources + Remove_apt_preferences + Remove_apt_keys + + # openssh-server + Remove_ssh_known_hosts + ;; + + purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + + ;; + + *) + echo "postrm called with unknown argument \`${1}'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 |