Merge pull request #424 from pi-hole/PiHoleController

Indentation fix
This commit is contained in:
Adam Warner 2016-04-03 23:28:03 +01:00
commit 3e6dd9ea9e

View file

@ -151,7 +151,7 @@ chooseInterface() {
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)
chooseInterfaceOptions=$("${chooseInterfaceCmd[@]}" "${interfacesArray[@]}" 2>&1 >/dev/tty) chooseInterfaceOptions=$("${chooseInterfaceCmd[@]}" "${interfacesArray[@]}" 2>&1 >/dev/tty)
if [[ $? = 0 ]];then if [[ $? = 0 ]]; then
for desiredInterface in $chooseInterfaceOptions for desiredInterface in $chooseInterfaceOptions
do do
piholeInterface=$desiredInterface piholeInterface=$desiredInterface
@ -358,9 +358,7 @@ setDNS(){
Custom) Custom)
until [[ $DNSSettingsCorrect = True ]] until [[ $DNSSettingsCorrect = True ]]
do do
strInvalid="Invalid" strInvalid="Invalid"
if [ ! $piholeDNS1 ]; then if [ ! $piholeDNS1 ]; then
if [ ! $piholeDNS2 ]; then if [ ! $piholeDNS2 ]; then
prePopulate="" prePopulate=""
@ -372,36 +370,28 @@ setDNS(){
elif [ $piholeDNS1 ] && [ $piholeDNS2 ]; then elif [ $piholeDNS1 ] && [ $piholeDNS2 ]; then
prePopulate="$piholeDNS1, $piholeDNS2" prePopulate="$piholeDNS1, $piholeDNS2"
fi fi
piholeDNS=$(whiptail --backtitle "Specify Upstream DNS Provider(s)" --inputbox "Enter your desired upstream DNS provider(s), seperated by a comma.\n\nFor example '8.8.8.8, 8.8.4.4'" $r $c "$prePopulate" 3>&1 1>&2 2>&3) piholeDNS=$(whiptail --backtitle "Specify Upstream DNS Provider(s)" --inputbox "Enter your desired upstream DNS provider(s), seperated by a comma.\n\nFor example '8.8.8.8, 8.8.4.4'" $r $c "$prePopulate" 3>&1 1>&2 2>&3)
if [[ $? = 0 ]];then if [[ $? = 0 ]];then
piholeDNS1=$(echo "$piholeDNS" | sed 's/[, \t]\+/,/g' | awk -F, '{print$1}') piholeDNS1=$(echo "$piholeDNS" | sed 's/[, \t]\+/,/g' | awk -F, '{print$1}')
piholeDNS2=$(echo "$piholeDNS" | sed 's/[, \t]\+/,/g' | awk -F, '{print$2}') piholeDNS2=$(echo "$piholeDNS" | sed 's/[, \t]\+/,/g' | awk -F, '{print$2}')
if ! valid_ip "$piholeDNS1" || [ ! "$piholeDNS1" ]; then if ! valid_ip "$piholeDNS1" || [ ! "$piholeDNS1" ]; then
piholeDNS1=$strInvalid piholeDNS1=$strInvalid
fi fi
if ! valid_ip "$piholeDNS2" && [ "$piholeDNS2" ]; then if ! valid_ip "$piholeDNS2" && [ "$piholeDNS2" ]; then
piholeDNS2=$strInvalid piholeDNS2=$strInvalid
fi fi
else else
echo "::: Cancel selected, exiting...." echo "::: Cancel selected, exiting...."
exit 1 exit 1
fi fi
if [[ $piholeDNS1 == "$strInvalid" ]] || [[ $piholeDNS2 == "$strInvalid" ]]; then if [[ $piholeDNS1 == "$strInvalid" ]] || [[ $piholeDNS2 == "$strInvalid" ]]; then
whiptail --msgbox --backtitle "Invalid IP" --title "Invalid IP" "One or both entered IP addresses were invalid. Please try again.\n\n DNS Server 1: $piholeDNS1\n DNS Server 2: $piholeDNS2" $r $c whiptail --msgbox --backtitle "Invalid IP" --title "Invalid IP" "One or both entered IP addresses were invalid. Please try again.\n\n DNS Server 1: $piholeDNS1\n DNS Server 2: $piholeDNS2" $r $c
if [[ $piholeDNS1 == "$strInvalid" ]]; then if [[ $piholeDNS1 == "$strInvalid" ]]; then
piholeDNS1="" piholeDNS1=""
fi fi
if [[ $piholeDNS2 == "$strInvalid" ]]; then if [[ $piholeDNS2 == "$strInvalid" ]]; then
piholeDNS2="" piholeDNS2=""
fi fi
DNSSettingsCorrect=False DNSSettingsCorrect=False
else else
if (whiptail --backtitle "Specify Upstream DNS Provider(s)" --title "Upstream DNS Provider(s)" --yesno "Are these settings correct?\n DNS Server 1: $piholeDNS1\n DNS Server 2: $piholeDNS2" $r $c) then if (whiptail --backtitle "Specify Upstream DNS Provider(s)" --title "Upstream DNS Provider(s)" --yesno "Are these settings correct?\n DNS Server 1: $piholeDNS1\n DNS Server 2: $piholeDNS2" $r $c) then
@ -425,7 +415,6 @@ versionCheckDNSmasq(){
dnsFile1="/etc/dnsmasq.conf" dnsFile1="/etc/dnsmasq.conf"
dnsFile2="/etc/dnsmasq.conf.orig" dnsFile2="/etc/dnsmasq.conf.orig"
dnsSearch="addn-hosts=/etc/pihole/gravity.list" dnsSearch="addn-hosts=/etc/pihole/gravity.list"
defaultFile="/etc/.pihole/advanced/dnsmasq.conf.original" defaultFile="/etc/.pihole/advanced/dnsmasq.conf.original"
newFileToInstall="/etc/.pihole/advanced/01-pihole.conf" newFileToInstall="/etc/.pihole/advanced/01-pihole.conf"
newFileFinalLocation="/etc/dnsmasq.d/01-pihole.conf" newFileFinalLocation="/etc/dnsmasq.d/01-pihole.conf"
@ -527,7 +516,6 @@ checkForDependencies() {
#requiring user input (e.g password for phpmyadmin see #218) #requiring user input (e.g password for phpmyadmin see #218)
#We'll change the logic up here, to check to see if there are any updates availible and #We'll change the logic up here, to check to see if there are any updates availible and
# if so, advise the user to run apt-get update/upgrade at their own discretion # if so, advise the user to run apt-get update/upgrade at their own discretion
#Check to see if apt-get update has already been run today #Check to see if apt-get update has already been run today
# it needs to have been run at least once on new installs! # it needs to have been run at least once on new installs!
@ -707,12 +695,12 @@ displayFinalMessage() {
# Final completion message to user # Final completion message to user
whiptail --msgbox --backtitle "Make it so." --title "Installation Complete!" "Configure your devices to use the Pi-hole as their DNS server using: whiptail --msgbox --backtitle "Make it so." --title "Installation Complete!" "Configure your devices to use the Pi-hole as their DNS server using:
$IPv4addr $IPv4addr
$piholeIPv6 $piholeIPv6
If you set a new IP address, you should restart the Pi. If you set a new IP address, you should restart the Pi.
The install log is in /etc/pihole." $r $c The install log is in /etc/pihole." $r $c
} }
######## SCRIPT ############ ######## SCRIPT ############