Change autoAnswerYes to autoAnswerDefault

This should allow questions to be created whose default is no without
convoluted asking of the opposite question.
This commit is contained in:
T. Joseph Carter 2015-10-08 12:51:54 -07:00
parent 9601ed3e14
commit c9e0345497
5 changed files with 38 additions and 38 deletions

View File

@ -27,17 +27,17 @@ zlinkDir=$commDir/Z.LINK
adtproDir=$commDir/ADTPRO
# bail out on automated netboot setup unless -b is also specified
[[ -f /tmp/a2server-autoAnswerYes ]] && autoAnswerYes=1 || autoAnswerYes=
if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
[[ -f /tmp/a2server-autoAnswerDefault ]] && autoAnswerDefault=1 || autoAnswerDefault=
if [[ ! $autoAnswerDefault || -f /tmp/a2server-setupNetBoot ]]; then
if [[ ! $autoAnswerYes ]]; then
if [[ ! $autoAnswerDefault ]]; then
echo
echo "Do you want to set up A2SERVER to be able to boot Apple II"
echo -n "computers over the network? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
if [[ $autoAnswerDefault || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
nbmode=1
echo
@ -126,12 +126,12 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
echo "A2SERVER: GS/OS has already been downloaded and installed."
gsosInstall=1
else
if [[ ! $autoAnswerYes ]]; then
if [[ ! $autoAnswerDefault ]]; then
echo "You can set up GS/OS 6.0.1 on your network drive, for network boot."
echo -n "This may take a while. Download and install it now? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
if [[ $autoAnswerDefault || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
gsosInstall=1
# get GS/OS disks from Internet Archive and put them in IMAGES
@ -223,13 +223,13 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
fi
fi
if [[ ! $autoAnswerYes ]]; then
if [[ ! $autoAnswerDefault ]]; then
echo
echo "Do you want to download and install utilities for working with"
echo -n "disk images and archive files in GS/OS? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
if [[ $autoAnswerDefault || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
# download image tools and put them in IMAGE.TOOLS
echo "A2SERVER: Downloading GS/OS disk image utilities..."
@ -280,13 +280,13 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
fi
fi
if [[ ! $autoAnswerYes ]]; then
if [[ ! $autoAnswerDefault ]]; then
echo
echo "Do you want to download and install utilities for working with"
echo -n "disk images and archive files in ProDOS 8? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
if [[ $autoAnswerDefault || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
echo "A2SERVER: Downloading ProDOS 8 disk image utilities..."
@ -339,13 +339,13 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
fi
if [[ ! $autoAnswerYes ]]; then
if [[ ! $autoAnswerDefault ]]; then
echo
echo "Do you want to download serial communications software for"
echo -n "GS/OS and ProDOS 8? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
if [[ $autoAnswerDefault || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
echo "A2SERVER: Downloading communications software..."
@ -421,13 +421,13 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupNetBoot ]]; then
fi
if [[ ! $autoAnswerYes ]]; then
if [[ ! $autoAnswerDefault ]]; then
echo
echo "Do you want to download the patch required for using"
echo -n "a Farallon LocalTalk-to-Ethernet bridge with GS/OS? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
if [[ $autoAnswerDefault || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
echo "A2SERVER: Downloading Farallon bridge patch..."
wget -O /tmp/FARALLON.PO "${scriptURL}files/FARALLON.B1.PO" &> /dev/null
if [[ -d $gsosDir/SYSTEM/SYSTEM.SETUP ]]; then

View File

@ -3,16 +3,16 @@
# Set up A2SERVER to support Samba (Windows File Sharing)
# this script can also be used if new shares are introduced
[[ -f /tmp/a2server-autoAnswerYes ]] && autoAnswerYes=1 || autoAnswerYes=
[[ -f /tmp/a2server-autoAnswerDefault ]] && autoAnswerDefault=1 || autoAnswerDefault=
if [[ ! $autoAnswerYes || -f /tmp/a2server-setupWindowsSharing ]]; then
if [[ ! $autoAnswerDefault || -f /tmp/a2server-setupWindowsSharing ]]; then
if [[ ! $autoAnswerYes ]]; then
if [[ ! $autoAnswerDefault ]]; then
echo
echo -n "Should Windows computers be able to connect to A2SERVER? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
if [[ $autoAnswerDefault || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
echo "A2SERVER: Setting up Windows file sharing..."
sudo true
@ -47,7 +47,7 @@ if [[ ! $autoAnswerYes || -f /tmp/a2server-setupWindowsSharing ]]; then
workgroup=$(grep -o "^ workgroup = .*$" /etc/samba/smb.conf 2> /dev/null | cut -c 16-)
[[ $workgroup ]] || workgroup="WORKGROUP"
if [[ ! $autoAnswerYes ]]; then
if [[ ! $autoAnswerDefault ]]; then
echo
echo "Enter workgroup name (or press return for '${workgroup}'): "
read

View File

@ -49,11 +49,11 @@ if [[ $(lsb_release -d 2> /dev/null | grep Ubuntu) ]]; then
echo "- eliminate a harmless but annoying startup error about piix_smbus"
echo "- fix an Ubuntu 10.04 issue with slow scrolling"
echo
if [[ ! $autoAnswerYes ]]; then
if [[ ! $autoAnswerDefault ]]; then
echo -n "Do you want to optimize the Ubuntu console? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
if [[ $autoAnswerDefault || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
echo "A2SERVER: Optimizing console..."

View File

@ -28,7 +28,7 @@ if [[ -f /usr/local/etc/A2SERVER-version ]]; then
fi
skipRepoUpdate=
autoAnswerYes=
autoAnswerDefault=
setupNetBoot=
setupWindowsSharing=
updateRasppleII=
@ -39,8 +39,8 @@ while [[ $1 ]]; do
touch /tmp/a2server-packageReposUpdated
elif [[ $1 == "-y" ]]; then
shift
autoAnswerYes="-y"
touch /tmp/a2server-autoAnswerYes
autoAnswerDefault="-y"
touch /tmp/a2server-autoAnswerDefault
elif [[ $1 == "-b" ]]; then
shift
setupNetBoot="-b"
@ -63,7 +63,7 @@ while [[ $1 ]]; do
elif [[ $1 ]]; then
echo "options:"
echo "-v: display installed and available versions, then exit"
echo "-y: auto-answer yes to all prompts"
echo "-y: auto-answer default to all prompts"
echo "-r: don't update package repositories"
echo "-b: auto-setup network boot (use with -y)"
echo "-w: auto-setup Windows file sharing (use with -y)"
@ -77,7 +77,7 @@ done
if [[ $updateRasppleII ]]; then
echo "A2SERVER: Updating Raspple II (takes up to an hour)..."
wget -qO /tmp/raspbian-update "${scriptURL}files/raspbian-update.txt"
source /tmp/raspbian-update a2cloud a2server $autoAnswerYes $skipRepoUpdate
source /tmp/raspbian-update a2cloud a2server $autoAnswerDefault $skipRepoUpdate
[[ $0 == "-bash" ]] && return 0 || exit 0
fi
@ -117,7 +117,7 @@ if [[ ! -f /usr/local/etc/a2server-help.txt ]] || (( $a2server_update )); then
echo "Setting up A2SERVER will take up to 60 minutes, during which"
echo "you'll see a bunch of stuff spit out across the screen."
echo
if [[ ! $autoAnswerYes ]]; then
if [[ ! $autoAnswerDefault ]]; then
echo -n "Ready to set up A2SERVER? "
read
[[ ${REPLY:0:1} == "y" || ${REPLY:0:1} == "Y" ]]; doSetup=$(( 1 - $? ))
@ -130,7 +130,7 @@ if (( $doSetup )); then
echo "a2server-setup modifies files and performs actions as the root user."
echo "For details, visit http://appleii.ivanx.com/a2server."
echo
if [[ ! $autoAnswerYes ]]; then
if [[ ! $autoAnswerDefault ]]; then
echo -n "Continue? "
read
[[ ${REPLY:0:1} == "y" || ${REPLY:0:1} == "Y" ]]; doSetup=$(( 1 - $? ))
@ -149,7 +149,7 @@ if (( $doSetup )); then
[[ $isRpi ]] && a2server="your Raspberry Pi" || a2server="A2SERVER"
if [[ ! $isApple2Pw && ! -f /usr/local/etc/A2SERVER-version ]]; then
if [[ ! $autoAnswerYes ]]; then
if [[ ! $autoAnswerDefault ]]; then
echo
echo "To ensure that all client computers are able to connect to"
echo "${a2server} using the same password, you are recommended"
@ -158,7 +158,7 @@ if (( $doSetup )); then
echo -n "Do you want to change the password for user '$USER' to 'apple2' now? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
if [[ $autoAnswerDefault || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
echo "A2SERVER: changing password for user '$USER' to 'apple2'..."
echo "$USER:apple2" | sudo chpasswd
fi
@ -233,11 +233,11 @@ if (( $doSetup )); then
echo "A2SERVER is now configured, but Apple II clients will not be able"
echo "to connect until you restart your Raspberry Pi."
echo
if [[ ! $autoAnswerYes ]]; then
if [[ ! $autoAnswerDefault ]]; then
echo -n "Restart now? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
if [[ $autoAnswerDefault || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
sudo shutdown -r now
echo
echo "A2SERVER: Preparing to restart..."
@ -263,12 +263,12 @@ if (( $doSetup )); then
fi
if [[ -f /tmp/singleUser ]]; then
if [[ ! $autoAnswerYes ]]; then
if [[ ! $autoAnswerDefault ]]; then
echo "Your Raspberry Pi was started in single-user mode in order to"
echo -n "fix a problem. You should restart to operate normally. Restart now? "
read
fi
if [[ $autoAnswerYes || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
if [[ $autoAnswerDefault || ${REPLY:0:1} == "Y" || ${REPLY:0:1} == "y" ]]; then
sudo shutdown -r now
echo
echo "A2SERVER: Preparing to restart..."
@ -286,7 +286,7 @@ fi
unset a2server_update 2> /dev/null
unset doSetup 2> /dev/null
rm /tmp/a2server-autoAnswerYes 2> /dev/null
rm /tmp/a2server-autoAnswerDefault 2> /dev/null
rm /tmp/a2server-packageReposUpdated 2> /dev/null
rm /tmp/a2server-setupNetBoot 2> /dev/null
rm /tmp/a2server-setupWindowsSharing 2> /dev/null

View File

@ -14,10 +14,10 @@ case "$A2SERVER_SCRIPT_URL" in
*) scriptURL="${A2SERVER_SCRIPT_URL:-http://appleii.ivanx.com/a2server}/" ;;
esac
autoAnswerYes=
autoAnswerDefault=
for arg in $@; do
if [[ $arg == "-y" ]]; then
autoAnswerYes=1
autoAnswerDefault=1
break
fi
done
@ -29,7 +29,7 @@ echo
echo "installed version: ${installedVersion:0:1}.${installedVersion:1:1}.${installedVersion:2:1}"
echo "current version: ${currentVersion:0:1}.${currentVersion:1:1}.${currentVersion:2:1}"
echo
if [[ $autoAnswerYes ]]; then
if [[ $autoAnswerDefault ]]; then
REPLY="y"
else
echo -n "Do you want to update (or reinstall) A2SERVER? "