#!/bin/sh set -e PKG=$(basename $0 | sed 's/\.config//') BASE=`echo $PKG | sed "s/^\(.*\)-[0-9]*x[0-9]*/\1/"` DEBCONF_DEBUG=developer XWININFO=/usr/X11R6/bin/xwininfo . /usr/share/debconf/confmodule db_version 2.0 # Just look for any previously set value first, because we do not use # a config file and debconf database is the only place the screen dimensions # are stored. This makes perfectly sense because changing a configuration # file helps nothing because the source images will be deleted in the end # of installation process db_get ${BASE}/resolution if [ _"$RET" != _"" ] ; then w=`echo $RET | sed "s/^\([0-9]\+\)x\([0-9]\+\)/\1/"` h=`echo $RET | sed "s/^\([0-9]\+\)x\([0-9]\+\)/\2/"` if [ "${w}x${h}" != $RET ] ; then # no valid resolution in debconf database # forget this value ... RET="" fi fi if [ _"$RET" = _"" ] ; then # get width and height of screen if [ -x $XWININFO ] ; then WIDTH=`$XWININFO -root | grep -w "Width:" | sed "s/^.*Width:[[:space:]]\+\([0-9]\+\)/\1/"` HEIGHT=`$XWININFO -root | grep -w "Height:" | sed "s/^.*Height:[[:space:]]\+\([0-9]\+\)/\1/"` RES="$WIDTH"x"$HEIGHT" if [ "$RES" != "x" ] ; then db_set ${BASE}/resolution "$RES" fi fi fi db_input medium ${BASE}/resolution || true db_go || true