This patch should fix the issue by wrapping the grep and subsequent
$? test with set +e and set -e.

It also adds a check for VT in screensaver setup, which has also sense
only in the console.

-- 
Jindrich Makovicka
--- console-screen.sh.orig	2009-12-19 20:27:00.000000000 +0100
+++ console-screen.sh	2010-01-07 11:24:54.182001990 +0100
@@ -63,6 +63,20 @@
 fi
 
 
+# Detect the console type
+VT="no"
+CONSOLE_TYPE=`fgconsole 2>/dev/null` || CONSOLE_TYPE="unknown"
+if [ ! $CONSOLE_TYPE = "serial" ]  ; then
+    set +e
+    readlink /proc/self/fd/0 | grep -q -e /dev/vc -e '/dev/tty[^p]' -e /dev/console
+    if [ $? -eq 0 ] ; then
+        VT="yes"
+    fi
+    set -e
+fi
+
+
+
 reset_vga_palette ()
 {
 	if [ -f /proc/fb ]; then
@@ -77,20 +91,10 @@
     # be sure the main program is installed
     [ -x "${SETFONT}" ] || return 0
 
-    VT="no"
-    # If we can't access the console, quit
-    CONSOLE_TYPE=`fgconsole 2>/dev/null` || return 0
-
-    if [ ! $CONSOLE_TYPE = "serial" ]  ; then
-	readlink /proc/self/fd/0 | grep -q -e /dev/vc -e '/dev/tty[^p]' -e /dev/console
-	if [ $? -eq 0 ] ; then
-	    VT="yes"
-	    reset_vga_palette
-	fi
-    fi
-
     [ $VT = "no" ] && return 0
 
+    reset_vga_palette
+
     # start vcstime
     if [ "${DO_VCSTIME}" = "yes" -a -x ${VCSTIME} ] ; then
 	[ "$VERBOSE" != "no" ] && log_action_begin_msg "Starting clock on text console"
@@ -181,6 +185,9 @@
 }
 
 setup_screensaver() {
+
+    [ $VT = "no" ] && return 0
+
     # screensaver stuff
     setterm_args=""
     if [ "$BLANK_TIME" ]; then

Reply via email to