mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-28 09:03:17 +00:00
parent
3f40a95929
commit
332baed4bb
1 changed files with 35 additions and 24 deletions
|
@ -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,28 +140,34 @@ 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
|
||||||
IPv4)useIPv4=true;;
|
IPv4)useIPv4=true;;
|
||||||
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
|
||||||
echo "::: Using IPv4 on $IPv4addr"
|
echo "::: Using IPv4 on $IPv4addr"
|
||||||
echo "::: IPv6 will NOT be used."
|
echo "::: IPv6 will NOT be used."
|
||||||
fi
|
fi
|
||||||
if [ ! $useIPv4 ] && [ $useIPv6 ]; then
|
if [ ! $useIPv4 ] && [ $useIPv6 ]; then
|
||||||
useIPv6dialog
|
useIPv6dialog
|
||||||
echo "::: IPv4 will NOT be used."
|
echo "::: IPv4 will NOT be used."
|
||||||
echo "::: Using IPv6 on $piholeIPv6"
|
echo "::: Using IPv6 on $piholeIPv6"
|
||||||
fi
|
fi
|
||||||
if [ $useIPv4 ] && [ $useIPv6 ]; then
|
if [ $useIPv4 ] && [ $useIPv6 ]; then
|
||||||
getStaticIPv4Settings
|
getStaticIPv4Settings
|
||||||
setStaticIPv4
|
setStaticIPv4
|
||||||
useIPv6dialog
|
useIPv6dialog
|
||||||
echo "::: Using IPv4 on $IPv4addr"
|
echo "::: Using IPv4 on $IPv4addr"
|
||||||
echo "::: Using IPv6 on $piholeIPv6"
|
echo "::: Using IPv6 on $piholeIPv6"
|
||||||
fi
|
fi
|
||||||
|
@ -165,7 +176,7 @@ done
|
||||||
echo "::: Exiting"
|
echo "::: Exiting"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
useIPv6dialog()
|
useIPv6dialog()
|
||||||
|
@ -311,7 +322,7 @@ $SUDO echo "::: ...done."
|
||||||
installWebAdmin(){
|
installWebAdmin(){
|
||||||
$SUDO echo " "
|
$SUDO echo " "
|
||||||
$SUDO echo "::: Downloading and installing latest WebAdmin files..."
|
$SUDO echo "::: Downloading and installing latest WebAdmin files..."
|
||||||
if [ -d "/var/www/html/admin" ]; then
|
if [ -d "/var/www/html/admin" ]; then
|
||||||
$SUDO rm -rf /var/www/html/admin
|
$SUDO rm -rf /var/www/html/admin
|
||||||
fi
|
fi
|
||||||
if [ -d "/var/www/html/AdminLTE-master" ]; then
|
if [ -d "/var/www/html/AdminLTE-master" ]; then
|
||||||
|
@ -327,7 +338,7 @@ $SUDO echo "::: Creating log file and changing owner to dnsmasq..."
|
||||||
if [ ! -f /var/log/pihole.log ]; then
|
if [ ! -f /var/log/pihole.log ]; then
|
||||||
$SUDO touch /var/log/pihole.log
|
$SUDO touch /var/log/pihole.log
|
||||||
$SUDO chmod 644 /var/log/pihole.log
|
$SUDO chmod 644 /var/log/pihole.log
|
||||||
$SUDO chown dnsmasq:root /var/log/pihole.log
|
$SUDO chown dnsmasq:root /var/log/pihole.log
|
||||||
else
|
else
|
||||||
$SUDO echo "::: No need to create, already exists!"
|
$SUDO echo "::: No need to create, already exists!"
|
||||||
fi
|
fi
|
||||||
|
@ -338,12 +349,12 @@ $SUDO echo "::: ...done."
|
||||||
installPiholeWeb(){
|
installPiholeWeb(){
|
||||||
$SUDO echo " "
|
$SUDO echo " "
|
||||||
$SUDO echo "::: Downloading and installing pihole custom index page..."
|
$SUDO echo "::: Downloading and installing pihole custom index page..."
|
||||||
if [ -d "/var/www/html/pihole" ]; then
|
if [ -d "/var/www/html/pihole" ]; then
|
||||||
$SUDO echo "::: Existing page detected, not overwriting"
|
$SUDO echo "::: Existing page detected, not overwriting"
|
||||||
else
|
else
|
||||||
$SUDO mkdir /var/www/html/pihole
|
$SUDO mkdir /var/www/html/pihole
|
||||||
$SUDO mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.orig
|
$SUDO mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.orig
|
||||||
$SUDO curl -o /var/www/html/pihole/index.html https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/index.html
|
$SUDO curl -o /var/www/html/pihole/index.html https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/index.html
|
||||||
fi
|
fi
|
||||||
$SUDO echo "::: ...done."
|
$SUDO echo "::: ...done."
|
||||||
}
|
}
|
||||||
|
@ -420,4 +431,4 @@ $SUDO mv $tmpLog $instalLogLoc
|
||||||
displayFinalMessage
|
displayFinalMessage
|
||||||
|
|
||||||
$SUDO service dnsmasq start
|
$SUDO service dnsmasq start
|
||||||
$SUDO service lighttpd start
|
$SUDO service lighttpd start
|
||||||
|
|
Loading…
Reference in a new issue