Debian Codegraph @

debian/gom.postinst

raw
1 #!/bin/sh -e
2 . /usr/share/debconf/confmodule
3
4 # Version <= 0.29.103-6 used this file, not /etc/default/gom. We just delete that silently.
5 no_auto_init_old=/etc/gom/NO_AUTO_INIT
6 if [ -e ${no_auto_init_old} ]; then
7 rm -f ${no_auto_init_old}
8 fi
9
10 CONFFILE="/etc/default/gom"
11 if [ ! -e $CONFFILE ] ; then
12 echo '# Use debconf to configure this file.' > $CONFFILE
13 echo 'auto_init="false"' >> $CONFFILE
14 echo 'valid_sound_devices="sound alsa"' >> $CONFFILE
15 fi
16
17 db_get gom/auto_init || true
18 auto_init="${RET}"
19 db_get gom/valid_sound_devices || true
20 valid_sound_devices="${RET}"
21
22 cp -a -f $CONFFILE $CONFFILE.tmp
23
24 # If the admin deleted or commented some variables but then set
25 # them via debconf, (re-)add them to the conffile.
26 test -z "$auto_init" || grep -Eq '^ *auto_init=' $CONFFILE || \
27 echo "auto_init=" >> $CONFFILE
28 test -z "$valid_sound_devices" || grep -Eq '^ *valid_sound_devices=' $CONFFILE || \
29 echo "valid_sound_devices=" >> $CONFFILE
30
31 sed -e "s/^ *auto_init=.*/auto_init=\"$auto_init\"/" \
32 -e "s/^ *valid_sound_devices=.*/valid_sound_devices=\"$valid_sound_devices\"/" \
33 < $CONFFILE > $CONFFILE.tmp
34 mv -f $CONFFILE.tmp $CONFFILE
35
36 #DEBHELPER#