File: alsa-source.postinst

package info (click to toggle)
alsa-driver 1.0.8-7sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 15,840 kB
  • ctags: 43,253
  • sloc: ansic: 257,429; sh: 18,021; makefile: 1,741; perl: 1,316; python: 1,280; xml: 448; awk: 66
file content (59 lines) | stat: -rw-r--r-- 1,690 bytes parent folder | download
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
#!/bin/bash
# Bash required because /usr/share/debconf/confmodule uses "local" (#252094)

set -e

. /usr/share/debconf/confmodule
db_version 2.0

case "$1" in
configure|reconfigure)
	# Get ALSA_PNP
	db_get alsa-source/has_pnp
	if [ "$RET" = "false" ]; then
	    NOPNP=y
	fi
	# Get ALSA_DEBUG
	db_get alsa-source/debug
	if [ "$RET" = "true" ]; then
	    DEBUG=y
	fi
	# Get ALSA_CARDS
	db_get alsa-source/cards_to_be_built || :
	# Possible contents of RET:        Needed:
	#   all                              -> all
	#   foo (FOO)                        -> foo
	#   all, foo (FOO), ...              -> all
	#   foo (FOO), bar (BAR), baz (BAZ)  -> foo, bar, baz
	# Commas and percent signs are prohibited from the descriptions
	CARDS="$(
		echo "$RET" \
		| sed -e 's/\([^ ][^ ]*\) [^,]*,/\1,/g' \
		| sed -e 's/ (.*//' \
		| sed -e 's/^all,.*/all/'
	)"
	# Get ALSA_CARD_OPTIONS
	if [ -f /etc/alsa/alsa-source.conf ] ; then
		eval "$(grep -E '^[[:space:]]*ALSA_CARD_OPTIONS="[^"'"'"']*"[[:space:]]*$' /etc/alsa/alsa-source.conf)"
	fi
	# Write new /etc/alsa/alsa-source.conf
	[ -e /etc/alsa ] && [ ! -d /etc/alsa ] && rm -f /etc/alsa
	[ -d /etc/alsa ] || mkdir /etc/alsa
	sed -e "s%^ALSA_NOPNP=.*%ALSA_NOPNP=\"$NOPNP\"%" \
	    -e "s%^ALSA_DEBUG=.*%ALSA_DEBUG=\"$DEBUG\"%" \
	    -e "s%^ALSA_CARDS=.*%ALSA_CARDS=\"$CARDS\"%" \
	    -e "s%^ALSA_CARD_OPTIONS=.*%ALSA_CARD_OPTIONS=\"$ALSA_CARD_OPTIONS\"%" \
	    /usr/share/alsa-source/alsa-source.conf \
	    > /etc/alsa/alsa-source.conf
	;;
abort-upgrade|abort-remove|abort-deconfigure)
	: # Nothing to do because we didn't do anything in the prerm
	;;
*)
	echo "postinst called with unknown argument \`$1'" >&2;
	exit 1
	;;
esac

#DEBHELPER#