From 8e706e4a162a85662b15b02a9015754a97b663e2 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sat, 22 Feb 2025 23:27:05 +0100 Subject: [PATCH] Assure that Lighttpd conf-enabled symlink is removed `/etc/lighttpd/conf-enabled` usually contains symlinks to the actual files in `/etc/lighttpd/conf-available`, at least `lighty-enable-mod` does exactly this. If `/etc/lighttpd/conf-available/15-pihole-admin.conf` is removed first, `/etc/lighttpd/conf-enabled/15-pihole-admin.conf` hence points to nowhere, which makes the `-f` check return false. The orphaned symlink is hence not removed, if `lighty-disable-mod` is not available. This PR changes the order, to remove the symlink first, and to be failsafe also if it is orphaned already, and the actual config afterwards. Signed-off-by: MichaIng --- automated install/basic-install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 3680cff3..4a1df70c 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1208,12 +1208,12 @@ remove_old_pihole_lighttpd_configs() { lighty-disable-mod pihole-admin >/dev/null || true fi - if [[ -f "${confavailable}" ]]; then - rm "${confavailable}" + if [[ -f "${confenabled}" || -L "${confenabled}" ]]; then + rm "${confenabled}" fi - if [[ -f "${confenabled}" ]]; then - rm "${confenabled}" + if [[ -f "${confavailable}" ]]; then + rm "${confavailable}" fi }