summaryrefslogtreecommitdiffstats
path: root/debian/progress-linux.postrm
blob: 38f85e85beb74688aba73ed216ce51577ba699d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/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_ssh_known_hosts ()
{
	if [ ! -e /etc/ssh/ssh_known_hosts ]
	then
		return
	fi

	# 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 > /dev/null 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

		# 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