This file is indexed.

postinst is in initscripts 2.88dsf-13.10ubuntu11.

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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
#! /bin/sh
#
# initscripts postinst
#

set -e

. /lib/init/vars.sh

case "$1" in
  configure)
	PREV_VER=$2
	;;
  abort-upgrade|abort-remove|abort-deconfigure)
	exit 0
	;;
esac

umask 022

# If the device/inode are the same, a bind mount already exists or the
# transition is complete, so set up is not required.  Otherwise bind
# mount $SRC on $DEST.
bind_mount ()
{
	SRC=$1
	DEST=$2

	FSTYPE=""
	OPTS=""

	ssrc="$(/usr/bin/stat -L --format="%d %i" "$SRC" 2>/dev/null || :)"
	sdest="$(/usr/bin/stat -L --format="%d %i" "$DEST" 2>/dev/null || :)"

	case "$(uname -s)" in
		Linux)     FSTYPE=$SRC; OPTS="-orw -obind" ;;
		*FreeBSD)  FSTYPE=nullfs; OPTS="-orw" ;;
		GNU)       FSTYPE=firmlink ;;
		*)         FSTYPE=none ;;
	esac

	# Bind mount $SRC on $DEST
	if [ -n "$ssrc" ] && [ "$ssrc" != "$sdest" ]; then
		[ -d "$DEST" ] || mkdir "$DEST"
		[ -x /sbin/restorecon ] && /sbin/restorecon "$DEST"
		if mount -t $FSTYPE "$SRC" "$DEST" $OPTS ; then
			return 0
		fi
		return 1
	fi

	return 0
}

compat_link () {
	SRC=$1
	DEST=$2

	ssrc="$(/usr/bin/stat -L --format="%d %i" "$SRC" 2>/dev/null || :)"
	sdest="$(/usr/bin/stat -L --format="%d %i" "$DEST" 2>/dev/null || :)"

	if [ -n "$ssrc" ] && [ "$ssrc" != "$sdest" ]; then
		echo "guest environment detected: Linking $DEST to $SRC"
		(
			if [ -e $DEST ]; then
				if [ -L $DEST ]; then
					echo "$DEST is already a symlink; not replacing with link to $SRC"
					exit 0
				elif [ -d $DEST ]; then
					rmdir $DEST || exit 1
				else
					echo "$DEST isn't a directory or a symlink"
					exit 1
				fi
			fi
			ln -fs $SRC $DEST
		) || {
			echo "Can't symlink $DEST to $SRC; please fix manually."
			return 1
		}
		[ -x /sbin/restorecon ] && /sbin/restorecon "$DEST"
	fi

	return 0
}

#
# Initialize rcS default file.
#
if [ ! -f /etc/default/rcS ]
then
	cp -p /usr/share/initscripts/default.rcS /etc/default/rcS
else
	# in Ubuntu we use /var/run and /var/lock tmpfses; these are not
	# optional so remove the options from /etc/default/rcS
	if dpkg --compare-versions "$PREV_VER" le-nl "2.87dsf-4ubuntu9"
	then
		sed -i "/^RAMRUN=/d;/^RAMLOCK=/d" /etc/default/rcS
	fi
	# /run/shm (née /dev/shm) and /tmp are also managed exclusively
	# through mountall / fstab; remove from /etc/default/rcS
	if dpkg --compare-versions "$PREV_VER" lt-nl 2.88dsf-13.10ubuntu1
	then
		sed -i "/^RAMTMP=/d;/^RAMSHM=/d" /etc/default/rcS
	fi
fi

#
# In 2.86.ds1-7 the "single" script was moved.
# We have to remove the old links _before_ we install new ones.
#
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-7"
then
	update-rc.d -f single remove >/dev/null
fi

# In 2.86.ds1-16, the mtab.sh and hostname.sh scripts were moved.
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-16"
then
	update-rc.d -f mtab.sh remove >/dev/null
	update-rc.d -f hostname.sh remove >/dev/null
fi

# In 2.86.ds1-21, the sendsigs script were moved, and in 2.86.ds1-35
# it was moved back.
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-35"
then
	update-rc.d -f sendsigs remove >/dev/null
fi

#
# In 2.87dsf-2 the "mountoverflowtmp" script was dropped
# from runlevels 0 and 6.
# We have to remove the old links _before_ we install new ones.
#
if dpkg --compare-versions "$PREV_VER" lt "2.87dsf-2" ; then
	update-rc.d -f mountoverflowtmp remove >/dev/null
fi

# In 2.87dsf-4ubuntu2, we begin migrating to Upstart jobs, so all of
# these get removed.
if dpkg --compare-versions "$PREV_VER" le-nl "2.87dsf-4ubuntu2"
then
	update-rc.d -f hostname.sh remove >/dev/null 2>&1 || :
	update-rc.d -f mountkernfs.sh remove >/dev/null 2>&1 || :
	update-rc.d -f mountdevsubfs.sh remove >/dev/null 2>&1 || :
	update-rc.d -f checkroot.sh remove >/dev/null 2>&1 || :
	update-rc.d -f mtab.sh remove >/dev/null 2>&1 || :
	update-rc.d -f checkfs.sh remove >/dev/null 2>&1 || :
	update-rc.d -f mountall.sh remove >/dev/null 2>&1 || :
	update-rc.d -f mountall-bootclean.sh remove >/dev/null 2>&1 || :
	update-rc.d -f mountoverflowtmp remove >/dev/null 2>&1 || :
	update-rc.d -f mountnfs.sh remove >/dev/null 2>&1 || :
	update-rc.d -f mountnfs-bootclean.sh remove >/dev/null 2>&1 || :
	update-rc.d -f bootmisc.sh remove >/dev/null 2>&1 || :
	update-rc.d -f bootlogs remove >/dev/null 2>&1 || :
	update-rc.d -f rmnologin remove >/dev/null 2>&1 || :
fi


#
# Okay, we could do this with update-rc.d, but that would probably
# be pretty slow. This way we win some speed.
# DO NOT FOLLOW THIS EXAMPLE IN OTHER PACKAGES.
#
# Links in runlevel S
#
#update-rc.d bootlogd               start 05 S . >/dev/null || exit $?
update-rc.d urandom                start 55 S . start 30 0 6 . >/dev/null || exit $?
#
# Links in runlevels other than S
#
update-rc.d halt                   start 90 0 . >/dev/null || exit $?
update-rc.d reboot                 start 90 6 . >/dev/null || exit $?
update-rc.d umountroot             start 60 0 6 . >/dev/null || exit $?
update-rc.d umountfs               start 40 0 6 . >/dev/null || exit $?
update-rc.d umountnfs.sh           start 31 0 6 . >/dev/null || exit $?
update-rc.d sendsigs               start 20 0 6 . >/dev/null || exit $?

update-rc.d killprocs              start 30 1 . >/dev/null || exit $?
update-rc.d single                 start 90 1 . >/dev/null || exit $?
update-rc.d ondemand               start 99 2 3 4 5 . >/dev/null || exit $?
update-rc.d rc.local               start 99 2 3 4 5 . >/dev/null || exit $?
#update-rc.d stop-bootlogd-single   start 99 S . >/dev/null || exit $?
#update-rc.d stop-bootlogd          start 99 2 3 4 5 . >/dev/null || exit $?

#
# Remove scripts that were left behind by older glibc (<< 2.3.2.ds1-12)
# versions. We have the same functionality in mount{kern,devsub}fs.sh
#
#
# In 2.86.ds1-10 the "mountvirtfs" script was replaced by
# mountkernfs.sh and mountdevsubfs.sh.  It was removed completely in
# 2.86.ds1-16.
#
for F in mountkernfs devpts.sh mountvirtfs
do
	rm -f /etc/init.d/$F
	update-rc.d $F remove >/dev/null
done

# Cleanup the broken shutdown sequence created by 3rd-party packages
# running insserv on an Ubuntu system. See LP #858122
if dpkg --compare-versions "$2" lt-nl 2.88dsf-13.10ubuntu11 &&
    ( [ -e /etc/rc6.d/S01reboot ] ||
        [ -e /etc/rc6.d/S02reboot ] ||
        [ -e /etc/rc6.d/S03reboot ] ); then
    [ -e /etc/rc0.d/S0*halt ] && mv /etc/rc0.d/S0*halt /etc/rc0.d/S90halt
    [ -e /etc/rc0.d/S0*umountroot ] && mv /etc/rc0.d/S0*umountroot /etc/rc0.d/S60umountroot
    [ -e /etc/rc0.d/S0*umountnfs.sh ] && mv /etc/rc0.d/S0*umountnfs.sh /etc/rc0.d/S31umountnfs.sh
    [ -e /etc/rc0.d/S0*umountfs ] && mv /etc/rc0.d/S0*umountfs /etc/rc0.d/S40umountfs
    [ -e /etc/rc0.d/S0*sendsigs ] && mv /etc/rc0.d/S0*sendsigs /etc/rc0.d/S20sendsigs

    [ -e /etc/rc6.d/S0*reboot ] && mv /etc/rc6.d/S0*reboot /etc/rc6.d/S90reboot
    [ -e /etc/rc6.d/S0*umountroot ] && mv /etc/rc6.d/S0*umountroot /etc/rc6.d/S60umountroot
    [ -e /etc/rc6.d/S0*umountnfs.sh ] && mv /etc/rc6.d/S0*umountnfs.sh /etc/rc6.d/S31umountnfs.sh
    [ -e /etc/rc6.d/S0*umountfs ] && mv /etc/rc6.d/S0*umountfs /etc/rc6.d/S40umountfs
    [ -e /etc/rc6.d/S0*sendsigs ] && mv /etc/rc6.d/S0*sendsigs /etc/rc6.d/S20sendsigs
fi

#
# Setup /run if not already in use.  Note that the intent here is to
# make the existing /var/run and /var/lock available as /run,
# /run/lock, respectively.  When the system is next restarted, a
# proper /run tmpfs will be set up.  The bind mounts set up here are
# intended to recreate the directory hierarchy using the existing
# locations in order that packages may transition to using /run
# without a system restart.
#

# Special case /run/motd, which will have been created on upgrade by
# the premature base-files transition.
if dpkg --compare-versions "$2" lt-nl 2.88dsf-13.10ubuntu1 && [ -e /run/motd ]
then
	rm -f /run/motd
fi

# If in a chroot or vserver environment (i.e. a guest, which does not
# run rcS scripts), do not do any messing around with mounts, and
# don't migrate /var/run, /var/lock or /dev/shm.  Bind mounting would
# not work in a chroot, because the migration would only be
# temporary--the rcS scripts are not guaranteed to run, so we must do
# the migration by hand at this point.  We create symlinks from the
# new locations to the old locations, which should be safe.  The
# sysadmin should, if they care, move the old locations to the new
# locations and create compatibilty symlinks at their convenience
# following the upgrade.
if ischroot; then
	# Symlink /var/run from /run
        # Note var/run is relative
	if compat_link /var/run /run; then
		# Symlink /var/lock from /run/lock
		# Note that it's really /var/run/lock
		compat_link /var/lock /run/lock

		# Symlink /dev/shm from /run/shm
		# Note that it's really /var/run/shm
		compat_link /dev/shm /run/shm
	fi
# Host system, not a chroot.
else
	if bind_mount /var/run /run; then
		bind_mount /var/lock /run/lock
		bind_mount /dev/shm /run/shm
	fi

	echo "Please reboot to complete migration to tmpfs-based /run" > /run/.run-transition
fi

#
# When installing for the first time or upgrading from a version
# before or equal to 2.88dsf-14, a reboot is needed to make the /run
# tmpfs available.  Flag this using notify-reboot-required.  /run is
# available in some form before the reboot, so the need for a reboot
# isn't particularly urgent.
#
if dpkg --compare-versions "$PREV_VER" le "2.88dsf-13.3" \
 && [ -x /usr/share/update-notifier/notify-reboot-required ]; then
	/usr/share/update-notifier/notify-reboot-required
fi

#
# Create mount point for spufs, and create spu system group
#
if mountpoint -q /proc && grep -qs '^cpu.*Cell' /proc/cpuinfo; then
       if ! getent group spu >/dev/null; then
	       # the adduser package is priority important; cannot use addgroup
	       groupadd -K GID_MAX=1000 spu
       fi
       mkdir -p /spu
       if ! mountpoint -q /spu; then
	       # No need to fail configuration if this isn't possible. Mount
	       # will still display an error. See LP #261490 and #251593.
	       mount -t spufs -ogid=spu spufs /spu || true
       fi
fi

#
# Create initial log files
#
[ "$PREV_VER" ] || chmod 755 /var/log/fsck || :
for F in /var/log/dmesg /var/log/boot /var/log/fsck/checkroot /var/log/fsck/checkfs
do
	if [ ! -f "$F" ] && touch "$F" >/dev/null 2>&1
	then
		echo "(Nothing has been logged yet.)" >| "$F"
		chown root:adm "$F"
		chmod 640 "$F"
	fi
done

#
# Set up nologin symlink so that dynamic-login-disabling will work
# (when DELAYLOGIN is set to "yes")
#
if [ ! -L /etc/nologin ] && [ ! -e /etc/nologin ]
then
	rm -f /var/lib/initscripts/nologin
	ln -s /var/lib/initscripts/nologin /etc/nologin
fi

#
# Set up motd stuff, putting variable file in /var/run/
#
if [ -f /etc/motd.tail ] && \
   dpkg --compare-versions "$PREV_VER" lt "2.87dsf-4ubuntu19"
then
	# If the standard help-text from update-motd is found in the
	# /etc/motd.tail file, it has been created from the old /etc/motd
	# file during the initscripts 2.87dsf-4ubuntu18 postinst script,
	# so it should be removed. Give up if the help-text template
	# generator is missing or produces no output.
	help_text=$(/etc/update-motd.d/10-help-text 2>/dev/null || true)
	if [ -n "$help_text" ] && fgrep -q "$help_text" /etc/motd.tail
	then
		rm -f /etc/motd.tail
		# Rebuild the motd now that motd.tail has been fixed.
		run-parts --lsbsysinit /etc/update-motd.d > /var/run/motd.new \
			&& mv /var/run/motd.new /var/run/motd || true
	fi
fi
if [ ! -f /var/run/motd ]
then
	if [ -f /etc/motd ]
	then
		cat /etc/motd > /var/run/motd
	else
		:>/var/run/motd
	fi
fi
if [ ! -L /etc/motd ]
then
	[ -f /etc/default/rcS ] && . /etc/default/rcS
	if [ "$EDITMOTD" = no ]
	then
		cat /var/run/motd > /etc/motd.static
		ln -sf motd.static /etc/motd
	else
		ln -sf /var/run/motd /etc/motd
	fi
fi

#
# Mount kernel virtual filesystems...not.
# This causes problems in pbuilder.
#
#
#if [ -x /etc/init.d/mountkernfs.sh ]
#then
#	if which invoke-rc.d >/dev/null 2>&1
#	then
#		invoke-rc.d mountkernfs.sh start || :
#	else
#		/etc/init.d/mountkernfs.sh start
#	fi
#fi

#
# Create /dev/pts, /dev/shm directories
#
if [ "$(uname -s)" = Linux ]
then
	#
	# Only create /dev/{pts,shm} if /dev is on the
	# root file system. If some package has mounted a
	# seperate /dev (ramfs from udev, devfs) it is
	# responsible for the presence of those subdirs.
	# (it is OK for these to fail under fakechroot)
	#
	if ! mountpoint -q /dev
	then
		[ -d /dev/pts ] || { mkdir --mode=755 /dev/pts ; chown root:root /dev/pts || [ "$FAKECHROOT" = true ]; }
		[ -d /dev/shm ] || { mkdir --mode=755 /dev/shm ; chown root:root /dev/shm || [ "$FAKECHROOT" = true ]; }
	fi
fi

#
# Create /etc/rc.local on first time install and when upgrading from
# versions before "2.86.ds1-16"
#
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-16"
then
	if [ ! -e /etc/rc.local ]; then
		cat << EOF > /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0
EOF
		# make sure it's enabled by default.
		chmod 755 /etc/rc.local
	fi
fi



: