1
0
mirror of https://github.com/moparisthebest/pi-hole synced 2024-11-22 17:22:16 -05:00

Build array of active domains to concatenate

Fix #86 Builds an array of active domains, and then loops through that list to pick files to concatenate after truncating Matter.
This commit is contained in:
Dan Schaper 2015-11-23 13:12:11 -08:00
parent e2b518568e
commit 20399b8262

View File

@ -113,6 +113,7 @@ do
# Save the file as list.#.domain # Save the file as list.#.domain
saveLocation=$piholeDir/list.$i.$domain.$justDomainsExtension saveLocation=$piholeDir/list.$i.$domain.$justDomainsExtension
activeDomains[$i]=$saveLocation
agent="Mozilla/10.0" agent="Mozilla/10.0"
@ -140,9 +141,13 @@ done
# Schwarzchild - aggregate domains to one list and add blacklisted domains # Schwarzchild - aggregate domains to one list and add blacklisted domains
function gravity_Schwarzchild() { function gravity_Schwarzchild() {
# Find all files with the .domains extension and compile them into one file and remove CRs # Find all active domains and compile them into one file and remove CRs
echo "** Aggregating list of domains..." echo "** Aggregating list of domains..."
find $piholeDir/ -type f -name "*.$justDomainsExtension" -exec cat {} \; | tr -d '\r' > $piholeDir/$matter truncate -s 0 $piholeDir/$matter
for i in "${activeDomains[@]}"
do
cat $i |tr -d '\r' >> $piholeDir/$matter
done
# Append blacklist entries if they exist # Append blacklist entries if they exist
if [[ -r $blacklist ]];then if [[ -r $blacklist ]];then