| 1 |
#!/bin/sh |
| 2 |
# Debian xserver-xorg-legacy package post-installation script |
| 3 |
# Copyright 1998--2001, 2003 Branden Robinson. |
| 4 |
# Licensed under the GNU General Public License, version 2. See the file |
| 5 |
# /usr/share/common-licenses/GPL or <https://www.gnu.org/copyleft/gpl.txt>. |
| 6 |
# Acknowlegements to Stephen Early, Mark Eichin, and Manoj Srivastava. |
| 7 |
|
| 8 |
set -e |
| 9 |
|
| 10 |
. /usr/share/debconf/confmodule |
| 11 |
|
| 12 |
THIS_PACKAGE=xserver-xorg-legacy |
| 13 |
THIS_SCRIPT=postinst |
| 14 |
CONFIG_DIR=/etc/X11 |
| 15 |
XWRAPPER_CONFIG="$CONFIG_DIR/Xwrapper.config" |
| 16 |
CONFIG_AUX_DIR=/var/lib/x11 |
| 17 |
XWRAPPER_CONFIG_CHECKSUM_BASE="${XWRAPPER_CONFIG##*/}.md5sum" |
| 18 |
XWRAPPER_CONFIG_CHECKSUM="$CONFIG_AUX_DIR/$XWRAPPER_CONFIG_CHECKSUM_BASE" |
| 19 |
XWRAPPER_CONFIG_ROSTER_BASE="${XWRAPPER_CONFIG##*/}.roster" |
| 20 |
XWRAPPER_CONFIG_ROSTER="$CONFIG_AUX_DIR/$XWRAPPER_CONFIG_ROSTER_BASE" |
| 21 |
|
| 22 |
# only mess with config file it exists; otherwise, assume that's the way the |
| 23 |
# user wants it, but only if upgrading |
| 24 |
if [ -e "$XWRAPPER_CONFIG" ] || [ -z "$UPGRADE" ]; then |
| 25 |
ALLOWED_USERS= |
| 26 |
if db_get xserver-xorg-legacy/xwrapper/actual_allowed_users; then |
| 27 |
ALLOWED_USERS="$RET" |
| 28 |
fi |
| 29 |
if [ -n "$ALLOWED_USERS" ]; then |
| 30 |
NEW_XWRAPPER_CONFIG=$(mktemp) |
| 31 |
chmod 644 "$NEW_XWRAPPER_CONFIG" |
| 32 |
if ! [ -e "$XWRAPPER_CONFIG" ]; then |
| 33 |
cat >>"$NEW_XWRAPPER_CONFIG" << EOF |
| 34 |
# Xwrapper.config (Debian X Window System server wrapper configuration file) |
| 35 |
# |
| 36 |
# This file was generated by the post-installation script of the |
| 37 |
# xserver-xorg-legacy package using values from the debconf database. |
| 38 |
# |
| 39 |
# See the Xwrapper.config(5) manual page for more information. |
| 40 |
# |
| 41 |
# This file is automatically updated on upgrades of the xserver-xorg-legacy |
| 42 |
# package *only* if it has not been modified since the last upgrade of that |
| 43 |
# package. |
| 44 |
# |
| 45 |
# If you have edited this file but would like it to be automatically updated |
| 46 |
# again, run the following command as root: |
| 47 |
# dpkg-reconfigure xserver-xorg-legacy |
| 48 |
allowed_users=$ALLOWED_USERS |
| 49 |
EOF |
| 50 |
else |
| 51 |
sed -e '/^allowed_users.*/d' < "$XWRAPPER_CONFIG" > "$NEW_XWRAPPER_CONFIG" |
| 52 |
echo "allowed_users=$ALLOWED_USERS" >> "$NEW_XWRAPPER_CONFIG" |
| 53 |
fi |
| 54 |
if ! cmp -s "$XWRAPPER_CONFIG" "$NEW_XWRAPPER_CONFIG"; then |
| 55 |
cp "$NEW_XWRAPPER_CONFIG" "$XWRAPPER_CONFIG.dpkg-new" |
| 56 |
mv "$XWRAPPER_CONFIG.dpkg-new" "$XWRAPPER_CONFIG" |
| 57 |
fi |
| 58 |
rm -f "$NEW_XWRAPPER_CONFIG" |
| 59 |
else |
| 60 |
echo "not updating $XWRAPPER_CONFIG; problems communicating" \ |
| 61 |
"with debconf database" >&2 |
| 62 |
fi |
| 63 |
else |
| 64 |
echo "not updating $XWRAPPER_CONFIG; file does not exist" >&2 |
| 65 |
fi |
| 66 |
|
| 67 |
# get rid of obsolete X server wrapper config roster and checksum |
| 68 |
if dpkg --compare-versions "$2" lt-nl 1:7.6~3; then |
| 69 |
rm -f "$XWRAPPER_CONFIG_ROSTER" |
| 70 |
rm -f "$XWRAPPER_CONFIG_CHECKSUM" |
| 71 |
rmdir "$CONFIG_AUX_DIR" 2>/dev/null || : |
| 72 |
fi |
| 73 |
|
| 74 |
#DEBHELPER# |
| 75 |
|
| 76 |
exit 0 |
| 77 |
|
| 78 |
# vim:set ai et sts=2 sw=2 tw=80: |