diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2004-06-26 20:10:18 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2004-06-26 20:10:18 +0000 |
commit | 8448eb08833ff433c4be90f418209a80b2bbbdc6 (patch) | |
tree | 98c00e44c31126d3f5b08869a5a4334c26aad29e /distrib/miniroot/install.sub | |
parent | 94a4f1b996950e2e079b5634fd2fbd2fdd07327a (diff) |
Allow change of default console to first serial device during install. Used in
i386 only at this time.
ok beck@ deraadt@
Diffstat (limited to 'distrib/miniroot/install.sub')
-rw-r--r-- | distrib/miniroot/install.sub | 63 |
1 files changed, 48 insertions, 15 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index f4380461277..7b33f9ed44f 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.342 2004/06/22 20:43:58 krw Exp $ +# $OpenBSD: install.sub,v 1.343 2004/06/26 20:10:17 krw Exp $ # $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $ # # Copyright (c) 1997-2004 Todd Miller, Theo de Raadt, Ken Westerback @@ -171,6 +171,22 @@ get_ifdevs() { | sed -ne 's/^\(.*\):.*/\1/p' } +# Get the first (lowest unit #) serial device if any, if MDSERIAL is set. +# NOTE: Only single digit serial devices (<dev>0 -> <dev>9) are looked for. +get_serialdev() { + local _devs _d _bd _td + + [[ -n $MDSERIAL ]] || exit + set -- $MDSERIAL + _d=$1 + _bd=$2 + _td=$3 + _devs=$(sed -ne "/^${_d}\([0-9]\) .*/s//\1/p" /var/run/dmesg.boot) + _devs=$(bsort $_devs) + set -- $_devs + echo "${_bd}${1} ${_td}${1}" +} + # Ask for a password, saving the input in $resp. # Display $1 as the prompt. # *Don't* allow the '!' options that ask does. @@ -397,9 +413,10 @@ __EOT makedev() { local _dev=$1 _node=/dev/r${1}c - # Don't need to make network interface devices nodes. If the device - # nodes exist, don't need to create them. - if isin $_dev $IFDEVS || [[ -c $_node ]] ; then + # Don't need to make network interface device nodes. If the device is + # just a number then ignore it. This is used when selecting a serial + # console speed. If the device node exists, don't need to create it. + if isin $_dev $IFDEVS || [[ -c $_node || -z ${_dev##+([0-9])} ]] ; then return 0 fi @@ -1638,19 +1655,34 @@ populateusrlocal() { } questions() { - ask_yn "Do you wish sshd(8) to be started by default?" yes + local _bd _td + + ask_yn "Start sshd(8) by default?" yes if [[ $resp == n ]]; then echo "sshd_flags=NO # disabled during install" \ > /mnt/etc/rc.conf.local fi - [[ -n $MDXAPERTURE ]] || return - - ask_yn "Do you expect to run the X Window System?" yes - if [[ $resp == y ]]; then - sed -e "/^#\(machdep\.allowaperture=${MDXAPERTURE}\)/s//\1 /" \ - /mnt/etc/sysctl.conf > /tmp/sysctl.conf + if [[ -n $MDXAPERTURE ]]; then + ask_yn "Do you expect to run the X Window System?" yes + if [[ $resp == y ]]; then + sed -e "/^#\(machdep\.allowaperture=${MDXAPERTURE}\)/s//\1 /" \ + /mnt/etc/sysctl.conf > /tmp/sysctl.conf + fi fi + + [[ -z $SERIALDEV ]] && return + set -- $SERIALDEV + _bd=$1 + _td=$2 + ask_yn "Change the default console to $_bd?" + [[ $resp == n ]] && return + echo "set tty $_bd" >>/mnt/etc/boot.conf + ask_which "speed" "should $_bd use" "9600 19200 38400 57600 115200" 9600 + [[ $resp == done ]] && return + sed -e "/^${_td}/s/std.9600/std.${resp}/" \ + -e "/^${_td}/s/unknown/vt220 /" \ + -e "/${_td}/s/off/on secure/" /mnt/etc/ttys >/tmp/ttys } finish_up() { @@ -1727,10 +1759,11 @@ done # Extract and save one boot's worth of dmesg dmesg | sed -ne '/^OpenBSD /h;/^OpenBSD /!H;${g;p;}' > /var/run/dmesg.boot -# Scan /var/run/dmesg.boot for disks and cds -DKDEVS=`get_dkdevs` -CDDEVS=`get_cddevs` -IFDEVS=`get_ifdevs` +# Scan /var/run/dmesg.boot for interesting devices. +DKDEVS=$(get_dkdevs) +CDDEVS=$(get_cddevs) +IFDEVS=$(get_ifdevs) +SERIALDEV=$(get_serialdev) # Devices created with makedev(). DEVSMADE= |