From 28c6b1393fbabf5cd375a7a01c33523d00f48d17 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 20 Aug 2018 22:52:22 +0200 Subject: [PATCH 1/2] Backup existing /etc/dnsmasq.conf if present and ensure that /etc/dnsmasq.conf contains only "conf-dir=/etc/dnsmasq.d" Signed-off-by: DL6ER --- automated install/basic-install.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 9f596b45..37077a36 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1092,7 +1092,7 @@ chooseBlocklists() { } # Accept a string parameter, it must be one of the default lists -# This function allow to not duplicate code in chooseBlocklists and +# This function allow to not duplicate code in chooseBlocklists and # in installDefaultBlocklists appendToListsFile() { case $1 in @@ -1113,7 +1113,7 @@ installDefaultBlocklists() { # If this file exists, we avoid overriding it. if [[ -f "${adlistFile}" ]]; then return; - fi + fi appendToListsFile StevenBlack appendToListsFile MalwareDom appendToListsFile Cameleon @@ -2109,12 +2109,14 @@ FTLinstall() { fi fi - #ensure /etc/dnsmasq.conf contains `conf-dir=/etc/dnsmasq.d` - confdir="conf-dir=/etc/dnsmasq.d" - conffile="/etc/dnsmasq.conf" - if ! grep -q "$confdir" "$conffile"; then - echo "$confdir" >> "$conffile" + # Backup existing /etc/dnsmasq.conf if present and ensure that + # /etc/dnsmasq.conf contains only "conf-dir=/etc/dnsmasq.d" + local conffile="/etc/dnsmasq.conf" + if [[ -f "${conffile}" ]]; then + mv "${conffile}" "${conffile}.old" fi + # Create /etc/dnsmasq.conf + echo "conf-dir=/etc/dnsmasq.d" > "${conffile}" return 0 # Otherwise, @@ -2483,7 +2485,7 @@ main() { echo -e " ${INFO} Restarting services..." # Start services - # Enable FTL + # Enable FTL # Ensure the service is enabled before trying to start it # Fixes a problem reported on Ubuntu 18.04 where trying to start # the service before enabling causes installer to exit From 1813c25117c828e36b1c3398c41e2546718a2b6f Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 21 Aug 2018 13:07:23 +0200 Subject: [PATCH 2/2] If config file was backed up: Print info message Signed-off-by: DL6ER --- automated install/basic-install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 37077a36..a08bb3e3 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -2113,6 +2113,7 @@ FTLinstall() { # /etc/dnsmasq.conf contains only "conf-dir=/etc/dnsmasq.d" local conffile="/etc/dnsmasq.conf" if [[ -f "${conffile}" ]]; then + echo " ${INFO} Backing up ${conffile} to ${conffile}.old" mv "${conffile}" "${conffile}.old" fi # Create /etc/dnsmasq.conf