1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 06:48:07 +00:00

Merge conflict resolution

This commit is contained in:
nate 2016-03-28 13:07:51 -05:00
parent eaf89995ee
commit f2150ee7e1
4 changed files with 2 additions and 98 deletions

View File

@ -1,15 +1,5 @@
<<<<<<< HEAD
# Automated Install
##### Designed For Raspberry Pi A+, B, B+, 2, Zero (with an Ethernet adapter), and also works on most Debian based distros!
=======
# Automated Install # Automated Install
<<<<<<< HEAD ##### Designed For Raspberry Pi A+, B, B+, 2, Zero, and 3B (with an Ethernet/Wi-Fi adapter) (Works on most Debian distributions!)
##### Designed For Raspberry Pi A+, B, B+, 2, Zero, and 3B (with an Ethernet/Wi-Fi adapter)
>>>>>>> PiholeDebug
=======
##### Designed For Raspberry Pi A+, B, B+, 2, and Zero (with an Ethernet/Wi-Fi adapter)
>>>>>>> ScriptCleanup
>>>>>>> ScriptCleanup-Dev
1. Install Raspbian on Raspberry Pi variants or a Debian based distribution on other hardware or virtual machines 1. Install Raspbian on Raspberry Pi variants or a Debian based distribution on other hardware or virtual machines
2. Run the command below 2. Run the command below

View File

@ -51,19 +51,10 @@ 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-Dev
domList=("${domList[@]}" $validDomain) domList=("${domList[@]}" $validDomain)
fi fi
} }
@ -73,16 +64,9 @@ function PopBlacklistFile(){
if [[ ! -f $blacklist ]];then if [[ ! -f $blacklist ]];then
touch $blacklist touch $blacklist
fi fi
<<<<<<< HEAD
for dom in "${domList[@]}"
do
if $addmode; then
AddDomain $dom
=======
for dom in "${domList[@]}"; do for dom in "${domList[@]}"; do
if "$addmode"; then if "$addmode"; then
AddDomain "$dom" AddDomain "$dom"
>>>>>>> ScriptCleanup-Dev
else else
RemoveDomain "$dom" RemoveDomain "$dom"
fi fi
@ -134,18 +118,6 @@ 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
fi
else
=======
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
@ -154,22 +126,10 @@ function ModifyHostFile(){
fi fi
fi fi
else else
>>>>>>> ScriptCleanup-Dev
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
<<<<<<< HEAD
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
=======
echo "::: $dom" echo "::: $dom"
echo -n "::: removing from HOSTS file..." echo -n "::: removing from HOSTS file..."
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
@ -179,8 +139,6 @@ function ModifyHostFile(){
echo " done!" echo " done!"
done done
fi fi
>>>>>>> ScriptCleanup-Dev
} }
function Reload() { function Reload() {
@ -208,13 +166,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-Dev
esac esac
done done

View File

@ -51,13 +51,7 @@ 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-Dev
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 +180,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-Dev
esac esac
done done

View File

@ -169,22 +169,12 @@ function gravity_transport() {
fi fi
# Silently curl url # Silently curl url
<<<<<<< HEAD
curl -s $cmd_ext $heisenbergCompensator -A "$agent" $url > $patternBuffer curl -s $cmd_ext $heisenbergCompensator -A "$agent" $url > $patternBuffer
# Check for list updates # Check for list updates
gravity_patternCheck $patternBuffer gravity_patternCheck $patternBuffer
=======
<<<<<<< HEAD
curl -s $cmd_ext $heisenbergCompensator -A "$agent" $url > $patternBuffer
# Check for list updates
gravity_patternCheck $patternBuffer
=======
curl -s "$cmd_ext" "$heisenbergCompensator" -A "$agent" "$url" > "$patternBuffer" curl -s "$cmd_ext" "$heisenbergCompensator" -A "$agent" "$url" > "$patternBuffer"
# Check for list updates # Check for list updates
gravity_patternCheck "$patternBuffer" gravity_patternCheck "$patternBuffer"
>>>>>>> ScriptCleanup
>>>>>>> ScriptCleanup-Dev
# Cleanup # Cleanup
rm -f "$patternBuffer" rm -f "$patternBuffer"
} }
@ -269,16 +259,7 @@ function gravity_Whitelist() {
echo " done!" echo " done!"
echo -n "::: Running whitelist script to update HOSTS file...." echo -n "::: Running whitelist script to update HOSTS file...."
<<<<<<< HEAD
$whitelistScript -f -nr -q ${urls[@]} > /dev/null & spinner $!
<<<<<<< HEAD
=======
=======
$whitelistScript -f -nr -q "${urls[@]}" > /dev/null & spinner $! $whitelistScript -f -nr -q "${urls[@]}" > /dev/null & spinner $!
>>>>>>> ScriptCleanup
>>>>>>> ScriptCleanup-Dev
numWhitelisted=$(wc -l < "/etc/pihole/whitelist.txt") numWhitelisted=$(wc -l < "/etc/pihole/whitelist.txt")
plural=; [[ "$numWhitelisted" != "1" ]] && plural=s plural=; [[ "$numWhitelisted" != "1" ]] && plural=s
echo " $numWhitelisted domain${plural} whitelisted!" echo " $numWhitelisted domain${plural} whitelisted!"
@ -303,16 +284,7 @@ function gravity_hostFormat() {
if [[ -n $piholeIPv6 ]];then if [[ -n $piholeIPv6 ]];then
#Add dummy domain Pi-Hole.IsWorking.OK to the top of gravity.list to make ping result return a friendlier looking domain! #Add dummy domain Pi-Hole.IsWorking.OK to the top of gravity.list to make ping result return a friendlier looking domain!
echo -e "$piholeIP Pi-Hole.IsWorking.OK \n$piholeIPv6 Pi-Hole.IsWorking.OK" > $piholeDir/$accretionDisc echo -e "$piholeIP Pi-Hole.IsWorking.OK \n$piholeIPv6 Pi-Hole.IsWorking.OK" > $piholeDir/$accretionDisc
<<<<<<< HEAD
cat $piholeDir/$eventHorizon | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> $piholeDir/$accretionDisc
<<<<<<< HEAD
=======
=======
$piholeDir/$eventHorizon | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> $piholeDir/$accretionDisc $piholeDir/$eventHorizon | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> $piholeDir/$accretionDisc
>>>>>>> ScriptCleanup
>>>>>>> ScriptCleanup-Dev
else else
# Otherwise, just create gravity.list as normal using IPv4 # Otherwise, just create gravity.list as normal using IPv4
#Add dummy domain Pi-Hole.IsWorking.OK to the top of gravity.list to make ping result return a friendlier looking domain! #Add dummy domain Pi-Hole.IsWorking.OK to the top of gravity.list to make ping result return a friendlier looking domain!