From 6c87698f1a9a38ae1583bf4d0190aedcc54e43dd Mon Sep 17 00:00:00 2001 From: Promofaux Date: Fri, 8 Apr 2016 20:10:10 +0100 Subject: [PATCH 1/6] fix spelling in name of variable ($versbose -> $verbose) --- advanced/Scripts/whitelist.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index ea9b33ad..b9d14541 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -22,7 +22,7 @@ whitelist=$piholeDir/whitelist.txt reload=true addmode=true force=false -versbose=true +verbose=true domList=() domToRemoveList=() @@ -96,16 +96,16 @@ function AddDomain(){ grep -Ex -q "$1" $whitelist || bool=true if $bool; then #domain not found in the whitelist file, add it! - if $versbose; then + if $verbose; then echo -n "::: Adding $1 to $whitelist..." fi echo "$1" >> $whitelist modifyHost=true - if $versbose; then + if $verbose; then echo " done!" fi else - if $versbose; then + if $verbose; then echo "::: $1 already exists in $whitelist, no need to add!" fi fi @@ -117,12 +117,12 @@ function RemoveDomain(){ grep -Ex -q "$1" $whitelist || bool=true if $bool; then #Domain is not in the whitelist file, no need to Remove - if $versbose; then + if $verbose; then echo "::: $1 is NOT whitelisted! No need to remove" fi else #Domain is in the whitelist file, add to a temporary array and remove from whitelist file - #if $versbose; then + #if $verbose; then #echo "::: Un-whitelisting $dom..." #fi domToRemoveList=("${domToRemoveList[@]}" $1) @@ -206,7 +206,7 @@ do "-nr"| "--noreload" ) reload=false;; "-d" | "--delmode" ) addmode=false;; "-f" | "--force" ) force=true;; - "-q" | "--quiet" ) versbose=false;; + "-q" | "--quiet" ) verbose=false;; "-h" | "--help" ) helpFunc;; "-l" | "--list" ) DisplayWlist;; * ) HandleOther "$var";; @@ -218,7 +218,7 @@ PopWhitelistFile if $modifyHost || $force; then ModifyHostFile else - if $versbose; then + if $verbose; then echo ":::" echo "::: No changes need to be made" exit 1 From c0aadeab3d4df173ac0a2c4039d233877f8d5e3c Mon Sep 17 00:00:00 2001 From: Promofaux Date: Fri, 8 Apr 2016 20:10:27 +0100 Subject: [PATCH 2/6] fix spelling in name of variable ($versbose -> $verbose) --- advanced/Scripts/blacklist.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/advanced/Scripts/blacklist.sh b/advanced/Scripts/blacklist.sh index 418b5a4c..db91a146 100755 --- a/advanced/Scripts/blacklist.sh +++ b/advanced/Scripts/blacklist.sh @@ -22,7 +22,7 @@ blacklist=$piholeDir/blacklist.txt reload=true addmode=true force=false -versbose=true +verbose=true domList=() domToRemoveList=() @@ -95,14 +95,14 @@ function AddDomain(){ grep -Ex -q "$1" $blacklist || bool=true if $bool; then #domain not found in the blacklist file, add it! - if $versbose; then + if $verbose; then echo -n "::: Adding $1 to blacklist file..." fi echo "$1" >> $blacklist modifyHost=true echo " done!" else - if $versbose; then + if $verbose; then echo "::: $1 already exists in $blacklist! No need to add" fi fi @@ -114,12 +114,12 @@ function RemoveDomain(){ grep -Ex -q "$1" $blacklist || bool=true if $bool; then #Domain is not in the blacklist file, no need to Remove - if $versbose; then + if $verbose; then echo "::: $1 is NOT blacklisted! No need to remove" fi else #Domain is in the blacklist file, add to a temporary array - if $versbose; then + if $verbose; then echo "::: Un-blacklisting $dom..." fi domToRemoveList=("${domToRemoveList[@]}" $1) @@ -193,7 +193,7 @@ do "-nr"| "--noreload" ) reload=false;; "-d" | "--delmode" ) addmode=false;; "-f" | "--force" ) force=true;; - "-q" | "--quiet" ) versbose=false;; + "-q" | "--quiet" ) verbose=false;; "-h" | "--help" ) helpFunc;; "-l" | "--list" ) DisplayBlist;; * ) HandleOther "$var";; @@ -205,7 +205,7 @@ PopBlacklistFile if $modifyHost || $force; then ModifyHostFile else - if $versbose; then + if $verbose; then echo "::: No changes need to be made" fi exit 1 From 8e04f1c03e8701e5fbd91cb10d17c109d211c486 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Fri, 8 Apr 2016 20:11:39 +0100 Subject: [PATCH 3/6] Remove clear in DisplayBlist and forse verbose to false to tidy up output. --- advanced/Scripts/blacklist.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/blacklist.sh b/advanced/Scripts/blacklist.sh index db91a146..f36f5efa 100755 --- a/advanced/Scripts/blacklist.sh +++ b/advanced/Scripts/blacklist.sh @@ -175,7 +175,7 @@ function Reload() { } function DisplayBlist() { - clear + verbose=false echo -e " Displaying Gravity Affected Domains \n" count=1 while IFS= read -r AD From 3154a378a686a5e1ad43e645f62926a86edf7088 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Fri, 8 Apr 2016 20:12:30 +0100 Subject: [PATCH 4/6] Remove clear in DisplayWlist and force verbose to false to tidy up output. --- advanced/Scripts/whitelist.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index b9d14541..852e319d 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -188,7 +188,7 @@ function Reload() { } function DisplayWlist() { - clear + verbose=false echo -e " Displaying Gravity Resistant Domains \n" count=1 while IFS= read -r RD From ab99e80333f795b6ea4b7a6ae68eaa0bec17d2b0 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Fri, 8 Apr 2016 23:00:46 +0100 Subject: [PATCH 5/6] indent --- advanced/Scripts/blacklist.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/blacklist.sh b/advanced/Scripts/blacklist.sh index f36f5efa..04d4d60f 100755 --- a/advanced/Scripts/blacklist.sh +++ b/advanced/Scripts/blacklist.sh @@ -206,7 +206,7 @@ if $modifyHost || $force; then ModifyHostFile else if $verbose; then - echo "::: No changes need to be made" + echo "::: No changes need to be made" fi exit 1 fi From 107e0404de91309ebfef9fbf06ad51306b2a85e1 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Fri, 8 Apr 2016 23:01:13 +0100 Subject: [PATCH 6/6] Move `exit 1` outside of `if` block on verbose check to stop dnsmasq reloading --- advanced/Scripts/whitelist.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index 852e319d..00556476 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -219,10 +219,10 @@ if $modifyHost || $force; then ModifyHostFile else if $verbose; then - echo ":::" - echo "::: No changes need to be made" - exit 1 + echo ":::" + echo "::: No changes need to be made" fi + exit 1 fi if $reload; then