Output *.hosts file in output/dnsmasq/hosts/ directory
This commit is contained in:
parent
654d19ce84
commit
c05d2cfec4
@ -46,4 +46,4 @@ The `lancache.conf` should be copied into the `/etc/dnsmasq.d/` location but als
|
|||||||
You can copy the `*.hosts` file to any location other than `/etc/dnsmasq.d/` as this location is utilised only for `*.conf` files.
|
You can copy the `*.hosts` file to any location other than `/etc/dnsmasq.d/` as this location is utilised only for `*.conf` files.
|
||||||
|
|
||||||
For example if utilising Pi-hole a user can copy the `*.hosts` files to `/etc/pihole/` and modify the `lancache.conf` with the following command, prior to copying it to `/etc/dnsmasq.d/`:
|
For example if utilising Pi-hole a user can copy the `*.hosts` files to `/etc/pihole/` and modify the `lancache.conf` with the following command, prior to copying it to `/etc/dnsmasq.d/`:
|
||||||
`sed -i 's/dnsmasq.d/pihole/g' output/dnsmasq/lancache.conf`
|
`sed -i 's/dnsmasq\/hosts/pihole/g' output/dnsmasq/lancache.conf`
|
@ -26,7 +26,7 @@ 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 ${outputdir}/hosts
|
||||||
touch ${outputdir}/lancache.conf
|
touch ${outputdir}/lancache.conf
|
||||||
while read -r entry; do
|
while read -r entry; do
|
||||||
unset cacheip
|
unset cacheip
|
||||||
@ -45,8 +45,8 @@ while read -r entry; 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=${outputdir}/lancache.conf
|
||||||
outputfile=${outputdir}/${destfilename}
|
outputfile=${outputdir}/hosts/${destfilename}
|
||||||
echo "addn-hosts=/etc/dnsmasq/${destfilename}" >> ${lancacheconf}
|
echo "addn-hosts=/etc/dnsmasq/hosts/${destfilename}" >> ${lancacheconf}
|
||||||
touch "$outputfile"
|
touch "$outputfile"
|
||||||
# Wildcard entries
|
# Wildcard entries
|
||||||
while read -r fileentry; do
|
while read -r fileentry; do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user