File: postrm

package info (click to toggle)
phpsysinfo 3.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,900 kB
  • sloc: javascript: 22,511; php: 20,651; xml: 18,293; sh: 196; python: 58; makefile: 12
file content (78 lines) | stat: -rwxr-xr-x 1,986 bytes parent folder | download | duplicates (2)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh

set -e

lighttpd_remove() {
	if which lighty-disable-mod >/dev/null 2>&1 ; then
		lighty-disable-mod phpsysinfo || true
	fi
	if [ -L /etc/lighttpd/conf-enabled/50-phpsysinfo.conf ] ; then
		rm /etc/lighttpd/conf-enabled/50-phpsysinfo.conf
	fi
}

apache2_remove() {
	COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2-data' 2>/dev/null | awk '{print $3}' || true)

	if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
		. /usr/share/apache2/apache2-maintscript-helper
		apache2_invoke disconf 50-phpsysinfo
	elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
		if [ -L /etc/apache2/conf.d/50-phpsysinfo.conf ] ; then
			rm /etc/apache2/conf.d/50-phpsysinfo.conf
		fi
	fi
}

if [ -f /usr/share/debconf/confmodule ]; then
	. /usr/share/debconf/confmodule
fi

if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
	. /usr/share/dbconfig-common/dpkg/postrm
	dbc_go phpsysinfo $@
fi

if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
	if [ -f /usr/share/debconf/confmodule ]; then
		db_get phpsysinfo/reconfigure-webserver || true
		webservers="$RET"

		rm -f /etc/avahi/services/phpsysinfo.service

		for webserver in $webservers; do
			webserver=${webserver%,}
			if [ "$webserver" = "lighttpd" ]; then
				lighttpd_remove
			elif [ "$webserver" = "apache2" ]; then
				# Need to pass params for apache2-maintscript-helper
				apache2_remove $@
			fi
		done

		db_get phpsysinfo/restart-webserver
		res="$RET"
		if [ "$res" = "true" ]; then
			for webserver in $restart; do
				webserver=${webserver%,}

				if [ "$webserver" = "nginx" ]; then
					# The user needs to do some manual action
					continue
				fi

				# Redirection of 3 is needed because Debconf uses it and it might
				# be inherited by webserver. See bug #446324.
				if pathfind invoke-rc.d; then
					invoke-rc.d $webserver reload 3>/dev/null || true
				else
					/etc/init.d/$webserver reload 3>/dev/null || true
				fi
			done
		fi
	fi
fi

#DEBHELPER#

exit 0