#!/bin/sh # Debian xserver-xorg package post-installation script # Copyright 1998-2004 Branden Robinson. # Copyright 2004-2005 Canonical Ltd. # Licensed under the GNU General Public License, version 2. See the file # /usr/share/common-licenses/GPL or . # Acknowledgements to Stephen Early, Mark Eichin, and Manoj Srivastava. set -e # source debconf library . /usr/share/debconf/confmodule THIS_PACKAGE=xserver-xorg THIS_SCRIPT=postinst #INCLUDE_SHELL_LIB# if [ -e /etc/default/xorg ]; then . /etc/default/xorg fi # the error-out function bomb () { echo "$PROGNAME: error: $*" | fold -s -w "${COLUMNS:-80}" >&2 exit 1 } debug_echo () { # Syntax: debug_echo message ... if [ -n "$DEBUG_XORG_DEBCONF" ] || [ "$DEBCONF_DEBUG" = "user" ] \ || [ "$DEBCONF_DEBUG" = '.*' ]; then DEBUG_XORG_PACKAGE="yes" observe "$*" fi } CONFIG_DIR="/etc/X11" CONFIG_AUX_DIR=/var/lib/x11 SERVER_SYMLINK="$CONFIG_DIR/X" XORGCONFIG="$CONFIG_DIR/xorg.conf" CONFIG_AUX_DIR="/var/lib/x11" SERVER_SYMLINK_CHECKSUM="$CONFIG_AUX_DIR/${SERVER_SYMLINK##*/}.md5sum" SERVER_SYMLINK_ROSTER="$CONFIG_AUX_DIR/${SERVER_SYMLINK##*/}.roster" XORGCONFIG_CHECKSUM="$CONFIG_AUX_DIR/${XORGCONFIG##*/}.md5sum" XORGCONFIG_ROSTER="$CONFIG_AUX_DIR/${XORGCONFIG##*/}.roster" THIS_SERVER=/usr/bin/Xorg debug_report_status () { # Syntax: debug_report_status command exit_status debug_echo "$1 exited with status $2" } debug_echo "Configuring $THIS_PACKAGE." #DEBHELPER# # only mess with the server symlink file if it does not exist. otherwise, # assume that's the way the user wants it. if ! [ -e "$SERVER_SYMLINK" ]; then ln -s "$THIS_SERVER" "$SERVER_SYMLINK" # recover from an old bug elif [ `readlink "$SERVER_SYMLINK"` = "/bin/true" ]; then rm -f "$SERVER_SYMLINK" ln -s "$THIS_SERVER" "$SERVER_SYMLINK" fi if [ -n "$UPGRADE" ]; then if dpkg --compare-versions "$2" le "1:7.3+5"; then # Clean up our old crap for QUESTION in "shared/default-x-server" \ "xserver-xorg/autodetect_mouse" \ "xserver-xorg/autodetect_monitor" \ "xserver-xorg/autodetect_video_card" \ "xserver-xorg/config/device/identifier" \ "xserver-xorg/config/monitor/selection-method" \ "xserver-xorg/config/monitor/screen-size" \ "xserver-xorg/config/monitor/mode-list" \ "xserver-xorg/config/monitor/default-identifier" \ "xserver-xorg/config/monitor/horiz-sync" \ "xserver-xorg/config/monitor/vert-refresh" \ "xserver-xorg/config/monitor/range_input_error" \ "xserver-xorg/config/display/modes" \ "xserver-xorg/config/device/video_ram" \ "xserver-xorg/config/display/default_depth" \ "xserver-xorg/config/inputdevice/mouse/port" \ "xserver-xorg/config/inputdevice/mouse/protocol" \ "xserver-xorg/config/inputdevice/mouse/emulate3buttons" \ "xserver-xorg/config/modules" \ "xserver-xorg/config/monitor/default-identifier" \ "xserver-xorg/config/monitor/identifier" \ "xserver-xorg/config/write_files_section" \ "xserver-xorg/multiple_possible_x-drivers"; do db_unregister "$QUESTION" || true done fi if dpkg --compare-versions "$2" lt-nl 1:7.4; then for QUESTION in \ xserver-xorg/config/null_string_error \ xserver-xorg/config/doublequote_in_string_error \ xserver-xorg/config/nonnumeric_string_error \ xserver-xorg/config/device/use_fbdev \ xserver-xorg/config/device/driver \ xserver-xorg/config/inputdevice/keyboard/rules \ xserver-xorg/config/inputdevice/keyboard/model \ xserver-xorg/config/inputdevice/keyboard/layout \ xserver-xorg/config/inputdevice/keyboard/variant \ xserver-xorg/config/inputdevice/keyboard/options \ xserver-xorg/autodetect_keyboard; do db_unregister $QUESTION || true done fi if dpkg --compare-versions "$2" lt-nl 1:7.4+2; then db_unregister xserver-xorg/config/device/bus_id || true db_unregister xserver-xorg/config/device/bus_id_error || true rm -f "$XORGCONFIG_ROSTER" "$XORGCONFIG_CHECKSUM" rm -f "$SERVER_SYMLINK_CHECKSUM" "$SERVER_SYMLINK_ROSTER" fi fi if dpkg --compare-versions "$2" lt-nl "1:7.4~3"; then # We're upgrading from pre-7.4. We need to replace i810 with intel, and # via with openchrome. if [ -e "$XORGCONFIG" ]; then LC_ALL=C sed -e' /^[[:space:]]*Section[[:space:]]\+"Device"[[:space:]]*$/I,/^[[:space:]]*EndSection[[:space:]]*$/I { /^[[:space:]]*Driver[[:space:]]\+"i810"/I s/i810/intel/I /^[[:space:]]*Driver[[:space:]]\+"via"/I s/via/openchrome/I } ' $XORGCONFIG > ${XORGCONFIG}.madwizard-new if ! cmp -s $XORGCONFIG ${XORGCONFIG}.madwizard-new; then chown --reference=$XORGCONFIG ${XORGCONFIG}.madwizard-new chmod --reference=$XORGCONFIG ${XORGCONFIG}.madwizard-new mv ${XORGCONFIG}.madwizard-new $XORGCONFIG else rm ${XORGCONFIG}.madwizard-new fi fi fi get_hal_pid() { dbus-send --system --dest=org.freedesktop.DBus --print-reply \ /org/freedesktop/DBus org.freedesktop.DBus.GetConnectionUnixProcessID \ string:org.freedesktop.Hal 2>/dev/null | awk '/uint32/ {print $2}' } restart_hal() { # restart hald if it was running before pid=$(get_hal_pid) if [ -n "$pid" ]; then kill $pid 2>/dev/null || true lshal >/dev/null || true # will trigger through D-Bus activation fi } case "$1" in configure) if dpkg --compare-versions "$2" lt-nl "1:7.3+11"; then remove_conffile_commit "/etc/init.d/xserver-xorg" fi if dpkg --compare-versions "$2" lt-nl "1:7.3+13"; then update-rc.d xserver-xorg remove || true fi if dpkg --compare-versions "$2" lt "1:7.5~3"; then if [ `uname -s` = "GNU/kFreeBSD" ]; then restart_hal fi fi ;; esac db_stop exit 0 # vim:set ai et sts=2 sw=2 tw=0: