Lets the user stop the install if cancel is selected.
This commit is contained in:
jacobsalmela 2016-01-21 06:51:16 -06:00
parent 3f40a95929
commit 332baed4bb

View file

@ -103,19 +103,24 @@ In the next section, you can choose to use your current network settings (DHCP)
chooseInterface() chooseInterface()
{ {
# Turn the available interfaces into an array so it can be used with a whiptail dialog # Turn the available interfaces into an array so it can be used with a whiptail dialog
interfacesArray=() if [[ $chooseInterfaceOptions ]];then
firstloop=1 interfacesArray=()
firstloop=1
while read -r line while read -r line
do do
mode="OFF" mode="OFF"
if [[ $firstloop -eq 1 ]]; then if [[ $firstloop -eq 1 ]]; then
firstloop=0 firstloop=0
mode="ON" mode="ON"
fi
interfacesArray+=("$line" "available" "$mode")
done <<< "$availableInterfaces"
else
# Exit if user cancels
echo "Cancelling installation."
exit
fi fi
interfacesArray+=("$line" "available" "$mode")
done <<< "$availableInterfaces"
# Find out how many interfaces are available to choose from # Find out how many interfaces are available to choose from
interfaceCount=$(echo "$availableInterfaces" | wc -l) interfaceCount=$(echo "$availableInterfaces" | wc -l)
chooseInterfaceCmd=(whiptail --separate-output --radiolist "Choose An Interface" $r $c $interfaceCount) chooseInterfaceCmd=(whiptail --separate-output --radiolist "Choose An Interface" $r $c $interfaceCount)
@ -135,6 +140,7 @@ cmd=(whiptail --separate-output --checklist "Select Protocols" $r $c 2)
options=(IPv4 "Block ads over IPv4" on options=(IPv4 "Block ads over IPv4" on
IPv6 "Block ads over IPv6" off) IPv6 "Block ads over IPv6" off)
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
if [[ $choices ]];then
for choice in $choices for choice in $choices
do do
case $choice in case $choice in
@ -142,6 +148,11 @@ do
IPv6)useIPv6=true;; IPv6)useIPv6=true;;
esac esac
done done
else
# Exit if user cancels
echo "Cancelling installation."
exit
fi
if [ $useIPv4 ] && [ ! $useIPv6 ]; then if [ $useIPv4 ] && [ ! $useIPv6 ]; then
getStaticIPv4Settings getStaticIPv4Settings
setStaticIPv4 setStaticIPv4