File: xserver-xorg-legacy.postinst

package info (click to toggle)
xorg-server 2:1.20.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 43,244 kB
  • sloc: ansic: 372,231; xml: 17,683; sh: 5,277; objc: 3,482; makefile: 3,285; python: 514; yacc: 483; cpp: 479; lex: 281; asm: 214; awk: 52; perl: 5
file content (77 lines) | stat: -rw-r--r-- 2,750 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
# Debian xserver-xorg-legacy package post-installation script
# Copyright 1998--2001, 2003 Branden Robinson.
# Licensed under the GNU General Public License, version 2.  See the file
# /usr/share/common-licenses/GPL or <https://www.gnu.org/copyleft/gpl.txt>.
# Acknowlegements to Stephen Early, Mark Eichin, and Manoj Srivastava.

set -e

. /usr/share/debconf/confmodule

THIS_PACKAGE=xserver-xorg-legacy
THIS_SCRIPT=postinst
CONFIG_DIR=/etc/X11
XWRAPPER_CONFIG="$CONFIG_DIR/Xwrapper.config"
CONFIG_AUX_DIR=/var/lib/x11
XWRAPPER_CONFIG_CHECKSUM_BASE="${XWRAPPER_CONFIG##*/}.md5sum"
XWRAPPER_CONFIG_CHECKSUM="$CONFIG_AUX_DIR/$XWRAPPER_CONFIG_CHECKSUM_BASE"
XWRAPPER_CONFIG_ROSTER_BASE="${XWRAPPER_CONFIG##*/}.roster"
XWRAPPER_CONFIG_ROSTER="$CONFIG_AUX_DIR/$XWRAPPER_CONFIG_ROSTER_BASE"

# only mess with config file it exists; otherwise, assume that's the way the
# user wants it, but only if upgrading
if [ -e "$XWRAPPER_CONFIG" ] || [ -z "$UPGRADE" ]; then
  ALLOWED_USERS=
  if db_get xserver-xorg-legacy/xwrapper/actual_allowed_users; then
    ALLOWED_USERS="$RET"
  fi
  if [ -n "$ALLOWED_USERS" ]; then
    NEW_XWRAPPER_CONFIG=$(tempfile -m 644)
    if ! [ -e "$XWRAPPER_CONFIG" ]; then
      cat >>"$NEW_XWRAPPER_CONFIG" << EOF
# Xwrapper.config (Debian X Window System server wrapper configuration file)
#
# This file was generated by the post-installation script of the
# xserver-xorg-legacy package using values from the debconf database.
#
# See the Xwrapper.config(5) manual page for more information.
#
# This file is automatically updated on upgrades of the xserver-xorg-legacy
# package *only* if it has not been modified since the last upgrade of that
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command as root:
#   dpkg-reconfigure xserver-xorg-legacy
allowed_users=$ALLOWED_USERS
EOF
    else
      sed -e '/^allowed_users.*/d' < "$XWRAPPER_CONFIG" > "$NEW_XWRAPPER_CONFIG"
      echo "allowed_users=$ALLOWED_USERS" >> "$NEW_XWRAPPER_CONFIG"
    fi
    if ! cmp -s "$XWRAPPER_CONFIG" "$NEW_XWRAPPER_CONFIG"; then
      cp "$NEW_XWRAPPER_CONFIG" "$XWRAPPER_CONFIG.dpkg-new"
      mv "$XWRAPPER_CONFIG.dpkg-new" "$XWRAPPER_CONFIG"
    fi
    rm -f "$NEW_XWRAPPER_CONFIG"
  else
    echo "not updating $XWRAPPER_CONFIG; problems communicating" \
         "with debconf database" >&2
  fi
else
  echo "not updating $XWRAPPER_CONFIG; file does not exist" >&2
fi

# get rid of obsolete X server wrapper config roster and checksum
if dpkg --compare-versions "$2" lt-nl 1:7.6~3; then
  rm -f "$XWRAPPER_CONFIG_ROSTER"
  rm -f "$XWRAPPER_CONFIG_CHECKSUM"
  rmdir "$CONFIG_AUX_DIR" 2>/dev/null || :
fi

#DEBHELPER#

exit 0

# vim:set ai et sts=2 sw=2 tw=80: