#!/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 <http://www.gnu.org/copyleft/gpl.txt>.
# Acknowledgements to Stephen Early, Mark Eichin, and Manoj Srivastava.

set -e

THIS_PACKAGE=xserver-xorg
THIS_SCRIPT=postinst

#INCLUDE_SHELL_LIB#

if [ -e /etc/default/xorg ]; then
  . /etc/default/xorg
fi

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

exit 0

# vim:set ai et sts=2 sw=2 tw=0:
