X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=grml-x;h=89c483eee079c0635a773f2397d851168f6d4a3a;hb=b1a2676c2be999981a3c511d9ed55bca8933cfca;hp=32a3ed94c5eb564aa15e67fdcc4b30f0b6ded5bf;hpb=83ea499af14e0bb25eba2ead642f0fcb0e94042f;p=grml-x.git diff --git a/grml-x b/grml-x index 32a3ed9..89c483e 100755 --- a/grml-x +++ b/grml-x @@ -4,9 +4,16 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Don Jul 12 02:53:42 CEST 2007 [mika] +# Latest change: Die Sep 04 01:44:19 CEST 2007 [mika] ################################################################################ +# make sure /tmp is writeable {{{ + if ! [ -w /tmp ] ; then + echo 'Fatal: /tmp is not writeable. Can not resume therefore, sorry.' >&2 + exit 1 + fi +# }}} + # debugging {{{ # usage: DEBUG=1 grml-x ..... 2>/tmp/grml-x-debug.log if [[ $DEBUG -gt 0 ]]; then @@ -220,12 +227,20 @@ Just press Ctrl-C to cancel operation. # now calculate Virtual size for use with Xinerama HORIZ_RES1="$(grep 'Max. Resolution:' $MONITORINFO | sed 's/ Max\. Resolution: \(.*\)x\(.*\)/\1/')" VERIZ_RES1="$(grep 'Max. Resolution:' $MONITORINFO | sed 's/ Max\. Resolution: \(.*\)x\(.*\)/\2/')" + # it might happen that we don't have a Max Resolution in hwinfo output :-/ + # fall back to a generic value then... + # TODO: check out how to get resolution of external monitor from console + if [ -z "$HORIZ_RES1" ] ; then + HORIZ_RES1="1024" + VERIZ_RES1="768" + fi - HORIZ_RES2="$(echo $FRAMEBUFFER | sed 's/ Mode 0x.*: \(.*\)x.*/\1/')" - VERIZ_RES2="$(echo $FRAMEBUFFER | sed 's/ Mode 0x.*x\(.*\) (.*/\1/')" + # get maximum of output + HORIZ_RES2="$(echo $FRAMEBUFFER | grep 'Mode 0x' | sed 's/ Mode 0x.*: \(.*\)x.*/\1/'| sort -u | head -1)" + VERIZ_RES2="$(echo $FRAMEBUFFER | grep 'Mode 0x' | sed 's/ Mode 0x.*x\(.*\) (.*/\1/' | sort -u | head -1)" - if [ -n "$HORIZ_RES1" -a -n "$VERIZ_RES1" -a -n "$HORIZ_RES2" ] ; then - if [ $(echo $VERIZ_RES1 - $VERIZ_RES2 | bc -l) -eq 0 ] ; then + if [ -n "$HORIZ_RES1" -a -n "$VERIZ_RES1" -a -n "$HORIZ_RES2" -a -n "$VERIZ_RES2" ] ; then + if [ "$(echo $VERIZ_RES1" - "$VERIZ_RES2 | bc -l)" -eq 0 ] ; then VERIZ_RESULT="$VERIZ_RES1" elif [ "$VERIZ_RES1" -gt "$VERIZ_RES2" ] ; then VERIZ_RESULT="$VERIZ_RES1"