diff options
Diffstat (limited to 'distrib/miniroot/install.sub')
-rw-r--r-- | distrib/miniroot/install.sub | 146 |
1 files changed, 145 insertions, 1 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 996f2c280e1..a84c05f6520 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: install.sub,v 1.139 1999/10/16 17:37:36 deraadt Exp $ +# $OpenBSD: install.sub,v 1.140 1999/10/16 19:01:22 deraadt Exp $ # $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $ # # Copyright (c) 1997,1998 Todd Miller, Theo de Raadt @@ -1841,10 +1841,12 @@ while [ X"${resp}" = X ]; do resp=d ;; f*|F*) + test -n "$_didnet" || donetconfig install_url -ftp resp=f ;; h*|H*) + test -n "$_didnet" || donetconfig install_url -http resp=h ;; @@ -1857,6 +1859,7 @@ while [ X"${resp}" = X ]; do resp=c ;; n*|N*) + test -n "$_didnet" || donetconfig if [ -n "$_have_nfs" ]; then install_nfs resp=n @@ -2045,3 +2048,144 @@ local _fstab=$1 echo "Done." ) < $_fstab } + +donetconfig() { + _didnet=1 + resp= # force at least one iteration + _nam= + if [ -f /tmp/myname ]; then + _nam=`cat /tmp/myname` + fi + while [ "X${resp}" = X"" ]; do + echo -n "Enter system hostname (short form, ie. \"foo\"): [$_nam] " + getresp "$_nam" + done + hostname $resp + echo $resp > /tmp/myname + + resp= # force at least one iteration + if [ -f /tmp/resolv.conf ]; then + FQDN=`grep '^domain ' /tmp/resolv.conf | \ + sed -e 's/^domain //'` + fi + while [ "X${resp}" = X"" ]; do + echo -n "Enter DNS domain name (ie. \"bar.com\"): [$FQDN] " + getresp "$FQDN" + done + FQDN=$resp + + echo + echo "If you have any devices being configured by a DHCP server" + echo "it is recommended that you do not enter a default route or" + echo "any name servers." + echo + + configurenetwork + + resp=`route -n show | + grep '^default' | + sed -e 's/^default //' -e 's/ .*//'` + if [ "X${resp}" = "X" ]; then + resp=none + if [ -f /tmp/mygate ]; then + resp=`cat /etc/mygate` + if [ "X${resp}" = "X" ]; then + resp="none"; + fi + fi + fi + echo -n "Enter IP address of default route: [$resp] " + getresp "$resp" + if [ "X${resp}" != X"none" ]; then + route delete default > /dev/null 2>&1 + if route add default $resp > /dev/null ; then + echo $resp > /tmp/mygate + fi + fi + + resp="none" + if [ -f /etc/resolv.conf ]; then + resp= + for n in `grep '^nameserver ' /etc/resolv.conf | \ + sed -e 's/^nameserver //'`; do + if [ "X${resp}" = "X" ]; then + resp="$n" + else + resp="$resp $n" + fi + done + elif [ -f /tmp/resolv.conf ]; then + resp= + for n in `grep '^nameserver ' /tmp/resolv.conf | \ + sed -e 's/^nameserver //'`; do + if [ "X${resp}" = "X" ]; then + resp="$n" + else + resp="$resp $n" + fi + done + fi + echo -n "Enter IP address of primary nameserver: [$resp] " + getresp "$resp" + if [ "X${resp}" != X"none" ]; then + echo "search $FQDN" > /tmp/resolv.conf + for n in `echo ${resp}`; do + echo "nameserver $n" >> /tmp/resolv.conf + done + echo "lookup file bind" >> /tmp/resolv.conf + + echo -n "Would you like to use the nameserver now? [y] " + getresp "y" + case "$resp" in + y*|Y*) + cp /tmp/resolv.conf \ + /tmp/resolv.conf.shadow + ;; + + *) + ;; + esac + fi + + if [ ! -f /tmp/resolv.conf.shadow ]; then + echo + echo "The host table is as follows:" + echo + cat /tmp/hosts + cat << __hosts_table_1 + +You may want to edit the host table in the event that you are doing an +NFS installation or an FTP installation without a name server and want +to refer to the server by name rather than by its numeric ip address. +__hosts_table_1 + echo -n "Would you like to edit the host table with ${EDITOR}? [n] " + getresp "n" + case "$resp" in + y*|Y*) + ${EDITOR} /tmp/hosts + ;; + + *) + ;; + esac + fi + + cat << \__network_config_2 + +You will now be given the opportunity to escape to the command shell to do +any additional network configuration you may need. This may include adding +additional routes, if needed. In addition, you might take this opportunity +to redo the default route in the event that it failed above. +__network_config_2 + echo -n "Escape to shell? [n] " + getresp "n" + case "$resp" in + y*|Y*) + echo "Type 'exit' to return to install." + sh + ;; + + *) + ;; + esac +} |