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
88
89
90
91
92
93
94
95
96
97
98
99
|
#!/bin/sh
# Debian x11-common 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 <http://www.gnu.org/copyleft/gpl.txt>.
# Acknowlegements to Stephen Early, Mark Eichin, and Manoj Srivastava.
set -e
. /usr/share/debconf/confmodule
THIS_PACKAGE=x11-common
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"
#INCLUDE_SHELL_LIB#
# register this package as a (potential) handler of the X server wrapper
# config file
if ! fgrep -qsx "$THIS_PACKAGE" "$XWRAPPER_CONFIG_ROSTER"; then
echo "$THIS_PACKAGE" >> "$XWRAPPER_CONFIG_ROSTER"
fi
if ! [ -d "$CONFIG_AUX_DIR" ]; then
mkdir --mode=755 --parents "$CONFIG_AUX_DIR"
fi
# 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
# similarly, check for the existence of the checksum file; if it doesn't
# exist, assume that's the way the user wants it, but only if upgrading
if [ -e "$XWRAPPER_CONFIG_CHECKSUM" ] || [ -z "$UPGRADE" ]; then
# next, compare the current and stored checksums; if they do not match,
# assume that's the way the user wants it ... upgrading etc
if [ "$(md5sum "$XWRAPPER_CONFIG" 2>/dev/null)" = \
"$(cat "$XWRAPPER_CONFIG_CHECKSUM" 2>/dev/null)" ] || \
[ -z "$UPGRADE" ]; then
# they match; prepare a new version of the config file
ALLOWED_USERS=
if db_get x11-common/xwrapper/actual_allowed_users; then
ALLOWED_USERS="$RET"
fi
if [ -n "$ALLOWED_USERS" ]; then
NEW_XWRAPPER_CONFIG=$(tempfile)
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 x11-common
# 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 x11-common 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 x11-common
allowed_users=$ALLOWED_USERS
EOF
if ! cmp -s "$XWRAPPER_CONFIG" "$NEW_XWRAPPER_CONFIG"; then
cp "$NEW_XWRAPPER_CONFIG" "$XWRAPPER_CONFIG.dpkg-new"
mv "$XWRAPPER_CONFIG.dpkg-new" "$XWRAPPER_CONFIG"
md5sum "$XWRAPPER_CONFIG" > "$XWRAPPER_CONFIG_CHECKSUM"
fi
rm -f "$NEW_XWRAPPER_CONFIG"
else
observe "not updating $XWRAPPER_CONFIG; problems communicating" \
"with debconf database"
fi
else
observe "not updating $XWRAPPER_CONFIG; file has been customized"
fi
else
observe "not updating $XWRAPPER_CONFIG; no stored checksum available"
fi
else
observe "not updating $XWRAPPER_CONFIG; file does not exist"
fi
if dpkg --compare-versions "$2" lt-nl 1:7.4+2; then
db_unregister x11-common/xwrapper/nice_value || :
db_unregister x11-common/xwrapper/nice_value/error || :
db_unregister x11-common/upgrade_issues || :
db_unregister x11-common/x11r6_bin_not_empty || :
fi
#DEBHELPER#
exit 0
# vim:set ai et sts=2 sw=2 tw=80:
|