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.
This commit is contained in:
martin 2010-03-12 21:36:52 +00:00
parent 07188f89fa
commit e4ef8b1dd7
1 changed files with 31 additions and 8 deletions

View File

@ -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