From e4ef8b1dd7cf182a54204d02517e40c41869beb2 Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 12 Mar 2010 21:36:52 +0000 Subject: [PATCH] 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. --- distrib/sparc64/instfs/dot.profile | 39 ++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/distrib/sparc64/instfs/dot.profile b/distrib/sparc64/instfs/dot.profile index d1f06203f627..37ae168c0288 100644 --- a/distrib/sparc64/instfs/dot.profile +++ b/distrib/sparc64/instfs/dot.profile @@ -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 @@ if [ "X${DONEPROFILE}" = "X" ]; then 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 @@ if [ "X${DONEPROFILE}" = "X" ]; then 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