Fix/unbreak development (#1635)

* Always process DNS and DHCP settings in installer

* change where finalExports is called and where LIGHTTPD_ENABLED is set.

Signed-off-by: Adam Warner <adamw@rner.email>

* this may or may not work. If it does, can be functionised to reduce code duping

Signed-off-by: Adam Warner <adamw@rner.email>

* This will fix the tests, but break the patch

Signed-off-by: Adam Warner <adamw@rner.email>
This commit is contained in:
Adam Warner 2017-07-26 14:34:40 +01:00 committed by GitHub
parent a77136bd1d
commit c02a24cf71

View file

@ -1499,22 +1499,20 @@ finalExports() {
echo "LIGHTTPD_ENABLED=${LIGHTTPD_ENABLED}"
}>> "${setupVars}"
# Look for DNS server settings which would have to be reapplied
# Bring in the current settings and the functions to manipulate them
source "${setupVars}"
#
source "${PI_HOLE_LOCAL_REPO}/advanced/Scripts/webpage.sh"
#
if [[ "${DNS_FQDN_REQUIRED}" != "" ]] ; then
#
# Look for DNS server settings which would have to be reapplied
ProcessDNSSettings
fi
#
if [[ "${DHCP_ACTIVE}" != "" ]] ; then
#
# Look for DHCP server settings which would have to be reapplied
ProcessDHCPSettings
fi
}
# Install the logrotate script
@ -1585,6 +1583,9 @@ installPihole() {
FTLdetect || echo -e " ${CROSS} FTL Engine not installed."
# Configure the firewall
configureFirewall
#update setupvars.conf with any variables that may or may not have been changed during the install
finalExports
}
# At some point in the future this list can be pruned, for now we'll need it to ensure updates don't break.
@ -1619,6 +1620,8 @@ updatePihole() {
# Detect if FTL is installed
FTLdetect || echo -e " ${CROSS} FTL Engine not installed."
#update setupvars.conf with any variables that may or may not have been changed during the install
finalExports
}
@ -2034,6 +2037,13 @@ main() {
fi
install_dependent_packages DEPS[@]
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
# Install and log everything to a file
installPihole | tee ${tmpLog}
@ -2055,6 +2065,14 @@ main() {
fi
install_dependent_packages DEPS[@]
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
updatePihole | tee ${tmpLog}
fi
@ -2080,16 +2098,6 @@ main() {
# If the Web server was installed,
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
@ -2144,8 +2152,7 @@ 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
}
#