mirror of
https://github.com/openwrt/packages.git
synced 2025-02-14 13:48:04 +00:00
Migrate "all_servers" and "fastest_addr" to new option "upstream_mode". Fixes: d0823a8244a0 ("dnsproxy: Update to 0.73.2") Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
20 lines
675 B
Bash
20 lines
675 B
Bash
#!/bin/sh
|
|
|
|
[ -s "/etc/config/dnsproxy" ] || exit 0
|
|
|
|
# Migrate options 'listen_addr' 'listen_port' to list type
|
|
sed -i -e "s,option listen_addr,list listen_addr,g" \
|
|
-e "s,option listen_port,list listen_port,g" "/etc/config/dnsproxy"
|
|
|
|
# Migrate 'all_servers' and 'fastest_addr' to 'upstream_mode'
|
|
if [ "$(uci -q get "dnsproxy.global.all_servers")" = "1" ]; then
|
|
uci -q set "dnsproxy.global.upstream_mode"="parallel"
|
|
elif [ "$(uci -q get "dnsproxy.global.fastest_addr")" = "1" ]; then
|
|
uci -q set "dnsproxy.global.upstream_mode"="fastest_addr"
|
|
fi
|
|
uci -q delete "dnsproxy.global.all_servers"
|
|
uci -q delete "dnsproxy.global.fastest_addr"
|
|
uci -q commit "dnsproxy"
|
|
|
|
exit 0
|