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()
{
# Turn the available interfaces into an array so it can be used with a whiptail dialog
interfacesArray=()
firstloop=1
if [[ $chooseInterfaceOptions ]];then
interfacesArray=()
firstloop=1
while read -r line
do
mode="OFF"
if [[ $firstloop -eq 1 ]]; then
firstloop=0
mode="ON"
while read -r line
do
mode="OFF"
if [[ $firstloop -eq 1 ]]; then
firstloop=0
mode="ON"
fi
interfacesArray+=("$line" "available" "$mode")
done <<< "$availableInterfaces"
else
# Exit if user cancels
echo "Cancelling installation."
exit
fi
interfacesArray+=("$line" "available" "$mode")
done <<< "$availableInterfaces"
# Find out how many interfaces are available to choose from
interfaceCount=$(echo "$availableInterfaces" | wc -l)
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
IPv6 "Block ads over IPv6" off)
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
if [[ $choices ]];then
for choice in $choices
do
case $choice in
@ -142,6 +148,11 @@ do
IPv6)useIPv6=true;;
esac
done
else
# Exit if user cancels
echo "Cancelling installation."
exit
fi
if [ $useIPv4 ] && [ ! $useIPv6 ]; then
getStaticIPv4Settings
setStaticIPv4