From d5013bfd6c3153113fa8a67b6731c9d91a327e67 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 12 Jun 2023 22:33:50 +0100 Subject: [PATCH 1/5] Add code to remove old lighttpd config files left over from v5. Web config is all dealt with by FTL now Signed-off-by: Adam Warner --- automated install/basic-install.sh | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 699fef10..9659a140 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1001,6 +1001,38 @@ remove_old_dnsmasq_ftl_configs() { fi } +remove_old_pihole_lighttpd_configs() { + local lighttpdConfig="/etc/lighttpd/lighttpd.conf" + local condfd="/etc/lighttpd/conf.d/pihole-admin.conf" + local confavailable="/etc/lighttpd/conf-available/15-pihole-admin.conf" + local confenabled="/etc/lighttpd/conf-enabled/15-pihole-admin.conf" + + + if [[ -d "/etc/lighttpd/conf.d" ]]; then + if grep -q -F 'include "/etc/lighttpd/conf.d/pihole-admin.conf"' "${lighttpdConfig}"; then + sed -i '/include "/etc/lighttpd/conf.d/pihole-admin.conf"/d' "${lighttpdConfig}" + fi + + if [[ -f "${condfd}" ]]; then + rm "${condfd}" + 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 "${confenabled}" ]]; then + rm "${confenabled}" + fi + fi +} + # Clean an existing installation to prepare for upgrade/reinstall clean_existing() { # Local, named variables @@ -1486,6 +1518,7 @@ installPihole() { fi remove_old_dnsmasq_ftl_configs + remove_old_pihole_lighttpd_configs # Install config files if ! installConfigs; then From c39cb8cfe066d3520354f3cdee293fa6afe47e0e Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 12 Jun 2023 22:43:39 +0100 Subject: [PATCH 2/5] Escape the sed command for removing a line in fed/centos lighttpd.conf Signed-off-by: Adam Warner --- 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 9659a140..43cd9816 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1010,7 +1010,7 @@ remove_old_pihole_lighttpd_configs() { if [[ -d "/etc/lighttpd/conf.d" ]]; then if grep -q -F 'include "/etc/lighttpd/conf.d/pihole-admin.conf"' "${lighttpdConfig}"; then - sed -i '/include "/etc/lighttpd/conf.d/pihole-admin.conf"/d' "${lighttpdConfig}" + sed -i '/include "\/etc\/lighttpd\/conf.d\/pihole-admin.conf"/d' "${lighttpdConfig}" fi if [[ -f "${condfd}" ]]; then From 001f2012a2b40c200e4c7d6384b8cd2f62c523c5 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 13 Jun 2023 19:08:12 +0100 Subject: [PATCH 3/5] Update automated install/basic-install.sh Co-authored-by: RD WebDesign Signed-off-by: Adam Warner --- automated install/basic-install.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 43cd9816..2edad6e3 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1009,9 +1009,7 @@ remove_old_pihole_lighttpd_configs() { if [[ -d "/etc/lighttpd/conf.d" ]]; then - if grep -q -F 'include "/etc/lighttpd/conf.d/pihole-admin.conf"' "${lighttpdConfig}"; then - sed -i '/include "\/etc\/lighttpd\/conf.d\/pihole-admin.conf"/d' "${lighttpdConfig}" - fi + sed -i '/include "\/etc\/lighttpd\/conf.d\/pihole-admin.conf"/d' "${lighttpdConfig}" if [[ -f "${condfd}" ]]; then rm "${condfd}" From d637d2a7a5f76fdea076d01d091e9e4865ac55f4 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 18 Jun 2023 12:38:02 +0100 Subject: [PATCH 4/5] 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 From a3bb3872bfbf9520bd29b2069a889d7d6d4f1202 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 18 Jun 2023 16:30:59 +0100 Subject: [PATCH 5/5] adlist table now contains 11 columns, not 10. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Christian König Signed-off-by: Adam Warner --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index abf6700b..ed402a34 100755 --- a/gravity.sh +++ b/gravity.sh @@ -178,7 +178,7 @@ database_table_from_file() { echo "${rowid},\"${domain}\",${timestamp}" >> "${tmpFile}" elif [[ "${table}" == "adlist" ]]; then # Adlist table format - echo "${rowid},\"${domain}\",1,${timestamp},${timestamp},\"Migrated from ${src}\",,0,0,0" >> "${tmpFile}" + echo "${rowid},\"${domain}\",1,${timestamp},${timestamp},\"Migrated from ${src}\",,0,0,0,0" >> "${tmpFile}" else # White-, black-, and regexlist table format echo "${rowid},${list_type},\"${domain}\",1,${timestamp},${timestamp},\"Migrated from ${src}\"" >> "${tmpFile}"