mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-28 17:13:17 +00:00
choose an interface
also fixing ipv6 logic
This commit is contained in:
parent
f8a6703eab
commit
e222a1d5e9
1 changed files with 51 additions and 9 deletions
|
@ -63,6 +63,40 @@ whiptail --msgbox --backtitle "Initating network interface" --title "Static IP N
|
||||||
In the next section, you can choose to use your current network settings (DHCP) or to manually edit them." $r $c
|
In the next section, you can choose to use your current network settings (DHCP) or to manually edit them." $r $c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chooseInterface()
|
||||||
|
{
|
||||||
|
# Turn the available interfaces into an array so it can be used with a whiptail dialog
|
||||||
|
interfacesArray=()
|
||||||
|
while read -r line
|
||||||
|
do
|
||||||
|
interfacesArray+=("$line" "available" "OFF")
|
||||||
|
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)
|
||||||
|
chooseInterfaceOptions=$("${chooseInterfaceCmd[@]}" "${interfacesArray[@]}" 2>&1 >/dev/tty)
|
||||||
|
for desiredInterface in $chooseInterfaceOptions
|
||||||
|
do
|
||||||
|
piholeInterface=$desiredInterface
|
||||||
|
# case $chooseInterfaceOptions in
|
||||||
|
# eth0)
|
||||||
|
# echo "Ethernet"
|
||||||
|
# useIPv4=true
|
||||||
|
# ;;
|
||||||
|
# IPv6)
|
||||||
|
# echo "IPv6 selected."
|
||||||
|
# useIPv6=true
|
||||||
|
# ;;
|
||||||
|
# esac
|
||||||
|
# chosenInterface="$desiredInterface"
|
||||||
|
# echo "$desiredInterface"
|
||||||
|
echo "Chosen: $piholeInterface"
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
use4andor6()
|
use4andor6()
|
||||||
{
|
{
|
||||||
# Let use select IPv4 and/or IPv6
|
# Let use select IPv4 and/or IPv6
|
||||||
|
@ -86,6 +120,11 @@ do
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useIPv6dialog()
|
||||||
|
{
|
||||||
|
whiptail --msgbox --backtitle "Coming soon..." --title "IPv6 not yet supported" "I need your help for IPv6. Consider donating at: http://pi-hole.net/donate" $r $c
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
getStaticIPv4Settings()
|
getStaticIPv4Settings()
|
||||||
{
|
{
|
||||||
|
@ -215,6 +254,8 @@ welcomeDialogs
|
||||||
# Just back up the original Pi-hole right away since it won't take long and it gets it out of the way
|
# Just back up the original Pi-hole right away since it won't take long and it gets it out of the way
|
||||||
backupLegacyPihole
|
backupLegacyPihole
|
||||||
|
|
||||||
|
chooseInterface
|
||||||
|
|
||||||
# Let the user decide if they want to block ads over IPv4 and/or IPv6
|
# Let the user decide if they want to block ads over IPv4 and/or IPv6
|
||||||
use4andor6
|
use4andor6
|
||||||
|
|
||||||
|
@ -224,23 +265,24 @@ if [[ "$useIPv4" = true ]];then
|
||||||
getStaticIPv4Settings
|
getStaticIPv4Settings
|
||||||
setStaticIPv4
|
setStaticIPv4
|
||||||
else
|
else
|
||||||
|
useIPv4=false
|
||||||
echo "IPv4 will NOT be used."
|
echo "IPv4 will NOT be used."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Decide is IPv6 will be used
|
# Decide is IPv6 will be used
|
||||||
if [[ "$useIPv6" = true ]];then
|
if [[ "$useIPv6" = true ]];then
|
||||||
whiptail --msgbox --backtitle "Coming soon..." --title "IPv6 not yet supported" "I need your help. Consider donating at:
|
# If only IPv6 is selected, exit because it is not supported yet
|
||||||
|
if [[ "$useIPv6" = true ]] && [[ "$useIPv4" = false ]];then
|
||||||
http://pi-hole.net/donate" $r $c
|
useIPv6dialog
|
||||||
echo "Using IPv6"
|
exit
|
||||||
|
else
|
||||||
|
useIPv6dialog
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
whiptail --msgbox --backtitle "Coming soon..." --title "IPv6 not yet supported" "I need your help. Consider donating at:
|
useIPv6=false
|
||||||
|
|
||||||
http://pi-hole.net/donate" $r $c
|
|
||||||
echo "IPv6 will NOT be used."
|
echo "IPv6 will NOT be used."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Install and log everything to a file
|
# Install and log everything to a file
|
||||||
installPihole | tee $tmpLog
|
installPihole | tee $tmpLog
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue