fixed a goof with adding blacklisted domains

This commit is contained in:
Promofaux 2016-01-14 22:46:43 +00:00
parent 1ce5add332
commit 63ceba2e7a

View file

@ -49,10 +49,10 @@ whitelist=$piholeDir/whitelist.txt
latentWhitelist=$piholeDir/latentWhitelist.txt latentWhitelist=$piholeDir/latentWhitelist.txt
justDomainsExtension=domains justDomainsExtension=domains
matterandlight=$basename.0.matterandlight.txt matterandlight=$basename.0.matterandlight.txt
supernova=$basename.2.supernova.txt supernova=$basename.1.supernova.txt
eventHorizon=$basename.3.eventHorizon.txt eventHorizon=$basename.2.eventHorizon.txt
accretionDisc=$basename.4.accretionDisc.txt accretionDisc=$basename.3.accretionDisc.txt
eyeOfTheNeedle=$basename.5.wormhole.txt eyeOfTheNeedle=$basename.4.wormhole.txt
# After setting defaults, check if there's local overrides # After setting defaults, check if there's local overrides
if [[ -r $piholeDir/pihole.conf ]];then if [[ -r $piholeDir/pihole.conf ]];then
@ -166,15 +166,17 @@ function gravity_Schwarzchild() {
done done
} }
# Pulsar - White/blacklist application
function gravity_pulsar() {
function gravity_Blacklist(){
# Append blacklist entries if they exist # Append blacklist entries if they exist
if [[ -r $blacklist ]];then if [[ -r $blacklist ]];then
numberOf=$(cat $blacklist | sed '/^\s*$/d' | wc -l) numberOf=$(cat $blacklist | sed '/^\s*$/d' | wc -l)
echo "** Blacklisting $numberOf domain(s)..." echo "** Blacklisting $numberOf domain(s)..."
cat $blacklist >> $piholeDir/$matterandlight cat $blacklist >> $piholeDir/$matterandlight
fi fi
}
function gravity_Whitelist() {
# Whitelist (if applicable) domains # Whitelist (if applicable) domains
if [[ -r $whitelist ]];then if [[ -r $whitelist ]];then
@ -240,12 +242,13 @@ function gravity_blackbody() {
} }
function gravity_advanced() { function gravity_advanced() {
# Remove comments and print only the domain name # Remove comments and print only the domain name
# Most of the lists downloaded are already in hosts file format but the spacing/formating is not contigious # 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 # 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 # 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/$matterandlight | \ awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' $piholeDir/$matterandlight | sed -nr -e 's/\.{2,}/./g' -e '/\./p' > $piholeDir/$supernova
sed -nr -e 's/\.{2,}/./g' -e '/\./p' > $piholeDir/$supernova
numberOf=$(wc -l < $piholeDir/$supernova) numberOf=$(wc -l < $piholeDir/$supernova)
echo "** $numberOf domains being pulled in by gravity..." echo "** $numberOf domains being pulled in by gravity..."
@ -272,8 +275,9 @@ function gravity_reload() {
gravity_collapse gravity_collapse
gravity_spinup gravity_spinup
gravity_Schwarzchild gravity_Schwarzchild
gravity_Blacklist
gravity_advanced gravity_advanced
gravity_hostFormat gravity_hostFormat
gravity_blackbody gravity_blackbody
gravity_pulsar gravity_Whitelist
gravity_reload gravity_reload