This file is indexed.

postinst is in alsa-base 1.0.25+dfsg-0ubuntu5.

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
#!/bin/sh

set -e

MYNAME="$0"

# $* message
warn() { echo "${MYNAME}: Warning: $*" >&2 ; }

# $* message
report_error() { echo "${MYNAME}: Error: $*" >&2 ; }

# Move a conffile without triggering a dpkg question
mv_conffile() {
    OLDCONFFILE="$1"
    NEWCONFFILE="$2"

    if [ -e "$OLDCONFFILE" ]; then
        echo "Preserving user changes to $NEWCONFFILE"
        mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new
        mv -f "$OLDCONFFILE" "$NEWCONFFILE"
    elif [ -e "$OLDCONFFILE".dpkg-bak ]; then
        rm -f "$OLDCONFFILE".dpkg-bak
    fi
}

case "$1" in
configure|reconfigure)
	if dpkg --compare-versions "$2" lt "1.0.23+dfsg-1ubuntu4"; then
		mv_conffile /etc/modprobe.d/alsa-base \
			    /etc/modprobe.d/alsa-base.conf
		mv_conffile /etc/modprobe.d/blacklist-modem \
			    /etc/modprobe.d/blacklist-modem.conf
	fi
	# Decide which conf file to read
	conf_file=""
	if [ -f /etc/default/alsa ] ; then
		conf_file=/etc/default/alsa
	elif [ -f /usr/share/alsa-base/alsa.default ] ; then
		conf_file=/usr/share/alsa-base/alsa.default
	else
		report_error "No configuration file found"
		exit 1
	fi
	# Read variables from conf file
	force_unload_modules_before_suspend="$( 
		. "$conf_file" >/dev/null 2>&1
		echo "$force_unload_modules_before_suspend"
	)"
	# Write new conf file
	cat /usr/share/alsa-base/alsa.default | sed \
		-e "s/force_unload_modules_before_suspend=.*/force_unload_modules_before_suspend=\"${force_unload_modules_before_suspend}\"/" \
		> /etc/default/alsa
	# Set up apm symlinks
	[ -f /etc/apm/scripts.d/alsa ] || warn "/etc/apm/scripts.d/alsa is absent"
	# $1: file to check
	already_linked_to_alsa()
	{
		[ "$1" ] || return 1
		[ -L "$1" ] || return 1
		[ "$(basename "$(readlink "$1")")" = alsa ] || return 1
		return 0
	}
	ALREADY_LINKED=no
	for F in /etc/apm/suspend.d/??alsa ; do
		already_linked_to_alsa "$F" && ALREADY_LINKED=yes && break
	done
	[ "$ALREADY_LINKED" = yes ] || ln -sf ../scripts.d/alsa /etc/apm/suspend.d/80alsa
	ALREADY_LINKED=no
	for F in /etc/apm/resume.d/??alsa ; do
		already_linked_to_alsa "$F" && ALREADY_LINKED=yes && break
	done
	[ "$ALREADY_LINKED" = yes ] || ln -sf ../scripts.d/alsa /etc/apm/resume.d/20alsa
	;;
abort-upgrade|abort-remove|abort-deconfigure)
	# We don't have to do anything because we didn't do anything in prerm
	exit 0
	;;
*)
	echo "postinst called with unknown argument \`$1'" >&2
	exit 1
	;;
esac