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 | |
parent | 94a4f1b996950e2e079b5634fd2fbd2fdd07327a (diff) |
Allow change of default console to first serial device during install. Used in
i386 only at this time.
ok beck@ deraadt@
-rw-r--r-- | distrib/i386/common/install.md | 4 | ||||
-rw-r--r-- | distrib/miniroot/install.sh | 4 | ||||
-rw-r--r-- | distrib/miniroot/install.sub | 63 |
3 files changed, 53 insertions, 18 deletions
diff --git a/distrib/i386/common/install.md b/distrib/i386/common/install.md index bb1ab8c9710..158ee9629bc 100644 --- a/distrib/i386/common/install.md +++ b/distrib/i386/common/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.22 2004/03/03 02:19:26 krw Exp $ +# $OpenBSD: install.md,v 1.23 2004/06/26 20:10:17 krw Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -42,6 +42,8 @@ MDFSTYPE=msdos MDFSOPTS=-s MDXAPERTURE=2 +MDSERIAL="pccom com tty0" + ARCH=ARCH md_set_term() { diff --git a/distrib/miniroot/install.sh b/distrib/miniroot/install.sh index e619fcd5227..468b3af99cb 100644 --- a/distrib/miniroot/install.sh +++ b/distrib/miniroot/install.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: install.sh,v 1.143 2004/05/28 22:59:34 krw Exp $ +# $OpenBSD: install.sh,v 1.144 2004/06/26 20:10:17 krw Exp $ # $NetBSD: install.sh,v 1.5.2.8 1996/08/27 18:15:05 gwr Exp $ # # Copyright (c) 1997-2004 Todd Miller, Theo de Raadt, Ken Westerback @@ -411,7 +411,7 @@ save_comments dhclient.conf # Possible files: fstab, kbdtype, myname, mygate, sysctl.conf # dhclient.conf resolv.conf resolv.conf.tail # hostname.* hosts -for _f in fstab kbdtype my* *.conf *.tail host*; do +for _f in fstab kbdtype my* *.conf *.tail host* ttys; do [[ -f $_f ]] && mv $_f /mnt/etc/. done ) 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= |