This file is indexed.

postrm is in netmrg 0.20-7.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#! /bin/sh
# postrm script for netmrg
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postrm> `remove'
#        * <postrm> `purge'
#        * <old-postrm> `upgrade' <new-version>
#        * <new-postrm> `failed-upgrade' <old-version>
#        * <new-postrm> `abort-install'
#        * <new-postrm> `abort-install' <old-version>
#        * <new-postrm> `abort-upgrade' <old-version>
#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

if [ "$DPKG_DEBUG" = "developer" ]; then
	set -x
fi

if [ -f /usr/share/debconf/confmodule ]; then
	. /usr/share/debconf/confmodule
	db_version 2.0
	
	db_get "netmrg/webserver" || true
	webserver="$RET"
	
	# Allows us to loop and substitute in one pass
	case $webserver in
		Apache2)		webservers="apache2" ;;
		Apache)		webservers="apache" ;;
		Apache-SSL)	webservers="apache-ssl" ;;
		All)		webservers="apache2 apache apache-ssl" ;;
		*)		webservers="" ;;
	esac
fi
includefile=/etc/netmrg/netmrg.conf

case "$1" in
	purge)
		if [ -f /usr/share/debconf/confmodule ]; then
			db_get "netmrg/postrm"
			if [ "$RET" = "true" ] ; then
				# Get database configuration
				db_get "netmrg/db/user/name"
				dbuser="$RET"
				db_get "netmrg/db/user/password"
				dbpass="$RET"
				db_get "netmrg/db/host"
				dbserver="$RET"
				db_get "netmrg/db/name"
				dbname="$RET"
				db_get "netmrg/db/admin/name"
				dbadmin="$RET"
				db_reset "netmrg/db/admin/password"
				db_input critical "netmrg/db/admin/password" || true
				db_go || true
				db_get "netmrg/db/admin/password"
				dbadmpass="$RET"
				if [ -e /usr/share/wwwconfig-common/mysql-dropdb.sh ] ; then
				  . /usr/share/wwwconfig-common/mysql-dropdb.sh
				else
				  echo "Cannot drop database (can't find wwwconfig-common script)." >&2
				fi
				if [ -e /usr/share/wwwconfig-common/mysql-dropuser.sh ] ; then
				  . /usr/share/wwwconfig-common/mysql-dropuser.sh
				else
				  echo "Cannot drop user (can't find wwwconfig-common script)." >&2
				fi
	
				rm -rf /var/lib/netmrg
				rm -rf /var/log/netmrg
	
				# Get rid of the user if the package is purged
				if getent passwd netmrg >/dev/null; then
					userdel netmrg
				fi
			fi

			for server in $webservers ; do
				# prefer conf.d over monolithic form
				if [ -d "/etc/${server}/conf.d" ] ; then
					if [ -L "/etc/${server}/conf.d/netmrg.conf" ] ; then
						rm "/etc/${server}/conf.d/netmrg.conf"
						status="purge"
					fi
				else
					conffile="/etc/$server/httpd.conf"
					if [ -e /usr/share/wwwconfig-common/apache-uninclude.sh ] ; then
						. /usr/share/wwwconfig-common/apache-uninclude.sh
					else
						echo "Cannot uninclude apache config part (can't find wwwconfig-common script)." >&2
					fi
				fi
				if [ "$status" = "purge" ] ; then
					restart="$restart $server"
				fi
			done
		fi

		rm -rf /etc/netmrg
		servers="apache-ssl apache apache2 mysql"
		if [ -e /usr/share/wwwconfig-common/restart.sh ] ; then
			. /usr/share/wwwconfig-common/restart.sh ||
					echo "Could not restart servers (wwwconfig-common script failed)." >&2
		else
			echo "Cannot restart servers (can't find wwwconfig-common script)." >&2
		fi
		rm -rf /var/lib/netmrg/sessions

	;;
	remove)
		if [ -f /usr/share/debconf/confmodule ]; then
			for server in $webservers ; do
				# prefer conf.d over monolithic form
				if [ -d "/etc/${server}/conf.d" ] ; then
					if [ -L "/etc/${server}/conf.d/netmrg.conf" ] ; then
						rm "/etc/${server}/conf.d/netmrg.conf"
						status="purge"
					fi
				else
					conffile="/etc/$server/httpd.conf"
					if [ -e /usr/share/wwwconfig-common/apache-uninclude.sh ] ; then
						. /usr/share/wwwconfig-common/apache-uninclude.sh
					else
						echo "Cannot uninclude apache config part (can't find wwwconfig-common script)." >&2
					fi
				fi
				if [ "$status" = "purge" ] ; then
					restart="$restart $server"
				fi
			done
		fi

		servers="apache-ssl apache apache2 mysql"
		if [ -e /usr/share/wwwconfig-common/restart.sh ] ; then
		  . /usr/share/wwwconfig-common/restart.sh ||
		      echo "Could not restart servers (wwwconfig-common script failed)." >&2
		else
		  echo "Cannot restart servers (can't find wwwconfig-common script)." >&2
		fi
		rm -rf /var/lib/netmrg/sessions

	;;
	upgrade)
	;;
	failed-upgrade|abort-install|abort-upgrade|disappear)
	;;
	*)
		echo "postrm called with unknown argument \`$1'" >&2
		exit 0
	;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

# Automatically added by dh_installdebconf
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
	. /usr/share/debconf/confmodule
	db_purge
fi
# End automatically added section


exit 0