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

View File

@@ -3,16 +3,16 @@
# Set up A2SERVER to support Samba (Windows File Sharing) # Set up A2SERVER to support Samba (Windows File Sharing)
# this script can also be used if new shares are introduced # 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
echo -n "Should Windows computers be able to connect to A2SERVER? " echo -n "Should Windows computers be able to connect to A2SERVER? "
read read
fi 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..." echo "A2SERVER: Setting up Windows file sharing..."
sudo true 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=$(grep -o "^ workgroup = .*$" /etc/samba/smb.conf 2> /dev/null | cut -c 16-)
[[ $workgroup ]] || workgroup="WORKGROUP" [[ $workgroup ]] || workgroup="WORKGROUP"
if [[ ! $autoAnswerYes ]]; then if [[ ! $autoAnswerDefault ]]; then
echo echo
echo "Enter workgroup name (or press return for '${workgroup}'): " echo "Enter workgroup name (or press return for '${workgroup}'): "
read 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 "- eliminate a harmless but annoying startup error about piix_smbus"
echo "- fix an Ubuntu 10.04 issue with slow scrolling" echo "- fix an Ubuntu 10.04 issue with slow scrolling"
echo echo
if [[ ! $autoAnswerYes ]]; then if [[ ! $autoAnswerDefault ]]; then
echo -n "Do you want to optimize the Ubuntu console? " echo -n "Do you want to optimize the Ubuntu console? "
read read
fi 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..." echo "A2SERVER: Optimizing console..."

View File

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