luci-app-mosdns: init.d: fix error reading local_dns when custom_local_dns is not enabled

fix #61
This commit is contained in:
sbwml 2023-03-24 22:06:52 +08:00
parent c19992b483
commit 51123e7951

View File

@ -60,11 +60,11 @@ init_yaml() {
s,maximum_ttl_custom,$maximum_ttl_custom,g; \
s,adblock,$adlist,g;s,remote_dns_pipeline,$enable_pipeline,g" \
/usr/share/mosdns/default.yaml > $CONF
[ "$custom_local_dns" -eq 0 ] && sed -i "/bootstrap/d" $CONF || \
echo "${local_dns}" > $tmpdir/local_dns.txt
echo "${remote_dns}" > $tmpdir/remote_dns.txt
sed -i -e '/- addr: local_dns/{r '$tmpdir/local_dns.txt -e';d};/- addr: remote_dns/{r '$tmpdir/remote_dns.txt -e';d}' \
$CONF
[ "$custom_local_dns" -eq 0 ] && sed -i "/bootstrap/d" $CONF
rm -rf $tmpdir
}