Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/sparc64/instfs Use sysctl kern.consdev to check weth...



details:   https://anonhg.NetBSD.org/src/rev/7efdb016052a
branches:  trunk
changeset: 752949:7efdb016052a
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Mar 12 21:36:52 2010 +0000

description:
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.

diffstat:

 distrib/sparc64/instfs/dot.profile |  39 ++++++++++++++++++++++++++++++-------
 1 files changed, 31 insertions(+), 8 deletions(-)

diffs (65 lines):

diff -r 51cab9f9fde2 -r 7efdb016052a distrib/sparc64/instfs/dot.profile
--- a/distrib/sparc64/instfs/dot.profile        Fri Mar 12 19:03:14 2010 +0000
+++ b/distrib/sparc64/instfs/dot.profile        Fri Mar 12 21:36:52 2010 +0000
@@ -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



Home | Main Index | Thread Index | Old Index