treewide: switch to /tmp/resolv.conf.d/resolv.conf.auto

This commit is contained in:
CN_SZTL 2020-07-25 19:46:23 +08:00
parent 899cc45dc4
commit 6d170db961
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
7 changed files with 15 additions and 14 deletions

View File

@ -31,8 +31,9 @@ boot() {
chmod 0700 /tmp/.uci
touch /var/log/wtmp
touch /var/log/lastlog
touch /tmp/resolv.conf.auto
ln -sf /tmp/resolv.conf.auto /tmp/resolv.conf
mkdir -p /tmp/resolv.conf.d
touch /tmp/resolv.conf.d/resolv.conf.auto
ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf.auto
grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug
[ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe

View File

@ -18,7 +18,7 @@ end
function get_template_config()
local b
local d=""
for cnt in io.lines("/tmp/resolv.conf.auto") do
for cnt in io.lines("/tmp/resolv.conf.d/resolv.conf.auto") do
b=string.match (cnt,"^[^#]*nameserver%s+([^%s]+)$")
if (b~=nil) then
d=d.." - "..b.."\n"

View File

@ -8,7 +8,7 @@ require("table")
function gen_template_config()
local b
local d=""
for cnt in io.lines("/tmp/resolv.conf.auto") do
for cnt in io.lines("/tmp/resolv.conf.d/resolv.conf.auto") do
b=string.match (cnt,"^[^#]*nameserver%s+([^%s]+)$")
if (b~=nil) then
d=d.." - "..b.."\n"
@ -94,4 +94,4 @@ function m.on_commit(map)
fs.writefile("/var/run/AdGlucitest","")
end
end
return m
return m

View File

@ -470,7 +470,7 @@ function rand_geturl(){
uci delete network.wan.mtu
uci commit network
uci set dhcp.@dnsmasq[0].port='53'
uci set dhcp.@dnsmasq[0].resolvfile='/tmp/resolv.conf.auto'
uci set dhcp.@dnsmasq[0].resolvfile='/tmp/resolv.conf.d/resolv.conf.auto'
uci delete dhcp.@dnsmasq[0].server
uci delete dhcp.@dnsmasq[0].noresolv
uci commit dhcp

View File

@ -21,11 +21,11 @@ del_cron()
/etc/init.d/cron restart
}
fixflowoffload(){
dns=$(uci get flowoffload.@flow[0].dns 2>/dev/null)
fixturboacc(){
dns=$(uci get turboacc.config.dns_caching 2>/dev/null)
if [ $dns -eq 1 ]; then
uci set flowoffload.@flow[0].dns=0 && uci commit flowoffload
/etc/init.d/flowoffload restart
uci set turboacc.config.dns_caching=0 && uci commit turboacc
/etc/init.d/turboacc restart
fi
}
@ -170,7 +170,7 @@ start()
exit
fi
makeconfig
fixflowoffload
fixturboacc
dnsforwarder -f $DNSFORWARDER_CONF -d
sleep 10
mkdir -p ${PID_PATH}
@ -202,7 +202,7 @@ stop()
local addr=$(uci get dnsforwarder.@arguments[0].addr 2>/dev/null)
addr=${addr/:/#}
uci del_list dhcp.@dnsmasq[0].server=$addr 2>/dev/null
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto 2>/dev/null
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.d/resolv.conf.auto 2>/dev/null
uci delete dhcp.@dnsmasq[0].noresolv 2>/dev/null
uci delete dhcp.@dnsmasq[0].serversfile 2>/dev/null
uci commit dhcp

View File

@ -201,7 +201,7 @@ change_dns() {
revert_dns() {
uci del_list dhcp.@dnsmasq[0].server="127.0.0.1#5333" 2>/dev/null
uci set dhcp.@dnsmasq[0].resolvfile="/tmp/resolv.conf.auto"
uci set dhcp.@dnsmasq[0].resolvfile="/tmp/resolv.conf.d/resolv.conf.auto"
uci set dhcp.@dnsmasq[0].noresolv="0"
uci commit dhcp
}

View File

@ -11,6 +11,6 @@ config ipset-dns
#option port '53001'
# use given upstream DNS server,
# defaults to first entry in /tmp/resolv.conf.auto
# defaults to first entry in /tmp/resolv.conf.d/resolv.conf.auto
#option dns '8.8.8.8'