From 3bca3a12b4ceb6851777313ee1dbdcde4b2f72bb Mon Sep 17 00:00:00 2001 From: "T. Joseph Carter" Date: Mon, 12 Oct 2015 16:56:43 -0700 Subject: [PATCH] Fix askYesNo function breakage Paper bag time. If you redirect stdin and read it, you have no stdin to answer the question asked. *facepalm* What was I thinking? --- scripts/a2server-5-netboot.txt | 54 ++++++++++++++++------------------ setup/index.txt | 43 +++++++++++++-------------- 2 files changed, 45 insertions(+), 52 deletions(-) diff --git a/scripts/a2server-5-netboot.txt b/scripts/a2server-5-netboot.txt index a5d9543..4dcee1f 100755 --- a/scripts/a2server-5-netboot.txt +++ b/scripts/a2server-5-netboot.txt @@ -29,9 +29,9 @@ adtproDir=$commDir/ADTPRO function askYesNo() # Ask a yes/no question of the user, with potential default -# stdin: Info text for the user # arg1: Prompt text # arg2: Default; 0 for yes, 1 for no, anything else for no default +# arg3: Info text for the user # returns: 0 for yes, 1 for no { local default @@ -46,9 +46,11 @@ function askYesNo() return $2 fi - echo - cat - - echo + if [ -n "$3" ]; then + echo + echo "$3" + echo + fi while :; do echo -n "$1 " [ -n "$default" ] && echo -n "[$default] " @@ -66,10 +68,9 @@ function askYesNo() [[ -f /tmp/a2server-autoAnswerDefault ]] && autoAnswerDefault=1 || autoAnswerDefault= if [[ ! $autoAnswerDefault || -f /tmp/a2server-setupNetBoot ]]; then - askYesNo "Configure Apple II network boot?" 0 < /dev/null if [[ -d $gsosDir/SYSTEM/SYSTEM.SETUP ]]; then diff --git a/setup/index.txt b/setup/index.txt index 3eaa568..74f36e3 100755 --- a/setup/index.txt +++ b/setup/index.txt @@ -13,9 +13,9 @@ a2serverVersion="125" function askYesNo() # Ask a yes/no question of the user, with potential default -# stdin: Info text for the user # arg1: Prompt text # arg2: Default; 0 for yes, 1 for no, anything else for no default +# arg3: Info text for the user # returns: 0 for yes, 1 for no { local default @@ -30,9 +30,11 @@ function askYesNo() return $2 fi - echo - cat - - echo + if [ -n "$3" ]; then + echo + echo "$3" + echo + fi while :; do echo -n "$1 " [ -n "$default" ] && echo -n "[$default] " @@ -149,19 +151,17 @@ fi doSetup=1 if [[ ! -f /usr/local/etc/a2server-help.txt ]] || (( $a2server_update )); then - askYesNo "Ready to set up A2SERVER?" 0 <