mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Avoid reactivating a deactivated lighttpd service (#1485)
* Do not activate disabled lighttpd upon update * Fixes #1362 * Use systemctl when available * Move `finalexports` to the very end of the install script set value of LIGHTTPD_ENABLED to 1 or 0 depending on whether or not lighttpd is enabled or disabled. actually save LIGHTTPD_ENABLED value to setupvars.conf Signed-off-by: Adam Warner <adamw@rner.email> * add [[ -z "${LIGHTTPD_ENABLED}" ]] back in! Signed-off-by: Adam Warner <adamw@rner.email> * Ensure "Loaded:" is the line being checked * Colourise disabled lighttpd message * Prevent disabled lighttpd triggering error * change of plan, don't need that [[ -z "${LIGHTTPD_ENABLED}" ]] Signed-off-by: Adam Warner <adamw@rner.email>
This commit is contained in:
parent
3a50b91722
commit
c9a98b68c8
1 changed files with 24 additions and 11 deletions
|
@ -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
|
||||
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
|
||||
}
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue