Fix generation scripts

This change leverages #130 and also applies this to the dnsmasq script.

As it currently stands both generation scripts (unbound and dnsmasq) have a condition where a domain will be skipped if it fuzzy matches a domain already parsed that is higher in the CDN domain list.

For example the latter of the below two samples would never be added.
8793ce1531/steam.txt (L20) 8793ce1531/steam.txt (L29)

I've also taken the liberty to sort the output of said scripts for readability and troubleshooting purposes.

Closes #130.
This commit is contained in:
Amir Zarrinkafsh
2020-10-29 23:05:45 +11:00
parent 8793ce1531
commit 74cab757af
2 changed files with 12 additions and 12 deletions

View File

@ -52,14 +52,14 @@ while read entry; do
continue
fi
parsed=$(echo $fileentry | sed -e "s/^\*\.//")
if grep -q "$parsed" $outputfile; then
if grep -qx "$parsed" $outputfile; then
continue
fi
echo " local-zone: \"${parsed}\" redirect" >> $outputfile
for i in ${cacheip}; do
echo " local-data: \"${parsed} 30 IN A ${i}\"" >> $outputfile
done
done <<< $(cat ${basedir}/$filename);
done <<< $(cat ${basedir}/$filename | sort);
done <<< $(jq -r ".cache_domains[$entry].domain_files[$fileid]" $path)
done <<< $(jq -r ".cache_domains[$entry].domain_files | to_entries[] | .key" $path)
done <<< $(jq -r '.cache_domains | to_entries[] | .key' $path)