Fri Mar 12 21:36:52 2010 UTC ()
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.


(martin)
diff -r1.3 -r1.4 src/distrib/sparc64/instfs/dot.profile

cvs diff -r1.3 -r1.4 src/distrib/sparc64/instfs/dot.profile (expand / switch to unified diff)

--- src/distrib/sparc64/instfs/dot.profile 2003/07/26 17:07:33 1.3
+++ src/distrib/sparc64/instfs/dot.profile 2010/03/12 21:36:52 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: dot.profile,v 1.3 2003/07/26 17:07:33 salo Exp $ 1# $NetBSD: dot.profile,v 1.4 2010/03/12 21:36:52 martin Exp $
2# 2#
3# Copyright (c) 1997 Perry E. Metzger 3# Copyright (c) 1997 Perry E. Metzger
4# Copyright (c) 1994 Christopher G. Demetriou 4# Copyright (c) 1994 Christopher G. Demetriou
5# All rights reserved. 5# All rights reserved.
6#  6#
7# Redistribution and use in source and binary forms, with or without 7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions 8# modification, are permitted provided that the following conditions
9# are met: 9# are met:
10# 1. Redistributions of source code must retain the above copyright 10# 1. Redistributions of source code must retain the above copyright
11# notice, this list of conditions and the following disclaimer. 11# notice, this list of conditions and the following disclaimer.
12# 2. Redistributions in binary form must reproduce the above copyright 12# 2. Redistributions in binary form must reproduce the above copyright
13# notice, this list of conditions and the following disclaimer in the 13# notice, this list of conditions and the following disclaimer in the
14# documentation and/or other materials provided with the distribution. 14# documentation and/or other materials provided with the distribution.
@@ -26,53 +26,76 @@ @@ -26,53 +26,76 @@
26# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 26# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33#  33#
34# <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>> 34# <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
35 35
36PATH=/sbin:/bin:/usr/bin:/usr/sbin:/ 36PATH=/sbin:/bin:/usr/bin:/usr/sbin:/
37export PATH 37export PATH
38 38
39TERM=sun 39# Check if we are on a framebuffer or on serial console and default
 40# the terminal type accordingly.
 41# There is no /var/db/dev.db, so sysctl might not map the devicename properly;
 42# ttyE0 is 90,0 -> 0x5a00
 43case $(sysctl kern.consdev 2>/dev/null) in
 44 kern.consdev\ =\ ttyE*|kern.consdev\ =\ 0x5a0*)
 45 TERM=wsvt25
 46 ;;
 47 *)
 48 TERM=vt220
 49 ;;
 50esac
 51
40export TERM 52export TERM
41HOME=/ 53HOME=/
42export HOME 54export HOME
43BLOCKSIZE=1k 55BLOCKSIZE=1k
44export BLOCKSIZE 56export BLOCKSIZE
45EDITOR=ed 57EDITOR=ed
46export EDITOR 58export EDITOR
47 59
48umask 022 60umask 022
49 61
50if [ "X${DONEPROFILE}" = "X" ]; then 62if [ "X${DONEPROFILE}" = "X" ]; then
51 DONEPROFILE=YES 63 DONEPROFILE=YES
52 export DONEPROFILE 64 export DONEPROFILE
53 65
54 # set up some sane defaults 66 # set up some sane defaults
55 echo 'erase ^?, werase ^W, kill ^U, intr ^C' 67 echo 'erase ^?, werase ^W, kill ^U, intr ^C'
56 stty newcrt werase ^W intr ^C kill ^U erase ^? 9600 68 stty newcrt werase ^W intr ^C kill ^U erase ^? 9600
57 echo '' 69 echo ''
58 70
59 echo 'If you are using a SUN type 4 keyboard, please enter "sun-type4".' 71 if [ $TERM != "wsvt25" ]; then
60 echo -n "Terminal type (just hit ENTER for '$TERM'): " 72 cat << "EOM"
61 read ans 73You are using a serial console, we do not know your terminal emulation.
62 if [ -n "$ans" ];then 74Please select one, typical values are:
63 TERM=$ans 75
 76 vt100
 77 ansi
 78 xterm
 79
 80EOM
 81 echo -n "Terminal type (just hit ENTER for '$TERM'): "
 82 read ans
 83 if [ -n "$ans" ];then
 84 TERM=$ans
 85 fi
64 fi 86 fi
65 87
66 # mount the kern_fs so that we can find the root device, and also 88 # mount the kern_fs so that we can find the root device, and also
67 # examine the dmesg state 89 # examine the dmesg state
68 mount -t kernfs /kern /kern 90 mount -t kernfs /kern /kern
69 91
70 # hack to get around bugs in kernfs's rootdev/rrootdev lookup. 92 # hack to get around bugs in kernfs's rootdev/rrootdev lookup.
71 ls -l /dev/* > /dev/null 2>&1 93 ls -l /dev/* > /dev/null 2>&1
72 94
73 # mount the ramdisk read write 95 # mount the ramdisk read write
74 mount -t ffs -u /kern/rootdev / 96 mount -t ffs -u /kern/rootdev /
75 97
76 # run the installation or upgrade script. 98 # run the installation or upgrade script.
77 sysinst 99 sysinst || {
 100 echo "Oops, something went wrong - we will try again"; exit; }
78fi 101fi