From 20399b82620a67a2322a4da51feb79e1620062e4 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 23 Nov 2015 13:12:11 -0800 Subject: [PATCH] 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. --- gravity.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gravity.sh b/gravity.sh index e3337e4..ae20d43 100755 --- a/gravity.sh +++ b/gravity.sh @@ -113,6 +113,7 @@ do # Save the file as list.#.domain saveLocation=$piholeDir/list.$i.$domain.$justDomainsExtension + activeDomains[$i]=$saveLocation agent="Mozilla/10.0" @@ -140,9 +141,13 @@ done # Schwarzchild - aggregate domains to one list and add blacklisted domains 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..." -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 if [[ -r $blacklist ]];then