use the web install flag. Could be optimised

pull/1182/head
Promofaux 7 years ago
parent dfdb9e393b
commit f8322cc2d4

@ -994,7 +994,9 @@ installPihole() {
installScripts installScripts
installConfigs installConfigs
CreateLogFile CreateLogFile
if [[ ${INSTALL_WEB} == true ]]; then
installPiholeWeb installPiholeWeb
fi
installCron installCron
installLogrotate installLogrotate
configureFirewall configureFirewall
@ -1025,7 +1027,9 @@ updatePihole() {
installScripts installScripts
installConfigs installConfigs
CreateLogFile CreateLogFile
if [[ ${INSTALL_WEB} == true ]]; then
installPiholeWeb installPiholeWeb
fi
installCron installCron
installLogrotate installLogrotate
finalExports #re-export setupVars.conf to account for any new vars added in new versions finalExports #re-export setupVars.conf to account for any new vars added in new versions
@ -1188,7 +1192,9 @@ main() {
mkdir -p /etc/pihole/ mkdir -p /etc/pihole/
# Stop resolver and webserver while installing proceses # Stop resolver and webserver while installing proceses
stop_service dnsmasq stop_service dnsmasq
if [[ ${INSTALL_WEB} == true ]]; then
stop_service lighttpd stop_service lighttpd
fi
# Determine available interfaces # Determine available interfaces
get_available_interfaces get_available_interfaces
# Find interfaces and let the user choose one # Find interfaces and let the user choose one
@ -1227,25 +1233,31 @@ main() {
# Move the log file into /etc/pihole for storage # Move the log file into /etc/pihole for storage
mv ${tmpLog} ${instalLogLoc} mv ${tmpLog} ${instalLogLoc}
if [[ ${INSTALL_WEB} == true ]]; then
# Add password to web UI if there is none # Add password to web UI if there is none
pw="" pw=""
if [[ $(grep 'WEBPASSWORD' -c /etc/pihole/setupVars.conf) == 0 ]] ; then if [[ $(grep 'WEBPASSWORD' -c /etc/pihole/setupVars.conf) == 0 ]] ; then
pw=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8) pw=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8)
/usr/local/bin/pihole -a -p "${pw}" /usr/local/bin/pihole -a -p "${pw}"
fi fi
if [[ "${useUpdateVars}" == false ]]; then
displayFinalMessage "${pw}"
fi fi
echo "::: Restarting services..." echo "::: Restarting services..."
# Start services # Start services
start_service dnsmasq start_service dnsmasq
enable_service dnsmasq enable_service dnsmasq
if [[ ${INSTALL_WEB} == true ]]; then
start_service lighttpd start_service lighttpd
enable_service lighttpd enable_service lighttpd
fi
echo "::: done." echo "::: done."
if [[ "${useUpdateVars}" == false ]]; then
displayFinalMessage "${pw}"
fi
echo ":::" echo ":::"
if [[ "${useUpdateVars}" == false ]]; then if [[ "${useUpdateVars}" == false ]]; then
echo "::: Installation Complete! Configure your devices to use the Pi-hole as their DNS server using:" echo "::: Installation Complete! Configure your devices to use the Pi-hole as their DNS server using:"
@ -1253,11 +1265,14 @@ main() {
echo "::: ${IPV6_ADDRESS}" echo "::: ${IPV6_ADDRESS}"
echo ":::" echo ":::"
echo "::: If you set a new IP address, you should restart the Pi." echo "::: If you set a new IP address, you should restart the Pi."
if [[ ${INSTALL_WEB} == true ]]; then
echo "::: View the web interface at http://pi.hole/admin or http://${IPV4_ADDRESS%/*}/admin" echo "::: View the web interface at http://pi.hole/admin or http://${IPV4_ADDRESS%/*}/admin"
fi
else else
echo "::: Update complete!" echo "::: Update complete!"
fi fi
if [[ ${INSTALL_WEB} == true ]]; then
if (( ${#pw} > 0 )) ; then if (( ${#pw} > 0 )) ; then
echo ":::" echo ":::"
echo "::: Note: As security measure a password has been installed for your web interface" echo "::: Note: As security measure a password has been installed for your web interface"
@ -1267,6 +1282,7 @@ main() {
echo "::: You can always change it using" echo "::: You can always change it using"
echo "::: pihole -a -p new_password" echo "::: pihole -a -p new_password"
fi fi
fi
echo ":::" echo ":::"
echo "::: The install log is located at: /etc/pihole/install.log" echo "::: The install log is located at: /etc/pihole/install.log"

Loading…
Cancel
Save