removing TLD sort for now

Due to some performance issues, I'm removing the reverse TLD sort for
now.  It works, but I would like to keep this the same as the master
branch for now due to the large amount of changes elsewhere in the
script and the critical nature of adList.conf.
pull/18/head
jacobsalmela 9 years ago
parent f08a056d44
commit 03562c9830

@ -10,8 +10,8 @@ sources=('http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype
'https://adaway.org/hosts.txt'
'http://hosts-file.net/.%5Cad_servers.txt'
'http://www.malwaredomainlist.com/hostslist/hosts.txt'
'http://someonewhocares.org/hosts/hosts'
'http://adblock.gjtech.net/?format=unix-hosts'
'http://someonewhocares.org/hosts/hosts'
'http://adblock.mahakala.is/')
# Variables for various stages of downloading and formatting the list
@ -21,7 +21,7 @@ justDomainsExtension=domains
matter=pihole.0.matter.txt
andLight=pihole.1.andLight.txt
supernova=pihole.2.supernova.txt
eventHorizion=pihole.3.eventHorizon.txt
eventHorizon=pihole.3.eventHorizon.txt
accretionDisc=pihole.4.accretionDisc.txt
eyeOfTheNeedle=pihole.5.wormhole.txt
adList=/etc/dnsmasq.d/adList.conf
@ -92,13 +92,13 @@ function gravity_advanced()
echo "$numberOf domains being pulled in by gravity..."
# Remove lines with no dots (i.e. localhost, localdomain, etc)
echo -n "" > $origin/$supernova | grep '\.' $origin/$andLight >> $origin/$supernova
# Remove newlines, sort by TLD, remove subdomains, and remove duplicates
cat $origin/$supernova | sed $'s/\r$//' | awk -F. '{for (i=NF; i>1; --i) printf "%s.",$i;print $1}' | sort -t'.' -k1,2 | awk -F. 'NR!=1&&substr($0,1,length(p))==p {next} {p=$0".";for (i=NF; i>1; --i) printf "%s.",$i;print $1}' | uniq > $origin/$eventHorizion
numberOf=$(cat $origin/$eventHorizion | wc -l | sed 's/^[ \t]*//')
# Remove newlines, blank lines, sort, and remove duplicates
cat $origin/$supernova | sed $'s/\r$//' | sed '/^$/d' | sort | uniq > $origin/$eventHorizon
numberOf=$(cat $origin/$eventHorizon | wc -l | sed 's/^[ \t]*//')
echo "$numberOf unique domains trapped in the event horizon."
# Format domain list as address=/example.com/127.0.0.1
echo "** Formatting domains into a dnsmasq file..."
cat $origin/$eventHorizion | awk -v "IP=$piholeIP" '{sub(/\r$/,""); print "address=/"$0"/"IP}' > $origin/$accretionDisc
cat $origin/$eventHorizon | awk -v "IP=$piholeIP" '{sub(/\r$/,""); print "address=/"$0"/"IP}' > $origin/$accretionDisc
sudo cp $origin/$accretionDisc $adList
sudo service dnsmasq restart
}

Loading…
Cancel
Save