79 lines
2.7 KiB
Bash
79 lines
2.7 KiB
Bash
#!/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=$(mktemp)
|
|
chmod 644 "$NEW_XWRAPPER_CONFIG"
|
|
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:
|