From d637d2a7a5f76fdea076d01d091e9e4865ac55f4 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 18 Jun 2023 12:38:02 +0100 Subject: [PATCH] Simplify nested if statements. Co-authored-by: yubiuser Signed-off-by: Adam Warner --- automated install/basic-install.sh | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 2edad6e3..e3d8ff29 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1008,27 +1008,25 @@ remove_old_pihole_lighttpd_configs() { local confenabled="/etc/lighttpd/conf-enabled/15-pihole-admin.conf" - if [[ -d "/etc/lighttpd/conf.d" ]]; then + if [[ -f "${lighttpdConfig}" ]]; then sed -i '/include "\/etc\/lighttpd\/conf.d\/pihole-admin.conf"/d' "${lighttpdConfig}" + fi - if [[ -f "${condfd}" ]]; then - rm "${condfd}" - fi + if [[ -f "${condfd}" ]]; then + rm "${condfd}" + fi + if is_command lighty-disable-mod ; then + lighty-disable-mod pihole-admin > /dev/null || true + fi - elif [[ -d "/etc/lighttpd/conf-available" ]]; then - if is_command lighty-disable-mod ; then - lighty-disable-mod pihole-admin > /dev/null || true - fi + if [[ -f "${confavailable}" ]]; then + rm "${confavailable}" + fi - if [[ -f "${confavailable}" ]]; then - rm "${confavailable}" - fi - - if [[ -f "${confenabled}" ]]; then - rm "${confenabled}" - fi - fi + if [[ -f "${confenabled}" ]]; then + rm "${confenabled}" + fi } # Clean an existing installation to prepare for upgrade/reinstall