This file is indexed.

postrm is in netenv 0.94.3-30.

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
#! /bin/sh
# postrm script for netenv
#
# 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

# function defining
restore_false_links(){
    if [ X`readlink /etc/resolv.conf` = X/etc/resolv.conf.netenv_default ]; then
	if [ ! -r `readlink /etc/resolv.conf` ]; then
			# is the old file still there?
	    if [ -f /etc/resolv.conf.netenv-default ]; then
		rm /etc/resolv.conf
		mv /etc/resolv.conf.netenv-default /etc/resolv.conf
		echo "Netenv: Restored old resolv.conf (Bug #225582)."
	    else
		echo "Problems cleaning up wrong links for resolv.conf (Bug #225582)."
		echo "Correct removal or purge of netenv might require manual action"
	    fi
	fi
    fi
    if [ X`readlink /etc/network/interfaces` = X/etc/network/interfaces.netenv_default ]; then
	if [ ! -r `readlink /etc/network/interfaces` ]; then
			# is the old file still there?
	    if [ -f /etc/network/interfaces.netenv-default ]; then
		rm /etc/network/interfaces
		mv /etc/network/interfaces.netenv-default /etc/network/interfaces
		echo "Netenv: Restored old interfaces (Bug #225582)."
	    else
		echo "Problems cleaning up wrong links for interfaces (Bug #225582)."
		echo "Correct removal or purge of netenv might require manual action"
	    fi
	fi
    fi
    BAD_SCRIPT=/etc/netenv/setup-default
    if grep netenv_default $BAD_SCRIPT >/dev/null 2>&1; then
	sed -e 's/netenv_default/netenv-default/g' < $BAD_SCRIPT >${BAD_SCRIPT}.tmp
	rm $BAD_SCRIPT
	mv ${BAD_SCRIPT}.tmp $BAD_SCRIPT
	echo "Netenv: Corrected buggy setup-default file (Bug #225582)."
    fi
}

remove_netenvlinks(){
    oldpwd=`pwd`
    cd /etc
    echo
    if [ -L resolv.conf ]; then
	target=`readlink resolv.conf`
	rm resolv.conf
	mv $target resolv.conf && rm -f resolv.conf.netenv-old resolv.conf.netenv-default
	echo "Restoring static network configuration:"
	echo "Using $target for /etc/resolv.conf"
	echo "Please check that you really want this configuration!"
    fi
    cd network
    if [ -L interfaces ]; then
	target=`readlink interfaces`
	rm interfaces
	mv $target interfaces && rm -f interfaces.netenv-old interfaces.netenv-default
	echo "Restoring static network configuration:"
	echo "Using $target for /etc/network/interfaces"
	echo "Please check that you really want this configuration!"
    fi
    echo
    cd $oldpwd
}

restore_configuration(){
    if [ -f /usr/share/debconf/confmodule ]; then
	. /usr/share/debconf/confmodule

	db_get netenv/auto_configure
	case "$RET" in 
	    "Use current settings")
		db_get netenv/auto_method
		case "$RET" in
		    pcmcia)
			echo "If you followed the instructions in the netenv documentation,"
			echo "remember to restore the changes you made to /etc/pcmcia/network.opts" ;;
		    interfaces)
			if [ "$1" = "purge" ]; then
			    remove_netenvlinks;
			fi ;;
		esac
		;;
	    *) 
		;;
	esac
    fi
}

# start the actual work:

case "$1" in
    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
 	  # clean up for bug #225582 in version 0.94.3-1 (and probably older)
	restore_false_links
  	# normal cleanup
	restore_configuration "$1"
	;;
    purge)
 	  # clean up for bug #225582 in version 0.94.3-1 (and probably older)
	restore_false_links
  	# normal cleanup
	restore_configuration "$1"
		# We purge the configuration files that we created. However, we deliberately
		# do _not_ reconstruct /etc/resolv.conf and /etc/network/interfaces from the
		# safed files (*.netenv-old). This is because the settings in there might no
		# longer be valid and changes made only in the files used by netenv. This 
		# cannot be sorted out without knowing correct network parameters - therefore
		# it is left to the user.
	NODE=`uname -n`
	CONFIGURATION_FILES="/etc/netenv/${NODE} /etc/netenv/setup-default"
	rm -f $CONFIGURATION_FILES
	CONFDIR=/etc/netenv/
		# remove confdir if there are no user files left. If the user nuked the files
		# before, the dir will have been removed by dpkg.
	if [ -d $CONFDIR ]; then
	    [ $(find "$CONFDIR" | wc -l) -eq 1 ] && { rmdir $CONFDIR; echo "Removed empty directory $CONFDIR"; };
	fi
	
    # now remove the defaultitem file
	rm -f /var/cache/netenv/defaultitem
	;;
    *)
	echo "postrm called with unknown argument \`$1'" >&2
	exit 1
esac

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

# Automatically added by dh_installinit
if [ "$1" = "purge" ] ; then
	update-rc.d netenv remove >/dev/null
fi
# End automatically added section
# 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