File: tpb.postinst

package info (click to toggle)
tpb 0.6.4-11
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, stretch
  • size: 2,072 kB
  • ctags: 749
  • sloc: ansic: 6,789; sh: 3,442; yacc: 318; makefile: 303
file content (59 lines) | stat: -rw-r--r-- 1,314 bytes parent folder | download | duplicates (3)
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/sh

PACKAGE="tpb"
CONFIG="/etc/default/$PACKAGE"
CONFIG_OLD="/etc/X11/Xsession.d/90tpb"

set -e
. /usr/share/debconf/confmodule || exit 0

case "$1" in
  configure)

  getent group nvram >/dev/null || addgroup --system nvram

  if [ -e /dev/nvram ]; then
      chown root:nvram /dev/nvram
      chmod u+rw,g+r /dev/nvram
  fi

  # set option for autostart in /etc/X11/Xsession.d/90tpb
  if ! [ -f $CONFIG ]; then
    cat <<EOF > $CONFIG
# set this option to 'true' if you want to start tpb automatically after X has
# been started for a user. Otherwise set it to 'false'.
START_TPB=
EOF
  fi

  db_get $PACKAGE/autostart
  START_TPB=$RET

  # backup for $CONFIG with preserved ownership and permissions
  cp -a -f $CONFIG $CONFIG.tmp

  # re-insert values deleted in $CONFIG but existant in debconf
  test -z "$START_TPB" || grep -Eq '^ *START_TPB=' $CONFIG || echo "START_TPB=" >> $CONFIG

  # replace values of configuration variables in config file, preserving
  # all comments and other variables defined by the admin
  sed -e "
  s#^ *START_TPB=.*#START_TPB=\"$START_TPB\"#
  " < $CONFIG > $CONFIG.tmp
  mv -f $CONFIG.tmp $CONFIG
  ;;

  abort-upgrade|abort-remove|abort-deconfigure)

  ;;

  *)
  echo "postinst called with unknown argument \`$1'" >&2
  exit 1
  ;;
esac
db_stop

#DEBHELPER#

exit 0