Merge conflict resolution

This commit is contained in:
nate 2016-03-28 12:53:21 -05:00
parent f444c7d4a5
commit a4fbccac9b
2 changed files with 11 additions and 57 deletions

View file

@ -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,37 +119,21 @@ 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
$blacklist | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >>$adList
fi
>>>>>>> ScriptCleanup
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
@ -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

View file

@ -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