File: xserver-xorg-legacy.config

package info (click to toggle)
xorg-server 2%3A1.20.11-1%2Bdeb11u13
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 41,928 kB
  • sloc: ansic: 372,544; xml: 17,683; sh: 5,358; makefile: 3,323; objc: 3,244; python: 514; yacc: 483; cpp: 479; lex: 281; asm: 214; awk: 52; perl: 5
file content (87 lines) | stat: -rw-r--r-- 2,153 bytes parent folder | download | duplicates (6)
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
84
85
86
87
#!/bin/sh
# Debian x11-common package configuration script
# Copyright 2000--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>.

set -e

# source debconf library
. /usr/share/debconf/confmodule

THIS_PACKAGE=xserver-xorg-legacy
THIS_SCRIPT=config

CONFIG_DIR=/etc/X11
XWRAPPER_CONFIG="$CONFIG_DIR/Xwrapper.config"

allowed_users_english_to_actual () {
  case "$1" in
    "Root Only")
      echo "rootonly"
      ;;
    "Console Users Only")
      echo "console"
      ;;
    "Anybody")
      echo "anybody"
      ;;
    *)
      # garbage input; return default
      echo "allowed_users_english_to_actual(): unrecognized input \"$1\";" \
           "using default" >&2
      echo "console"
      ;;
  esac
}

allowed_users_actual_to_english () {
  case "$1" in
    "rootonly")
      echo "Root Only"
      ;;
    "console")
      echo "Console Users Only"
      ;;
    "anybody")
      echo "Anybody"
      ;;
    *)
      # garbage input; return default
      echo "allowed_users_actual_to_english(): unrecognized input \"$1\";" \
           "using default" >&2
      echo "Console Users Only"
      ;;
  esac
}

CURRENT_ALLOWED_USERS=

# scan the X wrapper config file for existing settings, if it exists
if [ -e "$XWRAPPER_CONFIG" ]; then
  if MATCHES=$(grep "^allowed_users=.\+" "$XWRAPPER_CONFIG"); then
    CURRENT_ALLOWED_USERS=$(echo "${MATCHES##*=}" | head -n 1)
  fi
fi

if [ -n "$CURRENT_ALLOWED_USERS" ]; then
  echo "setting xserver-xorg-legacy/xwrapper/allowed_users from configuration" \
       "file" >&2
  db_set xserver-xorg-legacy/xwrapper/allowed_users \
                      $(allowed_users_actual_to_english \
                      "$CURRENT_ALLOWED_USERS")
fi

db_input low xserver-xorg-legacy/xwrapper/allowed_users || test $? = 30
db_go

RET=
if db_get xserver-xorg-legacy/xwrapper/allowed_users; then
  if [ -n "$RET" ]; then
    db_set xserver-xorg-legacy/xwrapper/actual_allowed_users \
                        $(allowed_users_english_to_actual "$RET")
  fi
fi
exit 0

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