88 lines
2.1 KiB
Bash
88 lines
2.1 KiB
Bash
#!/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:
|