diff --git a/advanced/Scripts/blacklist.sh b/advanced/Scripts/blacklist.sh index 2b194630..20329f1e 100755 --- a/advanced/Scripts/blacklist.sh +++ b/advanced/Scripts/blacklist.sh @@ -24,12 +24,15 @@ if [[ $# = 0 ]]; then fi #globals -blacklist=/etc/pihole/blacklist.txt -adList=/etc/pihole/gravity.list +basename=pihole +piholeDir=/etc/$basename +adList=$piholeDir/gravity.list +blacklist=$piholeDir/blacklist.txt reload=true addmode=true force=false versbose=true + domList=() domToRemoveList=() @@ -42,6 +45,12 @@ piholeIP=${piholeIPCIDR%/*} modifyHost=false +# After setting defaults, check if there's local overrides +if [[ -r $piholeDir/pihole.conf ]];then + echo "::: Local calibration requested..." + . $piholeDir/pihole.conf +fi + if [[ -f $piholeIPv6file ]];then # If the file exists, then the user previously chose to use IPv6 in the automated installer diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index 8b57b250..d457d3d7 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -24,12 +24,15 @@ if [[ $# = 0 ]]; then fi #globals -whitelist=/etc/pihole/whitelist.txt -adList=/etc/pihole/gravity.list +basename=pihole +piholeDir=/etc/$basename +adList=$piholeDir/gravity.list +whitelist=$piholeDir/whitelist.txt reload=true addmode=true force=false versbose=true + domList=() domToRemoveList=() @@ -42,6 +45,11 @@ piholeIP=${piholeIPCIDR%/*} modifyHost=false +# After setting defaults, check if there's local overrides +if [[ -r $piholeDir/pihole.conf ]];then + echo "::: Local calibration requested..." + . $piholeDir/pihole.conf +fi if [[ -f $piholeIPv6file ]];then # If the file exists, then the user previously chose to use IPv6 in the automated installer @@ -127,10 +135,10 @@ function ModifyHostFile(){ awk -F':' '{print $1}' $whitelist | while read -r line; do echo "$piholeIP $line"; done > /etc/pihole/whitelist.tmp awk -F':' '{print $1}' $whitelist | while read -r line; do echo "$piholeIPv6 $line"; done >> /etc/pihole/whitelist.tmp echo "l" >> /etc/pihole/whitelist.tmp - grep -F -x -v -f /etc/pihole/whitelist.tmp /etc/pihole/gravity.list > /etc/pihole/gravity.tmp - rm /etc/pihole/gravity.list - mv /etc/pihole/gravity.tmp /etc/pihole/gravity.list - rm /etc/pihole/whitelist.tmp + grep -F -x -v -f $piholeDir/whitelist.tmp $adList > $piholeDir/gravity.tmp + rm $adList + mv $piholeDir/gravity.tmp $adList + rm $piholeDir/whitelist.tmp echo " done!" fi diff --git a/gravity.sh b/gravity.sh index d741ac80..80f80553 100755 --- a/gravity.sh +++ b/gravity.sh @@ -165,7 +165,7 @@ function gravity_transport() { fi # Silently curl url - curl -s "$cmd_ext" "$heisenbergCompensator" -A "$agent" "$url" > "$patternBuffer" + curl -s $cmd_ext $heisenbergCompensator -A "$agent" $url > $patternBuffer # Check for list updates gravity_patternCheck "$patternBuffer" # Cleanup @@ -321,6 +321,12 @@ function gravity_reload() { # Reload hosts file echo ":::" echo -n "::: Refresh lists in dnsmasq..." + + #ensure /etc/dnsmasq.d/01-pihole.conf is pointing at the correct list! + #First escape forward slashes in the path: + adList=${adList//\//\\\/} + #Now replace the line in dnsmasq file + $SUDO sed -i "s/^addn-hosts.*/addn-hosts=$adlist/" /etc/dnsmasq.d/01-pihole.conf dnsmasqPid=$(pidof dnsmasq) find "$piholeDir" -type f -exec $SUDO chmod 666 {} \; & spinner $!