From 92a3c73f801c358fbfa015fd908ef2802f7a64a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20K=C3=B6nig?= <github@yubiuser.dev>
Date: Sun, 22 Dec 2024 21:46:32 +0100
Subject: [PATCH 01/15] Fix v5 -> v6 update
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Christian König <github@yubiuser.dev>
---
 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 755d8dd9..c5d2ad9c 100755
--- a/automated install/basic-install.sh	
+++ b/automated install/basic-install.sh	
@@ -2401,8 +2401,8 @@ main() {
         exit 1
     fi
 
-    # in case of an update
-    if [[ -f "${PI_HOLE_V6_CONFIG}" ]]; then
+    # in case of an update (can be a v5 -> v6 or v6 -> v6 update)
+    if [[ -f "${PI_HOLE_V6_CONFIG}" ]] || [[ -f "/etc/pihole/setupVars.conf" ]]; then
         # if it's running unattended,
         if [[ "${runUnattended}" == true ]]; then
             printf "  %b Performing unattended setup, no dialogs will be displayed\\n" "${INFO}"

From c777152c04b8cc1f8a1b07e05bdd61d38180fb38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20K=C3=B6nig?= <github@yubiuser.dev>
Date: Sun, 22 Dec 2024 21:55:25 +0100
Subject: [PATCH 02/15] Only separat data and status when needed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Christian König <github@yubiuser.dev>
---
 advanced/Scripts/api.sh | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/advanced/Scripts/api.sh b/advanced/Scripts/api.sh
index 43c91d69..785b8309 100755
--- a/advanced/Scripts/api.sh
+++ b/advanced/Scripts/api.sh
@@ -165,15 +165,16 @@ GetFTLData() {
   # get the data from querying the API as well as the http status code
   response=$(curl -skS -w "%{http_code}" -X GET "${API_URL}$1" -H "Accept: application/json" -H "sid: ${SID}" )
 
-  # status are the last 3 characters
-  status="${response#"${response%???}"}"
-  # data is everything from response without the last 3 characters
-  data="${response%???}"
-
   if [ "${2}" = "raw" ]; then
     # return the raw response
     echo "${response}"
   else
+
+    # status are the last 3 characters  # status are the last 3 characters
+    status="${response#"${response%???}"}"
+    # data is everything from response without the last 3 characters
+    data="${response%???}"
+
     # return only the data
     if [ "${status}" = 200 ]; then
         # response OK

From 3011d48b6f22996f36b2e72cad633484e9e3d0b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20K=C3=B6nig?= <github@yubiuser.dev>
Date: Sun, 22 Dec 2024 23:30:14 +0100
Subject: [PATCH 03/15] Use tail instead of parameter expansion
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Christian König <github@yubiuser.dev>
---
 advanced/Scripts/api.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/advanced/Scripts/api.sh b/advanced/Scripts/api.sh
index 785b8309..c9c2dd49 100755
--- a/advanced/Scripts/api.sh
+++ b/advanced/Scripts/api.sh
@@ -170,8 +170,9 @@ GetFTLData() {
     echo "${response}"
   else
 
-    # status are the last 3 characters  # status are the last 3 characters
-    status="${response#"${response%???}"}"
+    # status are the last 3 characters
+    # not using ${response#"${response%???}"}" here because it's extremely slow on big responses
+    status=$(printf "%s" "${response}" | tail -c 3)
     # data is everything from response without the last 3 characters
     data="${response%???}"
 
@@ -265,7 +266,8 @@ apiFunc() {
   response=$(GetFTLData "$1" raw)
 
   # status are the last 3 characters
-  status="${response#"${response%???}"}"
+  # not using ${response#"${response%???}"}" here because it's extremely slow on big responses
+  status=$(printf "%s" "${response}" | tail -c 3)
   # data is everything from response without the last 3 characters
   data="${response%???}"
 

From a2a22c4e138398499d649135ccc7c53a3fcf019a Mon Sep 17 00:00:00 2001
From: DL6ER <dl6er@dl6er.de>
Date: Mon, 23 Dec 2024 09:13:34 +0100
Subject: [PATCH 04/15] Exit early when neither service nor systemctl commands
 are available

Signed-off-by: DL6ER <dl6er@dl6er.de>
---
 automated install/basic-install.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index c5d2ad9c..368fa6c0 100755
--- a/automated install/basic-install.sh	
+++ b/automated install/basic-install.sh	
@@ -2328,6 +2328,17 @@ migrate_dnsmasq_configs() {
     mv /etc/dnsmasq.d/06-rfc6761.conf "${V6_CONF_MIGRATION_DIR}/" 2>/dev/null || true
 }
 
+# Check for availability of either the "service" or "systemctl" commands
+check_service_command() {
+    # Check for the availability of the "service" command
+    if ! is_command service && ! is_command systemctl; then
+        # If neither the "service" nor the "systemctl" command is available, inform the user
+        printf "  %b Neither the service nor the systemctl commands are available\\n" "${CROSS}"
+        printf "      on this machine. This Pi-hole installer cannot continue.\\n"
+        exit 1
+    fi
+}
+
 main() {
     ######## FIRST CHECK ########
     # Must be root to install
@@ -2376,6 +2387,9 @@ main() {
     # Check if SELinux is Enforcing and exit before doing anything else
     checkSelinux
 
+    # Check for availability of either the "service" or "systemctl" commands
+    check_service_command
+
     # Check for supported package managers so that we may install dependencies
     package_manager_detect
 

From e08f65d1c4ca40de27df124ac378736a3cf0f189 Mon Sep 17 00:00:00 2001
From: DL6ER <dl6er@dl6er.de>
Date: Mon, 23 Dec 2024 09:30:37 +0100
Subject: [PATCH 05/15] Disable lighttpd if found

Signed-off-by: DL6ER <dl6er@dl6er.de>
---
 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 <dl6er@dl6er.de>
Date: Mon, 23 Dec 2024 19:12:47 +0100
Subject: [PATCH 06/15] Ask the user if they want to disable lighttpd

Signed-off-by: DL6ER <dl6er@dl6er.de>
---
 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 <DL6ER@users.noreply.github.com>
Date: Tue, 24 Dec 2024 02:19:37 +0100
Subject: [PATCH 07/15] Apply suggestions from code review

Co-authored-by: Adam Warner <me@adamwarner.co.uk>
Co-authored-by: RD WebDesign <github@rdwebdesign.com.br>
Signed-off-by: Dominik <DL6ER@users.noreply.github.com>
---
 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 22b6dc7dae8742de00244d22df72c0f99c281e01 Mon Sep 17 00:00:00 2001
From: Adam Warner <me@adamwarner.co.uk>
Date: Sun, 29 Dec 2024 12:22:35 +0000
Subject: [PATCH 08/15] Add test scripts for fed 41 for v5

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
---
 .github/workflows/test.yml |  1 +
 test/_fedora_41.Dockerfile | 18 ++++++++++++++++++
 test/tox.fedora_41.ini     |  8 ++++++++
 3 files changed, 27 insertions(+)
 create mode 100644 test/_fedora_41.Dockerfile
 create mode 100644 test/tox.fedora_41.ini

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index ec2b5728..a3d49fc5 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -59,6 +59,7 @@ jobs:
             centos_9,
             fedora_39,
             fedora_40,
+            fedora_41,
           ]
     env:
       DISTRO: ${{matrix.distro}}
diff --git a/test/_fedora_41.Dockerfile b/test/_fedora_41.Dockerfile
new file mode 100644
index 00000000..5297e2a8
--- /dev/null
+++ b/test/_fedora_41.Dockerfile
@@ -0,0 +1,18 @@
+FROM fedora:41
+RUN dnf install -y git initscripts
+
+ENV GITDIR /etc/.pihole
+ENV SCRIPTDIR /opt/pihole
+
+RUN mkdir -p $GITDIR $SCRIPTDIR /etc/pihole
+ADD . $GITDIR
+RUN cp $GITDIR/advanced/Scripts/*.sh $GITDIR/gravity.sh $GITDIR/pihole $GITDIR/automated\ install/*.sh $SCRIPTDIR/
+ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR
+
+RUN true && \
+    chmod +x $SCRIPTDIR/*
+
+ENV SKIP_INSTALL true
+ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net
+
+#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \
diff --git a/test/tox.fedora_41.ini b/test/tox.fedora_41.ini
new file mode 100644
index 00000000..2b95a670
--- /dev/null
+++ b/test/tox.fedora_41.ini
@@ -0,0 +1,8 @@
+[tox]
+envlist = py3
+
+[testenv]
+allowlist_externals = docker
+deps = -rrequirements.txt
+commands = docker buildx build --load --progress plain -f _fedora_41.Dockerfile -t pytest_pihole:test_container ../
+           pytest {posargs:-vv -n auto} ./test_any_automated_install.py ./test_any_utils.py ./test_centos_fedora_common_support.py ./test_fedora_support.py

From d972ffa53afd9d0603b33d76aa165fd8d6963678 Mon Sep 17 00:00:00 2001
From: Adam Warner <me@adamwarner.co.uk>
Date: Sun, 29 Dec 2024 12:35:32 +0000
Subject: [PATCH 09/15] while v6 is still not released, update tests in master
 to NOT use development branch of FTL

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
---
 test/test_any_automated_install.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/test_any_automated_install.py b/test/test_any_automated_install.py
index c1b91664..a5038d3c 100644
--- a/test/test_any_automated_install.py
+++ b/test/test_any_automated_install.py
@@ -179,7 +179,7 @@ def test_installPihole_fresh_install_readableFiles(host):
     # Install FTL's development branch to get the latest features
     host.run(
         """
-    echo "development" > /etc/pihole/ftlbranch
+    echo "master" > /etc/pihole/ftlbranch
     """
     )
     install = host.run(
@@ -440,7 +440,7 @@ def test_installPihole_fresh_install_readableBlockpage(host, test_webpage):
     # Install FTL's development branch to get the latest features
     host.run(
         """
-    echo "development" > /etc/pihole/ftlbranch
+    echo "master" > /etc/pihole/ftlbranch
     """
     )
     installWeb = host.run(
@@ -893,7 +893,7 @@ def test_FTL_binary_installed_and_responsive_no_errors(host):
     source /opt/pihole/basic-install.sh
     create_pihole_user
     funcOutput=$(get_binary_name)
-    echo "development" > /etc/pihole/ftlbranch
+    echo "master" > /etc/pihole/ftlbranch
     binary="pihole-FTL${funcOutput##*pihole-FTL}"
     theRest="${funcOutput%pihole-FTL*}"
     FTLdetect "${binary}" "${theRest}"

From dff0c0105d8228fa6ce1c7648d76f853659f7a0d Mon Sep 17 00:00:00 2001
From: Adam Warner <me@adamwarner.co.uk>
Date: Sun, 29 Dec 2024 12:43:08 +0000
Subject: [PATCH 10/15] remove EOL OS from test suite

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
---
 .github/workflows/test.yml |  3 ---
 test/_debian_10.Dockerfile | 17 -----------------
 test/_fedora_39.Dockerfile | 18 ------------------
 test/_ubuntu_23.Dockerfile | 18 ------------------
 test/tox.debian_10.ini     |  8 --------
 test/tox.fedora_39.ini     |  8 --------
 test/tox.ubuntu_23.ini     |  8 --------
 7 files changed, 80 deletions(-)
 delete mode 100644 test/_debian_10.Dockerfile
 delete mode 100644 test/_fedora_39.Dockerfile
 delete mode 100644 test/_ubuntu_23.Dockerfile
 delete mode 100644 test/tox.debian_10.ini
 delete mode 100644 test/tox.fedora_39.ini
 delete mode 100644 test/tox.ubuntu_23.ini

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index a3d49fc5..19a89f1b 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -49,15 +49,12 @@ jobs:
       matrix:
         distro:
           [
-            debian_10,
             debian_11,
             debian_12,
             ubuntu_20,
             ubuntu_22,
-            ubuntu_23,
             ubuntu_24,
             centos_9,
-            fedora_39,
             fedora_40,
             fedora_41,
           ]
diff --git a/test/_debian_10.Dockerfile b/test/_debian_10.Dockerfile
deleted file mode 100644
index 3b177cc8..00000000
--- a/test/_debian_10.Dockerfile
+++ /dev/null
@@ -1,17 +0,0 @@
-FROM buildpack-deps:buster-scm
-
-ENV GITDIR /etc/.pihole
-ENV SCRIPTDIR /opt/pihole
-
-RUN mkdir -p $GITDIR $SCRIPTDIR /etc/pihole
-ADD . $GITDIR
-RUN cp $GITDIR/advanced/Scripts/*.sh $GITDIR/gravity.sh $GITDIR/pihole $GITDIR/automated\ install/*.sh $SCRIPTDIR/
-ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR
-
-RUN true && \
-    chmod +x $SCRIPTDIR/*
-
-ENV SKIP_INSTALL true
-ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net
-
-#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \
diff --git a/test/_fedora_39.Dockerfile b/test/_fedora_39.Dockerfile
deleted file mode 100644
index 1727a3aa..00000000
--- a/test/_fedora_39.Dockerfile
+++ /dev/null
@@ -1,18 +0,0 @@
-FROM fedora:39
-RUN dnf install -y git initscripts
-
-ENV GITDIR /etc/.pihole
-ENV SCRIPTDIR /opt/pihole
-
-RUN mkdir -p $GITDIR $SCRIPTDIR /etc/pihole
-ADD . $GITDIR
-RUN cp $GITDIR/advanced/Scripts/*.sh $GITDIR/gravity.sh $GITDIR/pihole $GITDIR/automated\ install/*.sh $SCRIPTDIR/
-ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR
-
-RUN true && \
-    chmod +x $SCRIPTDIR/*
-
-ENV SKIP_INSTALL true
-ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net
-
-#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \
diff --git a/test/_ubuntu_23.Dockerfile b/test/_ubuntu_23.Dockerfile
deleted file mode 100644
index f9b3910b..00000000
--- a/test/_ubuntu_23.Dockerfile
+++ /dev/null
@@ -1,18 +0,0 @@
-FROM buildpack-deps:lunar-scm
-
-ENV GITDIR /etc/.pihole
-ENV SCRIPTDIR /opt/pihole
-
-RUN mkdir -p $GITDIR $SCRIPTDIR /etc/pihole
-ADD . $GITDIR
-RUN cp $GITDIR/advanced/Scripts/*.sh $GITDIR/gravity.sh $GITDIR/pihole $GITDIR/automated\ install/*.sh $SCRIPTDIR/
-ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR
-ENV DEBIAN_FRONTEND=noninteractive
-
-RUN true && \
-    chmod +x $SCRIPTDIR/*
-
-ENV SKIP_INSTALL true
-ENV OS_CHECK_DOMAIN_NAME dev-supportedos.pi-hole.net
-
-#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \
diff --git a/test/tox.debian_10.ini b/test/tox.debian_10.ini
deleted file mode 100644
index f107300f..00000000
--- a/test/tox.debian_10.ini
+++ /dev/null
@@ -1,8 +0,0 @@
-[tox]
-envlist = py3
-
-[testenv:py3]
-allowlist_externals = docker
-deps = -rrequirements.txt
-commands = docker buildx build --load --progress plain -f _debian_10.Dockerfile -t pytest_pihole:test_container ../
-           pytest {posargs:-vv -n auto} ./test_any_automated_install.py ./test_any_utils.py
diff --git a/test/tox.fedora_39.ini b/test/tox.fedora_39.ini
deleted file mode 100644
index 7a538371..00000000
--- a/test/tox.fedora_39.ini
+++ /dev/null
@@ -1,8 +0,0 @@
-[tox]
-envlist = py3
-
-[testenv]
-allowlist_externals = docker
-deps = -rrequirements.txt
-commands = docker buildx build --load --progress plain -f _fedora_39.Dockerfile -t pytest_pihole:test_container ../
-           pytest {posargs:-vv -n auto} ./test_any_automated_install.py ./test_any_utils.py ./test_centos_fedora_common_support.py ./test_fedora_support.py
diff --git a/test/tox.ubuntu_23.ini b/test/tox.ubuntu_23.ini
deleted file mode 100644
index 767ed9ef..00000000
--- a/test/tox.ubuntu_23.ini
+++ /dev/null
@@ -1,8 +0,0 @@
-[tox]
-envlist = py3
-
-[testenv:py3]
-allowlist_externals = docker
-deps = -rrequirements.txt
-commands = docker buildx build --load --progress plain -f _ubuntu_23.Dockerfile -t pytest_pihole:test_container ../
-           pytest {posargs:-vv -n auto} ./test_any_automated_install.py ./test_any_utils.py

From a1ccee6694a9648347098d66e19572b0fc0a9cc7 Mon Sep 17 00:00:00 2001
From: Adam Warner <me@adamwarner.co.uk>
Date: Sun, 29 Dec 2024 13:32:07 +0000
Subject: [PATCH 11/15] use rpm -q to check if packages are already installed,
 this is due to a change in the behaviour of dnf in Fedora 41

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
---
 automated install/basic-install.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index daa35a70..6c84369e 100755
--- a/automated install/basic-install.sh	
+++ b/automated install/basic-install.sh	
@@ -1698,7 +1698,7 @@ install_dependent_packages() {
     for i in "$@"; do
         # For each package, check if it's already installed (and if so, don't add it to the installArray)
         printf "  %b Checking for %s..." "${INFO}" "${i}"
-        if "${PKG_MANAGER}" -q list installed "${i}" &> /dev/null; then
+        if rpm -q "${i}" &> /dev/null; then
             printf "%b  %b Checking for %s\\n" "${OVER}" "${TICK}" "${i}"
         else
             printf "%b  %b Checking for %s (will be installed)\\n" "${OVER}" "${INFO}" "${i}"

From 18358273718b7186d3f417d4b4c32375c75b6ab4 Mon Sep 17 00:00:00 2001
From: DL6ER <dl6er@dl6er.de>
Date: Mon, 30 Dec 2024 15:35:41 +0100
Subject: [PATCH 12/15] Ensure Yes to keeping lighttpd doesn't trigger set -e
 during the upgrade

Signed-off-by: DL6ER <dl6er@dl6er.de>
---
 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

From 4fd77f57faead42a8d8accc3a9d59e80f92e957d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20K=C3=B6nig?= <github@yubiuser.dev>
Date: Tue, 31 Dec 2024 16:42:08 +0100
Subject: [PATCH 13/15] Remove now unused function test_dpkg_lock()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Christian König <github@yubiuser.dev>
---
 automated install/basic-install.sh | 22 ----------------------
 1 file changed, 22 deletions(-)

diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index b1608c70..c7d479d0 100755
--- a/automated install/basic-install.sh	
+++ b/automated install/basic-install.sh	
@@ -388,28 +388,6 @@ os_check() {
     fi
 }
 
-# This function waits for dpkg to unlock, which signals that the previous apt-get command has finished.
-test_dpkg_lock() {
-    i=0
-    printf "  %b Waiting for package manager to finish (up to 30 seconds)\\n" "${INFO}"
-    # fuser is a program to show which processes use the named files, sockets, or filesystems
-    # So while the lock is held,
-    while fuser /var/lib/dpkg/lock >/dev/null 2>&1; do
-        # we wait half a second,
-        sleep 0.5
-        # increase the iterator,
-        ((i = i + 1))
-        # exit if waiting for more then 30 seconds
-        if [[ $i -gt 60 ]]; then
-            printf "  %b %bError: Could not verify package manager finished and released lock. %b\\n" "${CROSS}" "${COL_LIGHT_RED}" "${COL_NC}"
-            printf "       Attempt to install packages manually and retry.\\n"
-            exit 1
-        fi
-    done
-    # and then report success once dpkg is unlocked.
-    return 0
-}
-
 # Compatibility
 package_manager_detect() {
 

From 79087fb252c1f88fae1d1b9eaeabea7830006672 Mon Sep 17 00:00:00 2001
From: DL6ER <dl6er@dl6er.de>
Date: Wed, 1 Jan 2025 18:55:49 +0100
Subject: [PATCH 14/15] SHow lighttpd disable dialog only once during v6
 migration and when lighttpd is actually installed

Signed-off-by: DL6ER <dl6er@dl6er.de>
---
 automated install/basic-install.sh | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
index b1608c70..88369165 100755
--- a/automated install/basic-install.sh	
+++ b/automated install/basic-install.sh	
@@ -2301,6 +2301,11 @@ copy_to_install_log() {
 }
 
 disableLighttpd() {
+    # Return early when lighttpd is not installed
+    if [[ ! -f /etc/lighttpd/lighttpd.conf ]]; then
+        return
+    fi
+
     local response
     # Detect if the terminal is interactive
     if [[ -t 0 ]]; then
@@ -2345,6 +2350,9 @@ migrate_dnsmasq_configs() {
         return 0
     fi
 
+    # Disable lighttpd server during v6 migration
+    disableLighttpd
+
     # Create target directory /etc/pihole/migration_backup_v6
     # and make it owned by pihole:pihole
     mkdir -p "${V6_CONF_MIGRATION_DIR}"
@@ -2536,9 +2544,6 @@ 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 364281354c75eceb1d1eec88687cf0bd7debca64 Mon Sep 17 00:00:00 2001
From: DL6ER <dl6er@dl6er.de>
Date: Thu, 2 Jan 2025 13:43:32 +0100
Subject: [PATCH 15/15] Check if service is currently enabled when checking if
 lighttpd may need to be disabled

Signed-off-by: DL6ER <dl6er@dl6er.de>
---
 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 88369165..ea8e210e 100755
--- a/automated install/basic-install.sh	
+++ b/automated install/basic-install.sh	
@@ -2301,8 +2301,8 @@ copy_to_install_log() {
 }
 
 disableLighttpd() {
-    # Return early when lighttpd is not installed
-    if [[ ! -f /etc/lighttpd/lighttpd.conf ]]; then
+    # Return early when lighttpd is not active
+    if ! check_service_active lighttpd; then
         return
     fi