mirror of
https://github.com/pi-hole/pi-hole
synced 2024-11-18 06:08:21 +00:00
reboot logic
This commit is contained in:
parent
0936e394d4
commit
814873c643
@ -69,7 +69,7 @@ chooseInterface()
|
|||||||
interfacesArray=()
|
interfacesArray=()
|
||||||
while read -r line
|
while read -r line
|
||||||
do
|
do
|
||||||
interfacesArray+=("$line" "available" "OFF")
|
interfacesArray+=("$line" "available" "ON")
|
||||||
done <<< "$availableInterfaces"
|
done <<< "$availableInterfaces"
|
||||||
|
|
||||||
# Find out how many interfaces are available to choose from
|
# Find out how many interfaces are available to choose from
|
||||||
@ -79,22 +79,8 @@ chooseInterfaceOptions=$("${chooseInterfaceCmd[@]}" "${interfacesArray[@]}" 2>&1
|
|||||||
for desiredInterface in $chooseInterfaceOptions
|
for desiredInterface in $chooseInterfaceOptions
|
||||||
do
|
do
|
||||||
piholeInterface=$desiredInterface
|
piholeInterface=$desiredInterface
|
||||||
# case $chooseInterfaceOptions in
|
echo "Using interface: $piholeInterface"
|
||||||
# eth0)
|
|
||||||
# echo "Ethernet"
|
|
||||||
# useIPv4=true
|
|
||||||
# ;;
|
|
||||||
# IPv6)
|
|
||||||
# echo "IPv6 selected."
|
|
||||||
# useIPv6=true
|
|
||||||
# ;;
|
|
||||||
# esac
|
|
||||||
# chosenInterface="$desiredInterface"
|
|
||||||
# echo "$desiredInterface"
|
|
||||||
echo "Chosen: $piholeInterface"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
use4andor6()
|
use4andor6()
|
||||||
@ -125,7 +111,6 @@ 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
|
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()
|
||||||
{
|
{
|
||||||
# Ask if the user wannts to use DHCP settings as their static IP
|
# Ask if the user wannts to use DHCP settings as their static IP
|
||||||
@ -142,6 +127,8 @@ if (whiptail --backtitle "Calibrating network interface" --title "Static IP Addr
|
|||||||
It is also possible to use a DHCP reservation, but if you are going to do that, you might as well set a static address." $r $c
|
It is also possible to use a DHCP reservation, but if you are going to do that, you might as well set a static address." $r $c
|
||||||
# Nothing else to do since the variables are already set above
|
# Nothing else to do since the variables are already set above
|
||||||
else
|
else
|
||||||
|
# Since a custom address will be used, restart at the end of the script to apply the new changes
|
||||||
|
rebootNeeded=true
|
||||||
# Otherwise, we need to ask the user to input their desired settings.
|
# Otherwise, we need to ask the user to input their desired settings.
|
||||||
# Start by getting the IPv4 address (pre-filling it with info gathered from DHCP)
|
# Start by getting the IPv4 address (pre-filling it with info gathered from DHCP)
|
||||||
# Start a loop to let the user enter their information with the chance to go back and edit it if necessary
|
# Start a loop to let the user enter their information with the chance to go back and edit it if necessary
|
||||||
@ -240,6 +227,7 @@ sudo chown dnsmasq:root /var/log/pihole.log
|
|||||||
sudo curl -o /usr/local/bin/gravity.sh https://raw.githubusercontent.com/jacobsalmela/pi-hole/installation/gravity.sh
|
sudo curl -o /usr/local/bin/gravity.sh https://raw.githubusercontent.com/jacobsalmela/pi-hole/installation/gravity.sh
|
||||||
sudo curl -o /usr/local/bin/chronometer.sh https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/Scripts/chronometer.sh
|
sudo curl -o /usr/local/bin/chronometer.sh https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/Scripts/chronometer.sh
|
||||||
sudo curl -o /usr/local/bin/whitelist.sh https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/Scripts/whitelist.sh
|
sudo curl -o /usr/local/bin/whitelist.sh https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/Scripts/whitelist.sh
|
||||||
|
sudo curl -o /usr/local/bin/piholeLogFlush.sh https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/Scripts/piholeLogFlush.sh
|
||||||
sudo chmod 755 /usr/local/bin/gravity.sh
|
sudo chmod 755 /usr/local/bin/gravity.sh
|
||||||
sudo chmod 755 /usr/local/bin/chronometer.sh
|
sudo chmod 755 /usr/local/bin/chronometer.sh
|
||||||
sudo chmod 755 /usr/local/bin/whitelist.sh
|
sudo chmod 755 /usr/local/bin/whitelist.sh
|
||||||
@ -254,6 +242,7 @@ 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
|
||||||
|
|
||||||
|
# Find interfaces and let the user choose one
|
||||||
chooseInterface
|
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
|
||||||
@ -280,7 +269,7 @@ if [[ "$useIPv6" = true ]];then
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
useIPv6=false
|
useIPv6=false
|
||||||
echo "IPv6 will NOT be used."
|
echo "IPv6 will NOT be used. Consider a donation at pi-hole.net/donate"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install and log everything to a file
|
# Install and log everything to a file
|
||||||
@ -291,16 +280,16 @@ sudo mv $tmpLog $instalLogLoc
|
|||||||
|
|
||||||
whiptail --msgbox --backtitle "Make it so." --title "Installation Complete!" "Configure your devices to use the Pi-hole as their DNS server using this IP: $IPv4addr.
|
whiptail --msgbox --backtitle "Make it so." --title "Installation Complete!" "Configure your devices to use the Pi-hole as their DNS server using this IP: $IPv4addr.
|
||||||
|
|
||||||
Your Pi will restart when you close this dialog. If you are using SSH, reconnect using the IP address above.
|
If you didn't use DHCP settings as your new static address, the Pi will restart after this dialog. If you are using SSH, you may need to reconnect using the IP address above.
|
||||||
|
|
||||||
The install log is in /etc/phole." $r $c
|
The install log is in /etc/phole." $r $c
|
||||||
|
|
||||||
# If the current IP address equals the desired address, no change is needed
|
# If a custom address was set, restart
|
||||||
if [[ $IPv4addr = "$(cat /tmp/piholeIP)" ]];then
|
if [[ "$rebootNeeded" = true ]];then
|
||||||
# So just start the services
|
|
||||||
echo "sudo service dnsmasq start"
|
|
||||||
echo "sudo service lighttpd start"
|
|
||||||
else
|
|
||||||
# Restart to apply the new static IP address
|
# Restart to apply the new static IP address
|
||||||
echo "sudo reboot"
|
sudo reboot
|
||||||
|
else
|
||||||
|
# If not, just start the services since the address will stay the same
|
||||||
|
sudo service dnsmasq start
|
||||||
|
sudo service lighttpd start
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user