mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-28 09:03:17 +00:00
Testing fix to gravity.sh
This commit is contained in:
parent
f964aff9b0
commit
f5b5e12bc2
1 changed files with 44 additions and 2 deletions
46
gravity.sh
46
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
|
# 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/$andLight | \
|
awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' $piholeDir/$matter | \
|
||||||
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)
|
||||||
|
@ -268,11 +268,53 @@ function gravity_reload() {
|
||||||
fi
|
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_collapse
|
||||||
gravity_spinup
|
gravity_spinup
|
||||||
gravity_Schwarzchild
|
gravity_Schwarzchild
|
||||||
gravity_pulsar
|
#gravity_pulsar
|
||||||
gravity_advanced
|
gravity_advanced
|
||||||
gravity_hostFormat
|
gravity_hostFormat
|
||||||
gravity_blackbody
|
gravity_blackbody
|
||||||
|
pulsarNew
|
||||||
gravity_reload
|
gravity_reload
|
||||||
|
|
Loading…
Reference in a new issue