diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2002-04-28 14:44:02 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2002-04-28 14:44:02 +0000 |
commit | f011e18a2c4c8d782605da6be8567531730cca40 (patch) | |
tree | 4503d6d69f6d44f4daf7d48703f0813f3d9912b0 | |
parent | 2f15e29fadc2bc35285820205ae7ff94f2d19be8 (diff) |
Change getresp() into ask().
ask() takes 2 parameters. The first one is the question to
ask the user, and the 2nd is the default answer.
Shrinks and makes the code clearer.
From espie@ with some tweaking, ok deraadt@.
-rw-r--r-- | distrib/alpha/common/install.md | 5 | ||||
-rw-r--r-- | distrib/hp300/ramdisk/install.md | 5 | ||||
-rw-r--r-- | distrib/i386/common/install.md | 20 | ||||
-rw-r--r-- | distrib/mac68k/ramdisk/install.md | 5 | ||||
-rw-r--r-- | distrib/macppc/ramdisk/install.md | 49 | ||||
-rw-r--r-- | distrib/miniroot/install.sh | 14 | ||||
-rw-r--r-- | distrib/miniroot/install.sub | 169 | ||||
-rw-r--r-- | distrib/miniroot/upgrade.sh | 17 | ||||
-rw-r--r-- | distrib/mvme68k/ramdisk/install.md | 15 | ||||
-rw-r--r-- | distrib/mvmeppc/ramdisk/install.md | 46 | ||||
-rw-r--r-- | distrib/sparc64/common/install.md | 8 |
11 files changed, 132 insertions, 221 deletions
diff --git a/distrib/alpha/common/install.md b/distrib/alpha/common/install.md index 674195921e0..4b414c90851 100644 --- a/distrib/alpha/common/install.md +++ b/distrib/alpha/common/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.4 2002/03/31 17:30:30 deraadt Exp $ +# $OpenBSD: install.md,v 1.5 2002/04/28 14:44:01 krw Exp $ # # Copyright (c) 1996 The NetBSD Foundation, Inc. # All rights reserved. @@ -44,8 +44,7 @@ ARCH=ARCH md_set_term() { test -n "$TERM" && return - echo -n "Specify terminal type [sun]: " - getresp sun + ask "Specify terminal type:" sun TERM=$resp export TERM } diff --git a/distrib/hp300/ramdisk/install.md b/distrib/hp300/ramdisk/install.md index 2490b55902b..36a1a948df9 100644 --- a/distrib/hp300/ramdisk/install.md +++ b/distrib/hp300/ramdisk/install.md @@ -1,6 +1,6 @@ #!/bin/sh # -# $OpenBSD: install.md,v 1.26 2002/04/25 21:28:13 miod Exp $ +# $OpenBSD: install.md,v 1.27 2002/04/28 14:44:01 krw Exp $ # $NetBSD: install.md,v 1.1.2.4 1996/08/26 15:45:14 gwr Exp $ # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -46,8 +46,7 @@ MDSETS=kernel ARCH=ARCH md_set_term() { - echo -n "Specify terminal type [hp300h]: " - getresp "hp300h" + ask "Specify terminal type:" hp300h TERM="$resp" export TERM } diff --git a/distrib/i386/common/install.md b/distrib/i386/common/install.md index 1a08aa16c98..aefb69642c7 100644 --- a/distrib/i386/common/install.md +++ b/distrib/i386/common/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.1 2002/04/22 02:40:02 deraadt Exp $ +# $OpenBSD: install.md,v 1.2 2002/04/28 14:44:01 krw Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -47,13 +47,11 @@ md_set_term() { local _tables test -n "$TERM" && return - echo -n "Specify terminal type [vt220]: " - getresp vt220 + ask "Specify terminal type:" vt220 TERM=$resp export TERM - echo -n "Do you wish to select a keyboard encoding table? [n] " - getresp n + ask "Do you wish to select a keyboard encoding table?" n case $resp in Y*|y*) ;; @@ -63,8 +61,7 @@ md_set_term() { resp= while : ; do - echo -n "Select your keyboard type: (P)C-AT/XT, (U)SB or 'done' [P] " - getresp P + ask "Select your keyboard type: (P)C-AT/XT, (U)SB or 'done'" P case $resp in P*|p*) _tables="be de dk es fr it jp lt no pt ru sf sg sv ua uk us" ;; @@ -88,8 +85,7 @@ The available keyboard encoding tables are: ${_tables} __EOT - echo -n "Table name? (or 'done') [us] " - getresp us + ask "Table name? (or 'done')" us case $resp in done) ;; *) if kbd $resp ; then @@ -121,8 +117,7 @@ md_get_partition_range() { md_questions() { echo - echo -n "Do you expect to run the X Window System? [y] " - getresp y + ask "Do you expect to run the X Window System?" y case "$resp" in y*|Y*) xfree86=y @@ -214,8 +209,7 @@ md_prep_disklabel() { local _disk=$1 - echo -n 'Do you want to use the *entire* disk for OpenBSD? [no] ' - getresp "no" + ask "Do you want to use the *entire* disk for OpenBSD?" no case $resp in y*|Y*) md_prep_fdisk ${_disk} Y ;; *) md_prep_fdisk ${_disk} ;; diff --git a/distrib/mac68k/ramdisk/install.md b/distrib/mac68k/ramdisk/install.md index 2e109fbfe1b..4099882e70c 100644 --- a/distrib/mac68k/ramdisk/install.md +++ b/distrib/mac68k/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.8 2002/04/24 22:33:41 miod Exp $ +# $OpenBSD: install.md,v 1.9 2002/04/28 14:44:01 krw Exp $ # # Copyright (c) 2002, Miodrag Vallat. # All rights reserved. @@ -70,8 +70,7 @@ md_set_term() { if [ ! -z "$TERM" ]; then return fi - echo -n "Specify terminal type [vt100]: " - getresp "vt100" + ask "Specify terminal type:" vt100 TERM="$resp" export TERM } diff --git a/distrib/macppc/ramdisk/install.md b/distrib/macppc/ramdisk/install.md index 323848d4805..13bd8aa1684 100644 --- a/distrib/macppc/ramdisk/install.md +++ b/distrib/macppc/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.8 2002/04/25 21:28:13 miod Exp $ +# $OpenBSD: install.md,v 1.9 2002/04/28 14:44:01 krw Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -45,8 +45,7 @@ ARCH=ARCH md_set_term() { test -n "$TERM" && return - echo -n "Specify terminal type [vt220]: " - getresp vt220 + ask "Specify terminal type:" vt220 TERM=$resp export TERM } @@ -68,8 +67,7 @@ md_get_partition_range() { md_questions() { echo - echo -n "Do you expect to run the X Window System? [y] " - getresp y + ask "Do you expect to run the X Window System?" y case "$resp" in y*|Y*) xfree86=y @@ -125,8 +123,7 @@ md_init_mbr() { echo "consult your PowerPC OpenFirmware manual -and- the" echo "PowerPC OpenBSD Installation Guide for doing setup this way." echo - echo -n "Do you want to init the MBR and the MSDOS partition? [y] " - getresp "y" + ask "Do you want to init the MBR and the MSDOS partition?" y case "$resp" in n*|N*) exit 0;; *) echo @@ -175,8 +172,7 @@ partitions on the disk, including the partition table. Choose the MBR option carefully, knowing this fact. __EOT - echo -n "Do you want to choose (H)FS labeling or (M)BR labeling [H] " - getresp "h" + ask "Do you want to choose (H)FS labeling or (M)BR labeling" H case "$resp" in m*|M*) export disklabeltype=MBR md_checkforMBRdisklabel $1 @@ -192,15 +188,13 @@ __EOT md_checkforMBRdisklabel() { echo "You have chosen to put a MBR disklabel on the disk." - echo -n "Is this correct? [n] " - getresp "n" + ask "Is this correct?" n case "$resp" in n*|N*) echo "aborting install" exit 0;; esac - echo -n "Have you initialized an MSDOS partition using OpenFirmware? [n] " - getresp "n" + ask "Have you initialized an MSDOS partition using OpenFirmware?" n case "$resp" in n*|N*) md_init_mbr $1;; *) cat << __EOT @@ -213,8 +207,7 @@ Also note that the boot partition must be included as partition 'i' in the OpenBSD disklabel. __EOT - echo -n "Do you want to keep the current MSDOS partition setup? [y]" - getresp "y" + ask "Do you want to keep the current MSDOS partition setup?" y case "$resp" in n*|N*) md_init_mbr $1;; esac @@ -254,14 +247,12 @@ WARNING: Wrong information in the BIOS partition table might render the disk unusable. __EOT - echo -n "Press [Enter] to continue " - getresp "" + ask "Press [Enter] to continue" echo echo "Current partition information is:" fdisk ${_disk} - echo -n "Press [Enter] to continue " - getresp "" + ask "Press [Enter] to continue" _done=0 while [ $_done = 0 ]; do @@ -279,8 +270,7 @@ If you make a mistake, simply exit fdisk without storing the new information, and you will be allowed to start over. __EOT echo - echo -n "Press [Enter] to continue " - getresp "" + ask "Press [Enter] to continue" fdisk -e ${_disk} @@ -291,8 +281,7 @@ __EOT echo echo "(You will be permitted to edit this information again.)" echo "-------------------------------------------------------" - echo -n "Is the above information correct? [n] " - getresp "n" + ask "Is the above information correct?" n case "$resp" in n*|N*) ;; @@ -306,8 +295,7 @@ __EOT echo "At least the MSDOS partition used for booting must be accessible" echo "by OpenBSD as partition 'i'. You may need this information to " echo "fill in the OpenBSD disk label later." - echo -n "Press [Enter] to continue " - getresp "" + ask "Press [Enter] to continue" } md_prep_disklabel() @@ -317,19 +305,18 @@ md_prep_disklabel() _disk=$1 md_checkfordisklabel $_disk case $? in - 0) echo -n "Do you wish to edit the disklabel on $_disk? [y] " + 0) ask "Do you wish to edit the disklabel on $_disk?" y ;; 1) md_prep_fdisk ${_disk} echo "WARNING: Disk $_disk has no label" - echo -n "Do you want to create one with the disklabel editor? [y] " + ask "Do you want to create one with the disklabel editor?" y ;; 2) echo "WARNING: Label on disk $_disk is corrupted" - echo -n "Do you want to try and repair the damage using the disklabel editor? [y] " + ask "Do you want to try and repair the damage using the disklabel editor?" y ;; esac - getresp "y" case "$resp" in y*|Y*) ;; *) return ;; @@ -362,8 +349,8 @@ Do not change any parameters except the partition layout and the label name. i: 10208 32 MSDOS # (Cyl. 0*- 11*) [End of example] __EOT - echo -n "Press [Enter] to continue " - getresp "" + ask "Press [Enter] to continue" + if [[ $disklabeltype = "HFS" ]] then disklabel -c -f /tmp/fstab.${_disk} -E ${_disk} diff --git a/distrib/miniroot/install.sh b/distrib/miniroot/install.sh index 007d02468e8..54d302729b8 100644 --- a/distrib/miniroot/install.sh +++ b/distrib/miniroot/install.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: install.sh,v 1.97 2002/04/26 02:14:23 krw Exp $ +# $OpenBSD: install.sh,v 1.98 2002/04/28 14:44:01 krw Exp $ # $NetBSD: install.sh,v 1.5.2.8 1996/08/27 18:15:05 gwr Exp $ # # Copyright (c) 1997-2002 Todd Miller, Theo de Raadt, Ken Westerback @@ -170,8 +170,7 @@ __EOT # Get the mount point from the user while : ; do - echo -n "Mount point for ${DISK}${_pp} (size=${_ps}k) [$_mp, RET, none, or done]? " - getresp "$_mp" + ask "Mount point for ${DISK}${_pp} (size=${_ps}k), RET, none or done?" "$_mp" case $resp in /*) _mount_points[${_i}]=$resp break @@ -224,8 +223,7 @@ __EOT echo ) < ${FILESYSTEMS} - echo -n "\nAre you really sure that you're ready to proceed? [n] " - getresp n + ask "\nAre you really sure that you're ready to proceed?" n case $resp in y*|Y*) ;; *) echo "ok, try again later..." @@ -258,8 +256,7 @@ Even if you choose not to transfer installation sets that way, this information will be preserved and copied into the new root filesystem. __EOT -echo -n "Configure the network? [y] " -getresp y +ask "Configure the network?" y case $resp in y*|Y*) donetconfig ;; @@ -287,8 +284,7 @@ mount | while read line; do set -- $line if [ "$3" = "/" -a "$5" = "nfs" ]; then echo "You appear to be running diskless." - echo -n "Are the install sets on one of your currently mounted filesystems? [n] " - getresp n + ask "Are the install sets on one of your currently mounted filesystems?" n case $resp in y*|Y*) get_localdir ;; diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index c0eb203cd38..6c628d6be24 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: install.sub,v 1.210 2002/04/27 19:12:57 krw Exp $ +# $OpenBSD: install.sub,v 1.211 2002/04/28 14:44:01 krw Exp $ # $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $ # # Copyright (c) 1997-2002 Todd Miller, Theo de Raadt, Ken Westerback @@ -86,7 +86,7 @@ # Ask for a password, saving the input in $resp. # Display $1 as the prompt. -# *Don't* allow the '!' options that getresp does. +# *Don't* allow the '!' options that ask does. # *Don't* echo input. askpass() { set -o noglob @@ -97,11 +97,19 @@ askpass() { echo } -# Ask for user input, saving the input (or the default value -# given in $1 if the input is empty) in $resp. Allow the user -# to escape to shells ('!') or execute commands ('!foo') -# before entering the input. -getresp() { +# Ask for user input. +# +# $1 = the question to ask the user +# $2 = the default answer +# +# Save the user input (or the default) in $resp. +# +# Allow the user to escape to shells ('!') or execute commands +# ('!foo') before entering the input. +ask() { + echo -n "$1 " + [ $# -lt 2 ] || echo -n "[$2] " + set -o noglob while : ; do read resp @@ -111,7 +119,7 @@ getresp() { ;; !*) eval ${resp#?} ;; - *) : ${resp:=$1} + *) : ${resp:=$2} break ;; esac @@ -279,14 +287,12 @@ get_localdir() { local _mp=$1 _dir= while : ; do - echo -n "Enter the pathname where the sets are stored: [$_dir] " - getresp "$_dir" + ask "Enter the pathname where the sets are stored:" "$_dir" _dir=$resp # Allow break-out with empty response if [ -z "$_dir" ]; then - echo -n "Are you sure you don't want to set the pathname? [n] " - getresp n + ask "Are you sure you don't want to set the pathname?" n case $resp in y*|Y*) break ;; @@ -305,8 +311,7 @@ get_localdir() { The directory "${_mp}/${_dir}" does not exist, or does not hold any OpenBSD ${VERSION_MAJOR}.${VERSION_MINOR} ${MODE} sets. __EOT - echo -n "Re-enter pathname? [y] " - getresp y + ask "Re-enter pathname?" y case $resp in y*|Y*) ;; *) local_sets_dir= @@ -339,8 +344,7 @@ you have already entered information for). Available disks are: $_DKDEVS __EOT - echo -n "Which one? [done] " - getresp done + ask "Which one?" done if [ "X${resp}" = "Xdone" ]; then DISK=done elif isin $resp $_DKDEVS ; then @@ -370,8 +374,7 @@ Available disks are: $_DKDEVS __EOT - echo -n "Which disk is the root disk? [${_defdsk}] " - getresp "$_defdsk" + ask "Which disk is the root disk?" "$_defdsk" if isin $resp $_DKDEVS ; then ROOTDISK=$resp makedev $resp || ROOTDISK= @@ -436,8 +439,7 @@ __EOT done echo fi - echo -n "Configure which interface? (or 'done') [$_ouranswer] " - getresp "$_ouranswer" + ask "Configure which interface? (or 'done')" "$_ouranswer" case $resp in "done") ;; "") _reprompt=0 @@ -492,8 +494,7 @@ configure_ifs() { # Get IP address resp= while [ -z "$resp" ] ; do - echo -n "IP address${_dhcp_prompt}? [$_if_ip] " - getresp "$_if_ip" + ask "IP address${_dhcp_prompt}?" "$_if_ip" if [ ! -x /sbin/dhclient -a "X$resp" == "Xdhcp" ]; then resp= fi @@ -504,8 +505,7 @@ configure_ifs() { _hostname=`hostname` resp= while [ -z "$resp" ] ; do - echo -n "Symbolic (host) name? [$_hostname] " - getresp "$_hostname" + ask "Symbolic (host) name?" "$_hostname" _if_symname=$resp done @@ -516,8 +516,7 @@ configure_ifs() { _if_mask=255.255.255.0 fi while [ -z "$resp" ]; do - echo -n "Netmask? [$_if_mask] " - getresp "$_if_mask" + ask "Netmask?" "$_if_mask" _if_mask=$resp done fi @@ -539,8 +538,7 @@ __EOT If the default is not satisfactory, and you wish to use another media, copy that line from above (e.g. "media 100baseTX") __EOT - echo -n "Media directives? [$_if_extra] " - getresp "$_if_extra" + ask "Media directives?" "$_if_extra" if [ -n "$resp" ]; then _if_extra=$resp fi @@ -795,8 +793,7 @@ get_selection() { done # Get the name of the file. - echo -n "File name? [$_next] " - getresp "$_next" + ask "File name?" "$_next" # Ignore a bare '-' or '+' case $resp in @@ -909,8 +906,7 @@ The directory contains no OpenBSD ${VERSION_MAJOR}.${VERSION_MINOR} ${MODE} sets. __EOT - echo -n "Search for other *.tar.gz and *.tgz files? [y] " - getresp y + ask "Search for other *.tar.gz and *.tgz files?" y case $resp in n*|N*) return ;; esac @@ -923,9 +919,7 @@ __EOT fi if [ -z "$_sets" ]; then - eval echo "There are no *.tar.gz or *.tgz files in ${_src}." - echo -n "See a directory listing? [y] " - getresp y + ask "There are no *.tar.gz or *.tgz files in ${_src}.\nSee a directory listing?" y case $resp in n*|N*) return ;; esac @@ -980,8 +974,7 @@ get_get_files_list () { install_get_files_list () { local _f _failed_files _src=$1 _public_src=$2 - echo -n "Ready to ${MODE} sets? [y] " - getresp y + ask "Ready to ${MODE} sets?" y case $resp in y*|Y*) ;; *) _setsdone=$_osetsdone @@ -1064,8 +1057,7 @@ __EOT if [ -z "$_proxy_host" ]; then _proxy_host=none fi - echo -n "HTTP/FTP proxy URL? (e.g. 'http://proxy:8080', or 'none') [${_proxy_host}] " - getresp "$_proxy_host" + ask "HTTP/FTP proxy URL? (e.g. 'http://proxy:8080', or 'none')" "$_proxy_host" if [ "X${resp}" = X"none" ]; then unset _proxy_host ftp_proxy http_proxy else @@ -1086,8 +1078,7 @@ By default, ftp will attempt a passive connection and fall back to a normal old ftp servers that claim to support passive mode, but really do not. In this case, you should explicitly request an active session. __EOT - echo -n "Do you want to use active ftp? [${resp}] " - getresp "$resp" + ask "Do you want to use active ftp?" "$resp" case $resp in y*|Y*) _ftp_active=-A ;; *) unset _ftp_active ;; @@ -1096,8 +1087,7 @@ __EOT # Provide a list of possible servers [ -z "$_ftp_getlist" ] && _ftp_getlist=y - echo -n "Do you want a list of potential ${_url_type} servers? [${_ftp_getlist}] " - getresp "$_ftp_getlist" + ask "Do you want a list of potential ${_url_type} servers?" "$_ftp_getlist" case $resp in n*|N*) _ftp_getlist=n ;; @@ -1114,11 +1104,10 @@ __EOT resp= while [ -z "$resp" ] ; do if [ -f /tmp/ftplist ]; then - eval echo -n "Server IP address, hostname, or list#? [\$_${_url_type}_server_ip]\ " + eval ask \"Server IP address, hostname, or list#?\" \"\$_${_url_type}_server_ip\" else - eval echo -n "Server IP address, or hostname? [\$_${_url_type}_server_ip]\ " + eval ask \"Server IP address, or hostname?\" \"\$_${_url_type}_server_ip\" fi - eval getresp "\$_${_url_type}_server_ip" if [ "X$resp" = "X?" -a -f /tmp/ftplist ]; then cat /tmp/ftplist | grep "^${_url_type}:" | cat -n | less -XE resp= @@ -1156,8 +1145,7 @@ __EOT fi resp= while [ -z "$resp" ] ; do - eval echo -n "Server directory? [\$_${_url_type}_server_dir]\ " - eval getresp "\$_${_url_type}_server_dir" + eval ask \"Server directory?\" \"\$_${_url_type}_server_dir\" eval _${_url_type}_server_dir=$resp done @@ -1176,8 +1164,7 @@ __EOT IFS= resp= while [ -z "$resp" ] ; do - echo -n "Login? [${_ftp_server_login}] " - getresp "$_ftp_server_login" + ask "Login?" "$_ftp_server_login" _ftp_server_login=$resp done @@ -1283,8 +1270,7 @@ $_CDDEVS __EOT _drive=`echo $_CDDEVS | cutword 1` - echo -n "Which CD-ROM contains the installation media? [$_drive] " - getresp "$_drive" + ask "Which CD-ROM contains the installation media?" "$_drive" case $resp in abort) echo "Aborting." return @@ -1325,8 +1311,7 @@ __EOT _range=`md_get_partition_range` resp= while [ -z "$resp" ] ; do - echo -n 'CD-ROM partition to mount? (normally "c") [c] ' - getresp c + ask "CD-ROM partition to mount? (normally 'c')" c case $resp in $_range) _part=$resp @@ -1348,8 +1333,7 @@ ffs Berkeley Fast Filesystem __EOT resp= while [ -z "$resp" ] ; do - echo -n "Which filesystem type? [cd9660] " - getresp cd9660 + ask "Which filesystem type?" cd9660 case $resp in cd9660|ffs) _fstype=$resp @@ -1374,9 +1358,7 @@ __EOT resp= _directory=${VERSION_MAJOR}.${VERSION_MINOR}/${ARCH} echo "Enter the directory relative to the mount point that contains" - echo -n "the file: [${_directory}] " - - getresp "$_directory" + ask "the file:" "$_directory" install_from_mounted_fs "/mnt2/${resp}" umount -f /mnt2 > /dev/null 2>&1 @@ -1399,8 +1381,7 @@ $_DKDEVS __EOT - echo -n "Which is the disk with the installation sets? [abort] " - getresp abort + ask "Which is the disk with the installation sets?" abort case $resp in abort) echo "Aborting." @@ -1443,8 +1424,7 @@ __EOT resp= while [ -z "$resp" ]; do - echo -n "Partition? [$_def_partition] " - getresp "$_def_partition" + ask "Partition?" "$_def_partition" case $resp in $_partition_range) _partition=$resp @@ -1474,8 +1454,7 @@ __EOT resp= while [ -z "$resp" ]; do - echo -n "Which filesystem type? [default] " - getresp default + ask "Which filesystem type?" default case $resp in default) _fstype= @@ -1511,8 +1490,7 @@ install_disk() { # Get the directory where the file lives echo "Enter the directory relative to the mount point that" - echo -n "contains the file: [.] " - getresp "." + ask "contains the file:" . install_from_mounted_fs "/mnt2/${resp}" umount -f /mnt2 > /dev/null 2>&1 @@ -1522,22 +1500,19 @@ install_nfs() { # Get the IP address of the server resp= while [ -z "$resp" ] ; do - echo -n "Server IP address or hostname? [${_nfs_server_ip}] " - getresp "$_nfs_server_ip" + ask "Server IP address or hostname?" "$_nfs_server_ip" done _nfs_server_ip=$resp # Get server path to mount resp= while [ -z "$resp" ]; do - echo -n "Filesystem on server to mount? [${_nfs_server_path}] " - getresp "$_nfs_server_path" + ask "Filesystem on server to mount?" "$_nfs_server_path" done _nfs_server_path=$resp # Determine use of TCP - echo -n "Use TCP transport? (only works with capable NFS server) [n] " - getresp n + ask "Use TCP transport? (only works with capable NFS server)" n case $resp in y*|Y*) _nfs_tcp=-T ;; @@ -1556,8 +1531,7 @@ install_nfs() { resp= while [ -z "$resp" ]; do echo "Enter the directory relative to the mount point that" - echo -n "contains the file: [.] " - getresp + ask "contains the file:" . done install_from_mounted_fs "/mnt2/${resp}" @@ -1577,8 +1551,7 @@ __EOT _tape=`basename $TAPE` resp= while [ -z "$resp" ]; do - echo -n "Name of tape device? [${_tape}]" - getresp "$_tape" + ask "Name of tape device?" "$_tape" done _tape=`basename $resp` TAPE=/dev/${_tape} @@ -1601,8 +1574,7 @@ __EOT # Get the file number resp= while [ -z "$resp" ]; do - echo -n "File number? " - getresp + ask "File number?" case $resp in [1-9]*) _nskip=$(( $resp - 1 )) ;; @@ -1634,8 +1606,7 @@ __EOT resp= while [ -z "$resp" ]; do - echo -n "Which way is it? [1] " - getresp 1 + ask "Which way is it?" 1 case $resp in 1) _xcmd="tar -zxvpf -" ;; @@ -1679,8 +1650,7 @@ __EOT while : ; do _zonepath=$_zoneroot - echo -n "What timezone are you in? ('?' for list) [$TZ] " - getresp "$TZ" + ask "What timezone are you in? ('?' for list)" "$TZ" if [ "$resp" = "?" ]; then ls -F ${_zonepath} @@ -1691,8 +1661,7 @@ __EOT while [ -d "$_zonepath" ]; do echo -n "Select a sub-timezone of " - echo -n "'${_zonepath#$_zoneroot}' ('?' for list): " - getresp + ask "'${_zonepath#$_zoneroot}' ('?' for list):" if [ "$resp" = "?" ]; then ls -F ${_zonepath} else @@ -1784,8 +1753,7 @@ __EOT if [ X"$_yup" = X"FALSE" ]; then echo -n "Install from (f)tp, (h)ttp, (t)ape, (C)D-ROM" [ -n "$_have_nfs" ] && echo -n ", (N)FS" - echo -n " or local (d)isk? " - getresp + ask " or local (d)isk?" case $resp in d*|D*) install_disk resp=d @@ -1826,8 +1794,7 @@ __EOT if sane_install; then # Give the user the opportunity to extract more sets. They # don't necessarily have to come from the same media. - echo -n "\nExtract more sets? [n] " - getresp n + ask "\nExtract more sets?" n case $resp in y*|Y*) # Force loop to repeat resp= @@ -1978,8 +1945,7 @@ get_fqdn() { sed "s/\\(.*\\)[[:space:]]\\(.*\\)\$/\\1 \\2.$FQDN \\2/" $2 > $2.new mv $2.new $2 else - echo -n "Enter DNS domain name (e.g. 'bar.com'): [$FQDN] " - getresp "$FQDN" + ask "Enter DNS domain name (e.g. 'bar.com'):" "$FQDN" FQDN=$resp fi } @@ -1994,8 +1960,7 @@ donetconfig() { resp= while [ -z "$resp" ] ; do - echo -n "Enter system hostname (short form, e.g. 'foo'): [$_nam] " - getresp "$_nam" + ask "Enter system hostname (short form, e.g. 'foo'):" "$_nam" done hostname $resp echo $resp > /tmp/myname @@ -2059,8 +2024,7 @@ __EOT fi fi fi - echo -n "Enter IP address of default route: [$resp] " - getresp "$resp" + ask "Enter IP address of default route:" "$resp" if [ "X${resp}" != X"none" ]; then route delete default > /dev/null 2>&1 if route add default $resp > /dev/null ; then @@ -2080,8 +2044,7 @@ __EOT fi done fi - echo -n "Enter IP address of primary nameserver: [$resp] " - getresp "$resp" + ask "Enter IP address of primary nameserver:" "$resp" if [ "X${resp}" != X"none" ]; then echo "search $FQDN" > /tmp/resolv.conf for n in `echo ${resp}`; do @@ -2089,8 +2052,7 @@ __EOT done echo "lookup file bind" >> /tmp/resolv.conf - echo -n "Would you like to use the nameserver now? [y] " - getresp y + ask "Would you like to use the nameserver now?" y case $resp in y*|Y*) cp /tmp/resolv.conf /tmp/resolv.conf.shadow ;; @@ -2106,8 +2068,7 @@ 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. __EOT - echo -n "Would you like to edit the host table with ${EDITOR}? [n] " - getresp n + ask "Would you like to edit the host table with ${EDITOR}?" n case $resp in y*|Y*) ${EDITOR} /tmp/hosts ;; @@ -2121,8 +2082,7 @@ 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. __EOT - echo -n "Escape to shell? [n] " - getresp n + ask "Escape to shell?" n case $resp in y*|Y*) echo "Type 'exit' to return to install." sh @@ -2225,8 +2185,7 @@ else echo -n "P" fi -echo -n "roceed with ${MODE}? [n] " -getresp n +ask "roceed with ${MODE}?" n case $resp in y*|Y*) echo "\nCool! Let's get to it...\n" ;; diff --git a/distrib/miniroot/upgrade.sh b/distrib/miniroot/upgrade.sh index 6fff874d128..6f8c235efbb 100644 --- a/distrib/miniroot/upgrade.sh +++ b/distrib/miniroot/upgrade.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: upgrade.sh,v 1.31 2002/04/13 21:03:31 deraadt Exp $ +# $OpenBSD: upgrade.sh,v 1.32 2002/04/28 14:44:01 krw Exp $ # $NetBSD: upgrade.sh,v 1.2.4.5 1996/08/27 18:15:08 gwr Exp $ # # Copyright (c) 1997-2002 Todd Miller, Theo de Raadt, Ken Westerback @@ -67,8 +67,7 @@ done # this with the user. Check and mount the root filesystem. resp= while [ "X${resp}" = "X" ]; do - echo -n "Root filesystem? [${ROOTDISK}a] " - getresp "${ROOTDISK}a" + ask "Root filesystem?" "${ROOTDISK}a" _root_filesystem=/dev/`basename $resp` if [ ! -b ${_root_filesystem} ]; then echo "Sorry, ${_root_filesystem} is not a block device." @@ -110,8 +109,7 @@ configuration already stored on the root filesystem. This is required if you wish to use the network installation capabilities of this program. __EOT -echo -n "Enable network? [y] " -getresp y +ask "Enable network?" y case $resp in y*|Y*) if ! enable_network; then @@ -127,8 +125,7 @@ adding additional routes, if needed. In addition, you might take this opportunity to redo the default route in the event that it failed above. __EOT - echo -n "Escape to shell? [n] " - getresp n + ask "Escape to shell?" n case $resp in y*|Y*) echo "Type 'exit' to return to upgrade." sh @@ -152,8 +149,7 @@ NOTE: 1) this fstab is used only during the upgrade. It will not be option, will be ignored during the upgrade. __EOT -echo -n "Edit the fstab with ${EDITOR}? [n] " -getresp n +ask "Edit the fstab with ${EDITOR}?" n case $resp in y*|Y*) ${EDITOR} /tmp/fstab ;; @@ -201,8 +197,7 @@ if [ -d /mnt/usr/X11R6/lib/X11 ]; then fi ) -echo -n "Are the upgrade sets on one of your normally mounted (local) filesystems? [y] " -getresp y +ask "Are the upgrade sets on one of your normally mounted (local) filesystems?" y case $resp in y*|Y*) get_localdir /mnt ;; diff --git a/distrib/mvme68k/ramdisk/install.md b/distrib/mvme68k/ramdisk/install.md index aca9e34008e..04ee75708f0 100644 --- a/distrib/mvme68k/ramdisk/install.md +++ b/distrib/mvme68k/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.15 2002/04/25 21:28:13 miod Exp $ +# $OpenBSD: install.md,v 1.16 2002/04/28 14:44:01 krw Exp $ # Copyright (c) 1996 The NetBSD Foundation, Inc. # All rights reserved. # @@ -46,8 +46,7 @@ md_set_term() { if [ ! -z "$TERM" ]; then return fi - echo -n "Specify terminal type [vt100]: " - getresp "vt100" + ask "Specify terminal type:" vt100 TERM="$resp" export TERM } @@ -109,17 +108,16 @@ md_prep_disklabel() _disk=$1 md_checkfordisklabel $_disk case $? in - 0) echo -n "Do you wish to edit the disklabel on $_disk? [y] " + 0) ask "Do you wish to edit the disklabel on $_disk?" y ;; 1) echo "WARNING: Disk $_disk has no label" - echo -n "Do you want to create one with the disklabel editor? [y] " + ask "Do you want to create one with the disklabel editor?" y ;; 2) echo "WARNING: Label on disk $_disk is corrupted" - echo -n "Do you want to try and repair the damage using the disklabel editor? [y] " + ask "Do you want to try and repair the damage using the disklabel editor?" y ;; esac - getresp "y" case "$resp" in y*|Y*) ;; *) return ;; @@ -148,8 +146,7 @@ in case you have defined less than sixteen partitions. [End of example] __EOT - echo -n "Press [Enter] to continue " - getresp "" + ask "Press [Enter] to continue" disklabel -W ${_disk} disklabel -f /tmp/fstab.${_disk} -E ${_disk} } diff --git a/distrib/mvmeppc/ramdisk/install.md b/distrib/mvmeppc/ramdisk/install.md index db1c47ff89d..b3331b6e579 100644 --- a/distrib/mvmeppc/ramdisk/install.md +++ b/distrib/mvmeppc/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.7 2002/04/28 02:13:20 deraadt Exp $ +# $OpenBSD: install.md,v 1.8 2002/04/28 14:44:01 krw Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -45,8 +45,7 @@ ARCH=ARCH md_set_term() { test -n "$TERM" && return - echo -n "Specify terminal type [vt220]: " - getresp vt220 + ask "Specify terminal type:" vt220 TERM=$resp export TERM } @@ -109,8 +108,7 @@ md_init_mbr() { echo "consult your PowerPC OpenFirmware manual -and- the" echo "PowerPC OpenBSD Installation Guide for doing setup this way." echo - echo -n "Do you want to init the MBR and the MSDOS partition? [y] " - getresp "y" + ask "Do you want to init the MBR and the MSDOS partition?" y case "$resp" in n*|N*) exit 0;; *) echo @@ -156,8 +154,7 @@ md_checkfordisklabel() { echo "any HFS partitions on the disk, including the partition table." echo "Choose the MBR option carefully, knowing this fact." - echo -n "Do you want to choose (H)FS labeling or (M)BR labeling [H] " - getresp "h" + ask "Do you want to choose (H)FS labeling or (M)BR labeling?" H case "$resp" in m*|M*) export disklabeltype=MBR md_checkforMBRdisklabel $1 @@ -173,15 +170,13 @@ md_checkfordisklabel() { md_checkforMBRdisklabel() { echo "You have chosen to put a MBR disklabel on the disk." - echo -n "Is this correct? [n] " - getresp "n" + ask "Is this correct?" n case "$resp" in n*|N*) echo "aborting install" exit 0;; esac - echo -n "Have you initialized an MSDOS partition using OpenFirmware? [n] " - getresp "n" + ask "Have you initialized an MSDOS partition using OpenFirmware?" n case "$resp" in n*|N*) md_init_mbr $1;; *) echo @@ -193,8 +188,7 @@ md_checkforMBRdisklabel() { echo "Also note that the boot partition must be included as partition" echo "'i' in the OpenBSD disklabel." echo - echo -n "Do you want to keep the current MSDOS partition setup? [y]" - getresp "y" + ask "Do you want to keep the current MSDOS partition setup?" y case "$resp" in n*|N*) md_init_mbr $1;; esac @@ -233,14 +227,12 @@ md_prep_fdisk() echo "WARNING: Wrong information in the BIOS partition table might" echo "render the disk unusable." - echo -n "Press [Enter] to continue " - getresp "" + ask "Press [Enter] to continue" echo echo "Current partition information is:" fdisk ${_disk} - echo -n "Press [Enter] to continue " - getresp "" + ask "Press [Enter] to continue" _done=0 while [ $_done = 0 ]; do @@ -258,8 +250,7 @@ If you make a mistake, simply exit fdisk without storing the new information, and you will be allowed to start over. __EOT echo - echo -n "Press [Enter] to continue " - getresp "" + ask "Press [Enter] to continue" fdisk -e ${_disk} @@ -270,8 +261,7 @@ __EOT echo echo "(You will be permitted to edit this information again.)" echo "-------------------------------------------------------" - echo -n "Is the above information correct? [n] " - getresp "n" + ask "Is the above information correct?" n case "$resp" in n*|N*) ;; @@ -285,8 +275,7 @@ __EOT echo "At least the MSDOS partition used for booting must be accessible" echo "by OpenBSD as partition 'i'. You may need this information to " echo "fill in the OpenBSD disk label later." - echo -n "Press [Enter] to continue " - getresp "" + ask "Press [Enter] to continue" } md_prep_disklabel() @@ -296,18 +285,17 @@ md_prep_disklabel() _disk=$1 md_checkfordisklabel $_disk case $? in - 0) echo -n "Do you wish to edit the disklabel on $_disk? [y] " + 0) ask "Do you wish to edit the disklabel on $_disk?" y ;; 1) md_prep_fdisk ${_disk} echo "WARNING: Disk $_disk has no label" - echo -n "Do you want to create one with the disklabel editor? [y] " + ask "Do you want to create one with the disklabel editor?" y ;; 2) echo "WARNING: Label on disk $_disk is corrupted" - echo -n "Do you want to try and repair the damage using the disklabel editor? [y] " + ask "Do you want to try and repair the damage using the disklabel editor?" y ;; esac - getresp "y" case "$resp" in y*|Y*) ;; *) return ;; @@ -340,8 +328,8 @@ Do not change any parameters except the partition layout and the label name. i: 10208 32 MSDOS # (Cyl. 0*- 11*) [End of example] __EOT - echo -n "Press [Enter] to continue " - getresp "" + ask "Press [Enter] to continue" + if [[ $disklabeltype = "HFS" ]] then disklabel -c -f /tmp/fstab.${_disk} -E ${_disk} diff --git a/distrib/sparc64/common/install.md b/distrib/sparc64/common/install.md index c7b2690153e..13f45933265 100644 --- a/distrib/sparc64/common/install.md +++ b/distrib/sparc64/common/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.6 2002/04/13 02:33:10 deraadt Exp $ +# $OpenBSD: install.md,v 1.7 2002/04/28 14:44:01 krw Exp $ # $NetBSD: install.md,v 1.3.2.5 1996/08/26 15:45:28 gwr Exp $ # # @@ -46,8 +46,7 @@ ARCH=ARCH md_set_term() { test -n "$TERM" && return - echo -n "Specify terminal type [sun]: " - getresp sun + ask "Specify terminal type:" sun TERM=$resp export TERM } @@ -82,8 +81,7 @@ md_get_partition_range() { md_questions() { echo - echo -n "Do you expect to run the X Window System? [y] " - getresp y + ask "Do you expect to run the X Window System?" y case "$resp" in y*|Y*) xfree86=y ;; |