mirror of
https://github.com/uklans/cache-domains
synced 2025-06-19 07:52:56 +02:00
Move hosts files out of dnsmasq directory
This commit is contained in:
parent
a008c4b1a4
commit
cd69a0b34b
@ -1,6 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
basedir=".."
|
basedir=".."
|
||||||
outputdir="output/dnsmasq"
|
outputdir="output"
|
||||||
|
confpath="/etc/dnsmasq.d"
|
||||||
|
confdir="${outputdir}${confpath}"
|
||||||
|
hostspath="/etc/dnsmasq.hosts"
|
||||||
|
hostsdir="${outputdir}${hostspath}"
|
||||||
path="${basedir}/cache_domains.json"
|
path="${basedir}/cache_domains.json"
|
||||||
|
|
||||||
export IFS=' '
|
export IFS=' '
|
||||||
@ -26,8 +30,9 @@ while read -r line; do
|
|||||||
done <<< $(jq -r '.cache_domains | to_entries[] | .key' config.json)
|
done <<< $(jq -r '.cache_domains | to_entries[] | .key' config.json)
|
||||||
|
|
||||||
rm -rf ${outputdir}
|
rm -rf ${outputdir}
|
||||||
mkdir -p ${outputdir}
|
mkdir -p ${confdir}
|
||||||
touch ${outputdir}/lancache.conf
|
mkdir -p ${hostsdir}
|
||||||
|
touch ${confdir}/lancache.conf
|
||||||
while read -r entry; do
|
while read -r entry; do
|
||||||
unset cacheip
|
unset cacheip
|
||||||
unset cachename
|
unset cachename
|
||||||
@ -44,9 +49,9 @@ while read -r entry; do
|
|||||||
while read -r fileid; do
|
while read -r fileid; do
|
||||||
while read -r filename; do
|
while read -r filename; do
|
||||||
destfilename=$(echo $filename | sed -e 's/txt/hosts/')
|
destfilename=$(echo $filename | sed -e 's/txt/hosts/')
|
||||||
lancacheconf=${outputdir}/lancache.conf
|
lancacheconf=${confdir}/lancache.conf
|
||||||
outputfile=${outputdir}/${destfilename}
|
outputfile=${hostsdir}/${destfilename}
|
||||||
echo "addn-hosts=/etc/dnsmasq.d/${destfilename}" >> ${lancacheconf}
|
echo "addn-hosts=${hostspath}/${destfilename}" >> ${lancacheconf}
|
||||||
touch "$outputfile"
|
touch "$outputfile"
|
||||||
# Wildcard entries
|
# Wildcard entries
|
||||||
while read -r fileentry; do
|
while read -r fileentry; do
|
||||||
|
Loading…
Reference in New Issue
Block a user