diff --git a/gravity.sh b/gravity.sh index fbecb3ad..6933698c 100755 --- a/gravity.sh +++ b/gravity.sh @@ -244,7 +244,7 @@ function gravity_advanced() { # Most of the lists downloaded are already in hosts file format but the spacing/formating is not contigious # This helps with that and makes it easier to read # It also helps with debugging so each stage of the script can be researched more in depth - awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' $piholeDir/$andLight | \ + awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' $piholeDir/$matter | \ sed -nr -e 's/\.{2,}/./g' -e '/\./p' > $piholeDir/$supernova numberOf=$(wc -l < $piholeDir/$supernova) @@ -268,11 +268,53 @@ function gravity_reload() { fi } +function pulsarNew(){ + # Append blacklist entries if they exist + if [[ -r $blacklist ]];then + numberOf=$(cat $blacklist | sed '/^\s*$/d' | wc -l) + echo "** Blacklisting $numberOf domain(s)..." + cat $blacklist >> $piholeDir/$matter + fi + + # Whitelist (if applicable) domains + if [[ -r $whitelist ]];then + # Remove whitelist entries + numberOf=$(cat $whitelist | sed '/^\s*$/d' | wc -l) + plural=; [[ "$numberOf" != "1" ]] && plural=s + echo "** Whitelisting $numberOf domain${plural}..." + + # Append a "$" to the end, prepend a "^" to the beginning, and + # replace "." with "\." of each line to turn each entry into a + # regexp so it can be parsed out with grep -x + awk -F '[# \t]' 'NF>0&&$1!="" {print $1}' $whitelist > $latentWhitelist + else + rm $latentWhitelist 2>/dev/null + fi + + # Prevent our sources from being pulled into the hole + plural=; [[ "${#sources[@]}" != "1" ]] && plural=s + echo "** Whitelisting ${#sources[@]} ad list source${plural}..." + for url in ${sources[@]} + do + echo "$url" | awk -F '/' '{print $3}' >> $latentWhitelist + done + + while read p; do + echo "Removing $p from gravity.list" + perl -i -ne'print unless /[^.]'$p'(?!.)/;' gravity.list + done <$latentWhitelist + + + # Remove whitelist entries from list + #grep -vxf $latentWhitelist $piholeDir/$matter > $piholeDir/$andLight +} + gravity_collapse gravity_spinup gravity_Schwarzchild -gravity_pulsar +#gravity_pulsar gravity_advanced gravity_hostFormat gravity_blackbody +pulsarNew gravity_reload