diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-10-17 12:05:58 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-10-17 12:05:58 +0000 |
commit | cf0702aad824914490c4d09d07407620fa9c1564 (patch) | |
tree | a6146d2312cf917e69b5338a5c6b44d34741e997 | |
parent | 98dc73958da432176dbae93e9050bad5553143f7 (diff) |
clarify significantly. in many situations, put more effort into remembering
previous answers to the questions, so that it is easier to abort and restart
the install script.
-rw-r--r-- | distrib/miniroot/install.sh | 197 | ||||
-rw-r--r-- | distrib/miniroot/install.sub | 82 |
2 files changed, 145 insertions, 134 deletions
diff --git a/distrib/miniroot/install.sh b/distrib/miniroot/install.sh index 5c87e7e0378..c24a1f753c9 100644 --- a/distrib/miniroot/install.sh +++ b/distrib/miniroot/install.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: install.sh,v 1.14 1997/10/17 04:20:59 deraadt Exp $ +# $OpenBSD: install.sh,v 1.15 1997/10/17 12:05:56 deraadt Exp $ # $NetBSD: install.sh,v 1.5.2.8 1996/08/27 18:15:05 gwr Exp $ # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -138,15 +138,9 @@ if [ "`df /`" = "`df /mnt`" ]; then # XXX ASSUMES THAT THE USER DOESN'T PROVIDE BOGUS INPUT. cat << \__get_filesystems_1 -You will now have the opportunity to enter filesystem information. -You will be prompted for device name and mount point (full path, -including the prepending '/' character). - -Note that these do not have to be in any particular order. You will -be given the opportunity to edit the resulting 'fstab' file before -any of the filesystems are mounted. At that time you will be able -to resolve any filesystem order dependencies. - +You will now have the opportunity to enter filesystem information. You will be +prompted for device name and mount point (full path, including the prepending +'/' character). (NOTE: these do not have to be in any particular order). __get_filesystems_1 echo "The following will be used for the root filesystem:" @@ -204,8 +198,9 @@ __get_filesystems_1 *) ;; esac - echo "" - echo "The next step will overwrite any existing data on:" + echo + echo "============================================================" + echo "The next step will overwrite any existing data on:" ( echo -n " " while read _device_name _junk; do @@ -231,7 +226,6 @@ __get_filesystems_1 ( while read _device_name _junk; do newfs /dev/r${_device_name} - echo "" done ) < ${FILESYSTEMS} else @@ -246,13 +240,10 @@ fi # root filesystem later. cat << \__network_config_1 -You will now be given the opportunity to configure the network. This will -be useful if you need to transfer the installation sets via FTP or NFS. -Even if you choose not to transfer installation sets that way, this -information will be preserved and copied into the new root filesystem. - -Note, enter all symbolic host names WITHOUT the domain name appended. -I.e. use 'hostname' NOT 'hostname.domain.name'. +You will now be given the opportunity to configure the network. This will be +useful if you need to transfer the installation sets via FTP, HTTP, or NFS. +Even if you choose not to transfer installation sets that way, this information +will be preserved and copied into the new root filesystem. __network_config_1 echo -n "Configure the network? [y] " @@ -260,17 +251,22 @@ getresp "y" case "$resp" in y*|Y*) resp="" # force at least one iteration - if [ -f /etc/myname ]; then - resp=`cat /etc/myname` + _nam="" + if [ -f /tmp/myname ]; then + _nam=`cat /tmp/myname` fi while [ "X${resp}" = X"" ]; do - echo -n "Enter system hostname (short form): [$resp] " - getresp "$resp" + echo -n "Enter system hostname (short form): [$_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: [$FQDN] " getresp "$FQDN" @@ -279,8 +275,12 @@ case "$resp" in configurenetwork - echo -n "Enter IP address of default route: [none] " - getresp "none" + resp="none" + if [ -f /tmp/mygate ]; then + resp=`cat /tmp/mygate` + 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 @@ -288,8 +288,13 @@ case "$resp" in fi fi - echo -n "Enter IP address of primary nameserver: [none] " - getresp "none" + resp="none" + if [ -f /tmp/resolv.conf ]; then + resp=`grep '^nameserver ' /tmp/resolv.conf | \ + sed -e 's/^nameserver //'` + fi + echo -n "Enter IP address of primary nameserver: [$resp] " + getresp "$resp" if [ "X${resp}" != X"none" ]; then echo "domain $FQDN" > /tmp/resolv.conf echo "nameserver $resp" >> /tmp/resolv.conf @@ -308,40 +313,34 @@ case "$resp" in esac fi - echo "" - echo "The host table is as follows:" - echo "" - cat /tmp/hosts - echo "" - echo "You may want to edit the host table in the event that" - echo "you are doing an NFS installation or an FTP installation" - echo "without a name server and want to refer to the server by" - echo "name rather than by its numeric ip address." - echo -n "Would you like to edit the host table with ${EDITOR}? [n] " - getresp "n" - case "$resp" in - y*|Y*) - ${EDITOR} /tmp/hosts - ;; - - *) - ;; - esac + if [ ! -f /tmp/resolv.conf.shadow ]; then + echo "" + echo "The host table is as follows:" + echo "" + cat /tmp/hosts + echo "" + echo "You may want to edit the host table in the event that" + echo "you are doing an NFS installation or an FTP installation" + echo "without a name server and want to refer to the server by" + echo "name rather than by its numeric ip address." + 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. -If you do change the default route, and wish for that change to carry over -to the installed system, execute the following command at the shell -prompt: - - echo <ip_address_of_gateway> > /tmp/mygate - -where <ip_address_of_gateway> is the IP address of the default router. - +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" @@ -359,46 +358,46 @@ __network_config_2 ;; esac -if [ "`df /`" = "`df /mnt`" ]; then - # Now that the network has been configured, it is safe to configure the - # fstab. - ( - while read _dev _mp; do - if [ "$_mp" = "/" ]; then - echo /dev/$_dev $_mp ffs rw 1 1 - else - echo /dev/$_dev $_mp ffs rw 1 2 - fi - done - ) < ${FILESYSTEMS} > /tmp/fstab - - echo "The fstab is configured as follows:" - echo "" - cat /tmp/fstab - cat << \__fstab_config_1 - -You may wish to edit the fstab. For example, you may need to resolve -dependencies in the order which the filesystems are mounted. You may -also wish to take this opportunity to place NFS mounts in the fstab. -This would be especially useful if you plan to keep '/usr' on an NFS -server. - -__fstab_config_1 - echo -n "Edit the fstab with ${EDITOR}? [n] " - getresp "n" - case "$resp" in - y*|Y*) - ${EDITOR} /tmp/fstab - ;; - - *) - ;; - esac - - echo "" - munge_fstab /tmp/fstab /tmp/fstab.shadow - mount_fs /tmp/fstab.shadow -fi +# XXX We no longer do the following. It is not neccessary. It can be done +# XXX after the install is complete. +# +#if [ "`df /`" = "`df /mnt`" ]; then +# # Now that the network has been configured, it is safe to configure the +# # fstab. +# ( +# while read _dev _mp; do +# if [ "$_mp" = "/" ]; then +# echo /dev/$_dev $_mp ffs rw 1 1 +# else +# echo /dev/$_dev $_mp ffs rw 1 2 +# fi +# done +# ) < ${FILESYSTEMS} > /tmp/fstab +# +# echo "The fstab is configured as follows:" +# echo "" +# cat /tmp/fstab +# cat << \__fstab_config_1 +# +#You may wish to edit the fstab. You may also wish to take this opportunity to +#place NFS mounts in the fstab (this would be especially useful if you plan to +#keep '/usr' on an NFS server. +#__fstab_config_1 +# echo -n "Edit the fstab with ${EDITOR}? [n] " +# getresp "n" +# case "$resp" in +# y*|Y*) +# ${EDITOR} /tmp/fstab +# ;; +# +# *) +# ;; +# esac +# +# echo "" +# munge_fstab /tmp/fstab /tmp/fstab.shadow +# mount_fs /tmp/fstab.shadow +#fi mount | while read line; do set -- $line diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index b5ebf450bbf..d7c934421a8 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: install.sub,v 1.43 1997/10/17 08:57:24 deraadt Exp $ +# $OpenBSD: install.sub,v 1.44 1997/10/17 12:05:57 deraadt Exp $ # $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $ # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -301,11 +301,9 @@ __get_reldir_1 getrootdisk() { cat << \__getrootdisk_1 -The installation program needs to know which disk to consider -the root disk. Note the unit number may be different than -the unit number you used in the boot program (especially on a -PC with multiple disk controllers). - +The installation program needs to know which disk to consider the root disk. +Note the unit number may be different than the unit number you used in the +boot program (especially on a PC with multiple disk controllers). Available disks are: __getrootdisk_1 @@ -329,7 +327,7 @@ labelmoredisks() { You may label the following disks: __labelmoredisks_1 - echo "$_DKDEVS" + echo " $_DKDEVS" echo "" echo -n "Label which disk? [done] " getresp "done" @@ -381,32 +379,41 @@ addifconfig() { configurenetwork() { local _ifsdone local _ifs + local _ouranswer + local _reprompt _IFS=`md_get_ifdevs` _ifsdone="" + _ouranswer="" + _reprompt=1 resp="" # force at least one iteration while [ "X${resp}" != X"done" ]; do - cat << \__configurenetwork_1 + if [ $_reprompt = 1 ]; then + cat << \__configurenetwork_1 You may configure the following network interfaces (the interfaces marked with [X] have been succesfully configured): __configurenetwork_1 - for _ifs in $_IFS; do - if isin $_ifs $_ifsdone ; then - echo -n "[X] " - else - echo -n " " - fi - echo $_ifs - done - echo "" - echo -n "Configure which interface? [done] " - getresp "done" + for _ifs in $_IFS; do + if isin $_ifs $_ifsdone ; then + echo -n " [X] " + else + echo -n " [ ] " + fi + echo $_ifs + done + echo "" + fi + echo -n "Configure which interface? (or, enter 'done') [$_ouranswer] " + getresp "$_ouranswer" case "$resp" in "done") ;; + "") + _reprompt=0 + ;; *) _ifs=$resp if isin $_ifs $_IFS ; then @@ -416,8 +423,11 @@ __configurenetwork_1 else echo "Invalid response: \"$resp\" is not in list" fi + _ouranswer="done" + _reprompt=1 ;; esac + done } @@ -464,9 +474,11 @@ configure_ifs() { done # Get netmask - resp="" # force one iteration + if [ "X${_interface_mask}" = X"" ]; then + _interface_mask=255.255.255.0 + fi while [ "X${resp}" = X"" ]; do - echo -n "Netmask (ie. 255.255.255.0)? [$_interface_mask] " + echo -n "Netmask ? [$_interface_mask] " getresp "$_interface_mask" _interface_mask=$resp done @@ -477,8 +489,7 @@ configure_ifs() { echo " -link0 BNC" echo " link0 -link1 AUI" echo " link0 link1 UTP" - echo "But please keep in mind not all drivers use flags like this." - echo "" + echo "(But please keep in mind not all drivers use flags like this)." echo -n "Additional link-layer arguments? [$_interface_extra] " getresp "$_interface_extra" if [ "X${resp}" != X"" ]; then @@ -611,15 +622,16 @@ install_url() { # Is this an ftp or http install? _url_type=$1; shift - echo "\nThis is an automated ${_url_type}-based installation process.\n"\ -"You will be asked several questions and then the\n"\ -"files will be retrieved iteratively via ftp(1).\n" + echo + echo "This is an automated ${_url_type}-based installation process. You will be asked" + echo "questions and then the files will be retrieved iteratively via ftp(1)." + echo # Proxy the connections? if [ "X${_proxy_host}" = X"" ]; then _proxy_host=none fi - echo -n "http/ftp proxy URL? (none if you do not use a proxy) [${_proxy_host}] " + echo -n "HTTP/FTP proxy URL? (if you use a proxy) [${_proxy_host}] " getresp "${_proxy_host}" if [ "X${resp}" = X"none" ]; then unset _proxy_host ftp_proxy http_proxy @@ -655,7 +667,7 @@ install_url() { # Get server IP address resp="" # force one iteration while [ "X${resp}" = X"" ]; do - eval echo -n "Server IP? [\$_${_url_type}_server_ip]\ " + eval echo -n "Server IP address or hostname? [\$_${_url_type}_server_ip]\ " eval getresp "\$_${_url_type}_server_ip" eval _${_url_type}_server_ip=$resp done @@ -777,10 +789,10 @@ install_url() { _next="" for _f in $_sets $_kernel ; do if isin $_f $_setsdone ; then - echo -n "[X] " + echo -n " [X] " _next="" else - echo -n " " + echo -n " [ ] " if [ -z "$_next" ]; then _next=$_f fi @@ -875,10 +887,10 @@ install_url() { _next="" for _f in $_failed_files ; do if isin $_f $_setsdone ; then - echo -n "[X] " + echo -n " [X] " _next="" else - echo -n " " + echo -n " [ ] " if [ -z "$_next" ]; then _next=$_f fi @@ -947,10 +959,10 @@ install_from_mounted_fs() { _next="" for _f in $_sets $_kernel ; do if isin $_f $_setsdone; then - echo -n "[X] " + echo -n " [X] " _next="" else - echo -n " " + echo -n " [ ] " if [ -z "$_next" ]; then _next=$_f fi @@ -1253,7 +1265,7 @@ install_nfs() { # Get the IP address of the server resp="" # force one iteration while [ "X${resp}" = X"" ]; do - echo -n "Server IP address? [${_nfs_server_ip}] " + echo -n "Server IP address or hostname? [${_nfs_server_ip}] " getresp "${_nfs_server_ip}" done _nfs_server_ip=$resp |