1
0
mirror of https://github.com/pi-hole/pi-hole synced 2025-01-03 04:30:55 +00:00

Disable lighttpd if found (#5835)

This commit is contained in:
Dominik 2024-12-30 17:01:04 +01:00 committed by GitHub
commit b0e0bdc436
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2300,6 +2300,39 @@ copy_to_install_log() {
chown pihole:pihole "${installLogLoc}"
}
disableLighttpd() {
local response
# Detect if the terminal is interactive
if [[ -t 0 ]]; then
# The terminal is interactive
dialog --no-shadow --keep-tite \
--title "Pi-hole v6.0 no longer uses lighttpd" \
--yesno "\\n\\nPi-hole v6.0 has its own embedded web server so lighttpd is no longer needed *unless* you have custom configurations.\\n\\nIn this case, you can opt-out of disabling lighttpd and pihole-FTL will try to bind to an alternative port such as 8080.\\n\\nDo you want to disable lighttpd (recommended)?" "${r}" "${c}" && response=0 || response="$?"
else
# The terminal is non-interactive, assume yes. Lighttpd will be stopped
# but keeps being installed and can easily be re-enabled by the user
response=0
fi
# If the user does not want to disable lighttpd, return early
if [[ "${response}" -ne 0 ]]; then
return
fi
# Lighttpd is not needed anymore, so disable it
# We keep all the configuration files in place, so the user can re-enable it
# if needed
# Check if lighttpd is installed
if is_command lighttpd; then
# Stop the lighttpd service
stop_service lighttpd
# Disable the lighttpd service
disable_service lighttpd
fi
}
migrate_dnsmasq_configs() {
# Previously, Pi-hole created a number of files in /etc/dnsmasq.d
# During migration, their content is copied into the new single source of
@ -2503,6 +2536,9 @@ main() {
# but before starting or resttarting the ftl service
disable_resolved_stublistener
# Disable lighttpd server
disableLighttpd
# Check if gravity database needs to be upgraded. If so, do it without rebuilding
# gravity altogether. This may be a very long running task needlessly blocking
# the update process.