mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Merge conflict resolution
This commit is contained in:
parent
f444c7d4a5
commit
a4fbccac9b
2 changed files with 11 additions and 57 deletions
|
@ -51,19 +51,11 @@ fi
|
||||||
|
|
||||||
function HandleOther(){
|
function HandleOther(){
|
||||||
#check validity of domain
|
#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/')
|
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
|
if [ -z "$validDomain" ]; then
|
||||||
echo "$1" is not a valid argument or domain name
|
echo "$1" is not a valid argument or domain name
|
||||||
else
|
else
|
||||||
>>>>>>> ScriptCleanup
|
|
||||||
domList=("${domList[@]}" $validDomain)
|
domList=("${domList[@]}" $validDomain)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -73,16 +65,9 @@ function PopBlacklistFile(){
|
||||||
if [[ ! -f $blacklist ]];then
|
if [[ ! -f $blacklist ]];then
|
||||||
touch $blacklist
|
touch $blacklist
|
||||||
fi
|
fi
|
||||||
for dom in "${domList[@]}"
|
for dom in "${domList[@]}"; do
|
||||||
<<<<<<< HEAD
|
|
||||||
do
|
|
||||||
if $addmode; then
|
|
||||||
AddDomain $dom
|
|
||||||
=======
|
|
||||||
do
|
|
||||||
if "$addmode"; then
|
if "$addmode"; then
|
||||||
AddDomain "$dom"
|
AddDomain "$dom"
|
||||||
>>>>>>> ScriptCleanup
|
|
||||||
else
|
else
|
||||||
RemoveDomain "$dom"
|
RemoveDomain "$dom"
|
||||||
fi
|
fi
|
||||||
|
@ -134,37 +119,21 @@ function ModifyHostFile(){
|
||||||
numberOf=$($blacklist | sed '/^\s*$/d' | wc -l)
|
numberOf=$($blacklist | sed '/^\s*$/d' | wc -l)
|
||||||
plural=; [[ "$numberOf" != "1" ]] && plural=s
|
plural=; [[ "$numberOf" != "1" ]] && plural=s
|
||||||
echo ":::"
|
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}..."
|
echo -n "::: Modifying HOSTS file to blacklist $numberOf domain${plural}..."
|
||||||
if [[ -n $piholeIPv6 ]];then
|
if [[ -n $piholeIPv6 ]];then
|
||||||
$blacklist | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> $adList
|
$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
|
$blacklist | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >>$adList
|
||||||
fi
|
fi
|
||||||
|
|
||||||
>>>>>>> ScriptCleanup
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
||||||
echo ":::"
|
echo ":::"
|
||||||
for dom in "${domToRemoveList[@]}"
|
for dom in "${domToRemoveList[@]}"
|
||||||
do
|
do
|
||||||
#we need to remove the domains from the blacklist file and the host file
|
#we need to remove the domains from the blacklist file and the host file
|
||||||
echo "::: $dom"
|
echo "::: $dom"
|
||||||
echo -n "::: removing from HOSTS file..."
|
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
|
echo "$dom" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /[^.]'{}'(?!.)/;' $adList
|
||||||
>>>>>>> ScriptCleanup
|
|
||||||
echo " done!"
|
echo " done!"
|
||||||
echo -n "::: removing from blackist.txt..."
|
echo -n "::: removing from blackist.txt..."
|
||||||
echo "$dom" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' $blacklist
|
echo "$dom" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' $blacklist
|
||||||
|
@ -199,13 +168,8 @@ do
|
||||||
"-nr"| "--noreload" ) reload=false;;
|
"-nr"| "--noreload" ) reload=false;;
|
||||||
"-d" | "--delmode" ) addmode=false;;
|
"-d" | "--delmode" ) addmode=false;;
|
||||||
"-f" | "--force" ) force=true;;
|
"-f" | "--force" ) force=true;;
|
||||||
<<<<<<< HEAD
|
|
||||||
"-q" | "--quiet" ) versbose=false;;
|
|
||||||
* ) HandleOther $var;;
|
|
||||||
=======
|
|
||||||
"-q" | "--quiet" ) versbose=false;;
|
"-q" | "--quiet" ) versbose=false;;
|
||||||
* ) HandleOther "$var";;
|
* ) HandleOther "$var";;
|
||||||
>>>>>>> ScriptCleanup
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -51,13 +51,8 @@ fi
|
||||||
|
|
||||||
function HandleOther(){
|
function HandleOther(){
|
||||||
#check validity of domain
|
#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/')
|
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
|
if [ -z "$validDomain" ]; then
|
||||||
echo "::: $1 is not a valid argument or domain name"
|
echo "::: $1 is not a valid argument or domain name"
|
||||||
else
|
else
|
||||||
|
@ -186,13 +181,8 @@ do
|
||||||
"-nr"| "--noreload" ) reload=false;;
|
"-nr"| "--noreload" ) reload=false;;
|
||||||
"-d" | "--delmode" ) addmode=false;;
|
"-d" | "--delmode" ) addmode=false;;
|
||||||
"-f" | "--force" ) force=true;;
|
"-f" | "--force" ) force=true;;
|
||||||
<<<<<<< HEAD
|
|
||||||
"-q" | "--quiet" ) versbose=false;;
|
|
||||||
* ) HandleOther $var;;
|
|
||||||
=======
|
|
||||||
"-q" | "--quiet" ) versbose=false;;
|
"-q" | "--quiet" ) versbose=false;;
|
||||||
* ) HandleOther "$var";;
|
* ) HandleOther "$var";;
|
||||||
>>>>>>> ScriptCleanup
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue