From e08f65d1c4ca40de27df124ac378736a3cf0f189 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 23 Dec 2024 09:30:37 +0100 Subject: [PATCH 1/4] Disable lighttpd if found Signed-off-by: DL6ER --- automated install/basic-install.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index c5d2ad9c..7411b2c5 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -2300,6 +2300,21 @@ copy_to_install_log() { chown pihole:pihole "${installLogLoc}" } +disableLighttpd() { + # 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 @@ -2489,6 +2504,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. From 47d5a085652e05e4b0a0fbafe9393ff3112fce9e Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 23 Dec 2024 19:12:47 +0100 Subject: [PATCH 2/4] Ask the user if they want to disable lighttpd Signed-off-by: DL6ER --- automated install/basic-install.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 7411b2c5..fc2b28ef 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -2301,6 +2301,24 @@ copy_to_install_log() { } disableLighttpd() { + # Detect if the terminal is interactive + if [[ -t 0 ]]; then + # The terminal is interactive + dialog --no-shadow --keep-tite \ + --title "Pi-hole v6.0 does no longer need lighttpd" \ + --yesno "Pi-hole v6.0 has its own embedded web server so lighttpd is no longer needed *unless* you have custom configurations. In 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=$? + 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 From 50645c2924d8eb92f8b0e4a3dec5fdd762ba617f Mon Sep 17 00:00:00 2001 From: Dominik Date: Tue, 24 Dec 2024 02:19:37 +0100 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Adam Warner Co-authored-by: RD WebDesign Signed-off-by: Dominik --- automated install/basic-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index fc2b28ef..13606758 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -2305,8 +2305,8 @@ disableLighttpd() { if [[ -t 0 ]]; then # The terminal is interactive dialog --no-shadow --keep-tite \ - --title "Pi-hole v6.0 does no longer need lighttpd" \ - --yesno "Pi-hole v6.0 has its own embedded web server so lighttpd is no longer needed *unless* you have custom configurations. In 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}" + --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=$? else # The terminal is non-interactive, assume yes. Lighttpd will be stopped From 18358273718b7186d3f417d4b4c32375c75b6ab4 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 30 Dec 2024 15:35:41 +0100 Subject: [PATCH 4/4] Ensure Yes to keeping lighttpd doesn't trigger set -e during the upgrade Signed-off-by: DL6ER --- automated install/basic-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 13606758..85587bb3 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -2301,13 +2301,13 @@ copy_to_install_log() { } 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=$? + --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