This file is indexed.

postinst is in resolvconf 1.63ubuntu11.

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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#!/bin/sh
#
# This file is part of the resolvconf package.
#

set -e

. /usr/share/debconf/confmodule

MYNAME=resolvconf.postinst
report() { echo "${MYNAME}: $*" ; }
report_err() { report "Error: $*" >&2 ; }
report_warn() { report "Warning: $*" >&2 ; }
report_info() { report "$*" >&2 ; }

OLD_RUN_DIR=/var/run

echo_first_arg() { echo "$1" ; }
is_immutable_file() {
	[ "$1" ] || return 2
	[ -e "$1" ] || return 1
	[ ! -L "$1" ] || return 1
	which lsattr >/dev/null 2>&1 || return 2
	echo_first_arg $(lsattr "$1") | grep -sq i
}

### Symlink ###

case "$1" in
  configure)
	# Linkify /etc/resolv.conf if appropriate
	db_get resolvconf/linkify-resolvconf
	if [ "$RET" = "true" ] || [ -e /var/lib/resolvconf/convert ]; then
		# Cleanup flag from previous implementation where the symlink
		# would be created by the upstart job (wasn't working because of / writability)
		# FIXME: This code and the above || [ -e /var/lib/resolvconf/convert ] can be
		#        dropped in Ubuntu 12.10.
		rm -rf /var/lib/resolvconf

		if is_immutable_file /etc/resolv.conf ; then
			report_err "Cannot replace the current /etc/resolv.conf with a symbolic link because it is immutable. To correct this problem, gain root privileges in a terminal and run 'chattr -i /etc/resolv.conf' and then 'dpkg --configure resolvconf'. Aborting."
			exit 1
		else
			if [ -f /etc/resolv.conf ] \
			   && [ ! -L /etc/resolv.conf ]
			then
				# Back up original file
				if [ ! -e /etc/resolvconf/resolv.conf.d/original ] ; then
					cp -a /etc/resolv.conf /etc/resolvconf/resolv.conf.d/original
					db_get resolvconf/link-tail-to-original
					if [ "$RET" = "true" ]; then
						ln -s original /etc/resolvconf/resolv.conf.d/tail
					fi
				else
					cp -a /etc/resolv.conf /etc/resolv.conf.dpkg-old
				fi

				# Even though we create this dir in the preinst,
				# don't assume that it's still here; a reboot
				# after unpack may have left us with no upstart
				# job in place and /run cleaned out.
				mkdir -p /run/resolvconf/interface

				# Before creating the link, make sure that the original file is
				# at the target of the link.  /sbin/resolvconf will overwrite
				# this when it does an update, of course.
				if [ ! -e /run/resolvconf/resolv.conf ] ; then
					cp -a /etc/resolv.conf /run/resolvconf/resolv.conf
				fi
				# Add the original file to the database so that its contents
				# are included when resolvconf updates.
				# Yes, this is an ugly workaround for the problem that there
				# is no way to obtain nameserver information from interface
				# configurers after they have done their configuration work.
				cp -a /etc/resolv.conf /run/resolvconf/interface/original.resolvconf
			fi
			# Create the link and make sure we don't convert it again on upgrade
			# The link is relative to allow for cp from outside a chroot into a chroot
			# to work without overwriting the file outside the chroot (or failing)
			ln -nsf ../run/resolvconf/resolv.conf /etc/resolv.conf
			db_set resolvconf/linkify-resolvconf false
		fi
	fi

	# FHS violation; get rid of it, we use /run directly now.
	if [ -e /etc/resolvconf/run ]; then
		rm -rf /etc/resolvconf/run
	fi

	;;
  # triggered)
	# Don't do anything here
	# ;;
  # abort-upgrade)
	# Don't do anything here since we don't do anything in the prerm on upgrade or on failed-upgrade
	# ;;
  # abort-remove)
	# Don't do anything extra here since we don't deconfigure anything in the prerm on remove
	# ;;
  # abort-deconfigure)
	# Don't do anything extra here since we don't do anything in the prerm on deconfigure
	# ;;
esac

db_stop

# Automatically added by dh_installinit
if [ -e "/etc/init/resolvconf.conf" ]; then
	invoke-rc.d resolvconf start || exit $?
fi
# End automatically added section
# Automatically added by dh_installinit
update-rc.d -f resolvconf remove >/dev/null || exit $?
# End automatically added section


### Notify others of our installation ###

is_installed() {
	# Same function in preinst, postinst, postrm
	[ "$1" ] || return 1
	dpkg-query -W -f='${Status}\n' "$1" 2>/dev/null | grep -siq '^[[:alpha:]]\+ [[:alpha:]]\+ installed$' >/dev/null 2>&1
}

case "$1" in
  configure)
	if [ -f /run/resolvconf/packages-to-notify ] ; then
		PACKAGES_TO_NOTIFY="$(cat /run/resolvconf/packages-to-notify)"
		rm -f /run/resolvconf/packages-to-notify
		for PKG in $PACKAGES_TO_NOTIFY ; do
			if is_installed "$PKG" ; then
				SCRPT="/usr/lib/resolvconf/dpkg-event.d/$PKG"
				if [ -x "$SCRPT" ] ; then
					"$SCRPT" install || :
				fi
			fi
		done
	fi
	;;
  # triggered)
	# Don't do anything
	# ;;
  # abort-upgrade)
	# Don't do anything here since we don't do anything in the prerm on upgrade or on failed-upgrade
	# ;;
  # abort-remove)
	# Don't do anything extra here since we don't deconfigure anything in the prerm on remove
	# ;;
  # abort-deconfigure)
	# Don't do anything extra here since we don't do anything in the prerm on deconfigure
	# ;;
esac


### (Trigger self to) enable updates ###

case "$1" in
  reconfigure)
		resolvconf --enable-updates
	;;
  configure)
	if [ "$DEBCONF_RECONFIGURE" = 1 ] ; then
		resolvconf --enable-updates
	else
		# Trigger self to enable updates later
		dpkg-trigger --no-await resolvconf-enable-updates || resolvconf --enable-updates
	fi
	;;
  triggered)
	# Runs after this and other packages have been configured
        for trggr in $2 ; do
		case "$trggr" in
		  resolvconf-enable-updates)
			resolvconf --enable-updates
			break
			;;
		esac
        done
	;;
  abort-remove)
	# We disable updates in the prerm on remove.
	# So, enable them again
	resolvconf --enable-updates
	;;
  # abort-upgrade)
	# Don't do anything here since we don't do anything in the prerm on upgrade or on failed-upgrade
	# ;;
  # abort-deconfigure)
	# Don't do anything extra here since we don't do anything in the prerm on deconfigure
	# ;;
esac

exit 0