Module Name:    src
Committed By:   martin
Date:           Fri Mar 12 21:36:52 UTC 2010

Modified Files:
        src/distrib/sparc64/instfs: dot.profile

Log Message:
Use sysctl kern.consdev to check wether we use ttyE* as console - in that
case just set up TERM as needed and go straight to sysinst. Otherwise
give a slightly verbose explanation (with common sample values) and
ask for TERM before running sysinst.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/distrib/sparc64/instfs/dot.profile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sparc64/instfs/dot.profile
diff -u src/distrib/sparc64/instfs/dot.profile:1.3 src/distrib/sparc64/instfs/dot.profile:1.4
--- src/distrib/sparc64/instfs/dot.profile:1.3	Sat Jul 26 17:07:33 2003
+++ src/distrib/sparc64/instfs/dot.profile	Fri Mar 12 21:36:52 2010
@@ -1,4 +1,4 @@
-# $NetBSD: dot.profile,v 1.3 2003/07/26 17:07:33 salo Exp $
+# $NetBSD: dot.profile,v 1.4 2010/03/12 21:36:52 martin Exp $
 #
 # Copyright (c) 1997 Perry E. Metzger
 # Copyright (c) 1994 Christopher G. Demetriou
@@ -36,7 +36,19 @@
 PATH=/sbin:/bin:/usr/bin:/usr/sbin:/
 export PATH
 
-TERM=sun
+# Check if we are on a framebuffer or on serial console and default
+# the terminal type accordingly.
+# There is no /var/db/dev.db, so sysctl might not map the devicename properly;
+# ttyE0 is 90,0 -> 0x5a00
+case $(sysctl kern.consdev 2>/dev/null) in
+ kern.consdev\ =\ ttyE*|kern.consdev\ =\ 0x5a0*)
+   TERM=wsvt25
+   ;;
+ *)
+   TERM=vt220
+   ;;
+esac
+
 export TERM
 HOME=/
 export HOME
@@ -56,11 +68,21 @@
 	stty newcrt werase ^W intr ^C kill ^U erase ^? 9600
 	echo ''
 
-	echo 'If you are using a SUN type 4 keyboard, please enter "sun-type4".'
-	echo -n "Terminal type (just hit ENTER for '$TERM'): "
-	read ans
-	if [ -n "$ans" ];then
-	    TERM=$ans
+	if [ $TERM != "wsvt25" ]; then
+		cat << "EOM"
+You are using a serial console, we do not know your terminal emulation.
+Please select one, typical values are:
+
+	vt100
+	ansi
+	xterm
+
+EOM
+		echo -n "Terminal type (just hit ENTER for '$TERM'): "
+		read ans
+		if [ -n "$ans" ];then
+		    TERM=$ans
+		fi
 	fi
 
 	# mount the kern_fs so that we can find the root device, and also
@@ -74,5 +96,6 @@
 	mount -t ffs -u /kern/rootdev /
 
 	# run the installation or upgrade script.
-	sysinst
+	sysinst || {
+	    echo "Oops, something went wrong - we will try again"; exit; }
 fi

Reply via email to