Skip to content

Commit

Permalink
Build array of active domains to concatenate
Browse files Browse the repository at this point in the history
Fix #86 Builds an array of active domains, and then loops through that list to pick files to concatenate after truncating Matter.
  • Loading branch information
dschaper committed Nov 23, 2015
1 parent e2b5185 commit 20399b8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions gravity.sh
Expand Up @@ -113,6 +113,7 @@ do

# Save the file as list.#.domain
saveLocation=$piholeDir/list.$i.$domain.$justDomainsExtension
activeDomains[$i]=$saveLocation

agent="Mozilla/10.0"

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 20399b8

Please sign in to comment.