mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-28 00:53:19 +00:00
Moved sed replacement earlier so it's per-file
Instead of processing 1.6 milion entries in one go, sed will replace things on a per-hosts-file basis. Placing it here should cover both existing pi-hole installations and fix things if gravity.sh is re-run.
This commit is contained in:
parent
258f0b4127
commit
ab929c5509
1 changed files with 2 additions and 3 deletions
|
@ -69,6 +69,8 @@ do
|
|||
# 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
|
||||
echo "$data" | awk 'NF {if ($1 !~ "#") { if (NF>1) {print $2} else {print $1}}}' > $saveLocation."$justDomainsExtension"
|
||||
# replace domains that have two dots (..com) with one dot and let duplicate removal sort out any duplicate domains
|
||||
sed -i -e 's/\.\./\./g' $saveLocation."$justDomainsExtension"
|
||||
else
|
||||
echo "Skipping $domain list because it does not have any new entries..."
|
||||
fi
|
||||
|
@ -101,9 +103,6 @@ function gravity_advanced()
|
|||
# Format domain list as "192.168.x.x domain.com"
|
||||
echo "** Formatting domains into a HOSTS file..."
|
||||
cat $origin/$eventHorizon | awk '{sub(/\r$/,""); print "'"$piholeIP"'" $0}' > $origin/$accretionDisc
|
||||
# remove corrupt lines (like ..com)
|
||||
echo "** Deleting invalid entries..."
|
||||
sed -i '/\.\./d' $origin/$accretionDisc
|
||||
# Copy the file over as /etc/pihole/gravity.list so dnsmasq can use it
|
||||
sudo cp $origin/$accretionDisc $adList
|
||||
kill -HUP $(pidof dnsmasq)
|
||||
|
|
Loading…
Reference in a new issue