diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 74e2a61d..a3c41b11 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1485,8 +1485,7 @@ finalExports() { # If the setup variable file exists, if [ -e "${setupVars}" ]; then - # update the variables in the file - sed -i.update.bak '/PIHOLE_INTERFACE/d;/IPV4_ADDRESS/d;/IPV6_ADDRESS/d;/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;/QUERY_LOGGING/d;/INSTALL_WEB/d;' "${setupVars}" + sed -i.update.bak '/PIHOLE_INTERFACE/d;/IPV4_ADDRESS/d;/IPV6_ADDRESS/d;/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;/QUERY_LOGGING/d;/INSTALL_WEB/d;/LIGHTTPD_ENABLED/d;' "${setupVars}" fi # echo the information to the user { @@ -1497,6 +1496,7 @@ finalExports() { echo "PIHOLE_DNS_2=${PIHOLE_DNS_2}" echo "QUERY_LOGGING=${QUERY_LOGGING}" echo "INSTALL_WEB=${INSTALL_WEB}" + echo "LIGHTTPD_ENABLED=${LIGHTTPD_ENABLED}" }>> "${setupVars}" # Look for DNS server settings which would have to be reapplied @@ -1585,9 +1585,6 @@ installPihole() { FTLdetect || echo -e " ${CROSS} FTL Engine not installed." # Configure the firewall configureFirewall - # Run the final exports - finalExports - #runGravity } # At some point in the future this list can be pruned, for now we'll need it to ensure updates don't break. @@ -1621,8 +1618,8 @@ updatePihole() { installLogrotate # Detect if FTL is installed FTLdetect || echo -e " ${CROSS} FTL Engine not installed." - finalExports #re-export setupVars.conf to account for any new vars added in new versions - #runGravity + + } @@ -2052,10 +2049,24 @@ main() { enable_service dnsmasq # If the Web server was installed, - if [[ ${INSTALL_WEB} == true ]]; then - # enable it - start_service lighttpd - enable_service lighttpd + if [[ "${INSTALL_WEB}" == true ]]; then + # Check to see if lighttpd was already set to run on reboot + if [[ "${useUpdateVars}" == true ]]; then + if [[ -x "$(command -v systemctl)" ]]; then + # Value will either be 1, if true, or 0 + LIGHTTPD_ENABLED=$(systemctl is-enabled lighttpd | grep -c 'enabled' || true) + else + # Value will either be 1, if true, or 0 + LIGHTTPD_ENABLED=$(service lighttpd status | awk '/Loaded:/ {print $0}' | grep -c 'enabled' || true) + fi + fi + + if [[ "${LIGHTTPD_ENABLED}" == "1" ]]; then + start_service lighttpd + enable_service lighttpd + else + echo -e " ${INFO} Lighttpd is disabled, skipping service restart" + fi fi # Download and compile the aggregated block list @@ -2103,6 +2114,8 @@ main() { # Display where the log file is echo -e "\n ${INFO} The install log is located at: /etc/pihole/install.log ${COL_LIGHT_GREEN}${INSTALL_TYPE} Complete! ${COL_NC}" + #update setupvars.conf with any variables that may or may not have been changed during the install + finalExports } #