From a4fbccac9b011f19a627df62a1eba669b4e53c3b Mon Sep 17 00:00:00 2001 From: nate Date: Mon, 28 Mar 2016 12:53:21 -0500 Subject: [PATCH] Merge conflict resolution --- advanced/Scripts/blacklist.sh | 58 +++++++---------------------------- advanced/Scripts/whitelist.sh | 10 ------ 2 files changed, 11 insertions(+), 57 deletions(-) diff --git a/advanced/Scripts/blacklist.sh b/advanced/Scripts/blacklist.sh index 3fd50e83..23313d54 100644 --- a/advanced/Scripts/blacklist.sh +++ b/advanced/Scripts/blacklist.sh @@ -51,19 +51,11 @@ fi function HandleOther(){ #check validity of domain -<<<<<<< HEAD - validDomain=$(echo $1 | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/') - - if [ -z "$validDomain" ]; then - echo $1 is not a valid argument or domain name - else -======= validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/') if [ -z "$validDomain" ]; then echo "$1" is not a valid argument or domain name else ->>>>>>> ScriptCleanup domList=("${domList[@]}" $validDomain) fi } @@ -73,16 +65,9 @@ function PopBlacklistFile(){ if [[ ! -f $blacklist ]];then touch $blacklist fi - for dom in "${domList[@]}" -<<<<<<< HEAD - do - if $addmode; then - AddDomain $dom -======= - do + for dom in "${domList[@]}"; do if "$addmode"; then AddDomain "$dom" ->>>>>>> ScriptCleanup else RemoveDomain "$dom" fi @@ -134,43 +119,27 @@ function ModifyHostFile(){ numberOf=$($blacklist | sed '/^\s*$/d' | wc -l) plural=; [[ "$numberOf" != "1" ]] && plural=s echo ":::" -<<<<<<< HEAD - echo -n "::: Modifying HOSTS file to blacklist $numberOf domain${plural}..." - if [[ -n $piholeIPv6 ]];then - cat $blacklist | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> $adList - else - cat $blacklist | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >>$adList - fi - -======= echo -n "::: Modifying HOSTS file to blacklist $numberOf domain${plural}..." if [[ -n $piholeIPv6 ]];then $blacklist | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> $adList - else + else $blacklist | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >>$adList - fi - ->>>>>>> ScriptCleanup + fi fi else - echo ":::" for dom in "${domToRemoveList[@]}" do #we need to remove the domains from the blacklist file and the host file - echo "::: $dom" - echo -n "::: removing from HOSTS file..." -<<<<<<< HEAD - echo $dom | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /[^.]'{}'(?!.)/;' $adList -======= - echo "$dom" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /[^.]'{}'(?!.)/;' $adList ->>>>>>> ScriptCleanup - echo " done!" - echo -n "::: removing from blackist.txt..." - echo "$dom" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' $blacklist - echo " done!" + echo "::: $dom" + echo -n "::: removing from HOSTS file..." + echo "$dom" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /[^.]'{}'(?!.)/;' $adList + echo " done!" + echo -n "::: removing from blackist.txt..." + echo "$dom" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' $blacklist + echo " done!" done - fi + fi } @@ -199,13 +168,8 @@ do "-nr"| "--noreload" ) reload=false;; "-d" | "--delmode" ) addmode=false;; "-f" | "--force" ) force=true;; -<<<<<<< HEAD - "-q" | "--quiet" ) versbose=false;; - * ) HandleOther $var;; -======= "-q" | "--quiet" ) versbose=false;; * ) HandleOther "$var";; ->>>>>>> ScriptCleanup esac done diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index a241505b..199c1bbe 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -51,13 +51,8 @@ fi function HandleOther(){ #check validity of domain -<<<<<<< HEAD - validDomain=$(echo $1 | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/') - -======= validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/') ->>>>>>> ScriptCleanup if [ -z "$validDomain" ]; then echo "::: $1 is not a valid argument or domain name" else @@ -186,13 +181,8 @@ do "-nr"| "--noreload" ) reload=false;; "-d" | "--delmode" ) addmode=false;; "-f" | "--force" ) force=true;; -<<<<<<< HEAD - "-q" | "--quiet" ) versbose=false;; - * ) HandleOther $var;; -======= "-q" | "--quiet" ) versbose=false;; * ) HandleOther "$var";; ->>>>>>> ScriptCleanup esac done