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 /distrib/macppc | |
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@.
Diffstat (limited to 'distrib/macppc')
-rw-r--r-- | distrib/macppc/ramdisk/install.md | 49 |
1 files changed, 18 insertions, 31 deletions
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} |