openwrt_helloworld/luci-app-homeproxy/root/etc/uci-defaults/luci-homeproxy-migration
2024-09-03 23:00:08 +08:00

22 lines
713 B
Bash

#!/bin/sh
china_dns_server="$(uci -q get "homeproxy.config.china_dns_server")"
if [ "$china_dns_server" = "wan_114" ]; then
uci -q delete "homeproxy.config.china_dns_server"
uci -q add_list "homeproxy.config.china_dns_server"="wan"
uci -q add_list "homeproxy.config.china_dns_server"="114.114.114.114"
elif echo "$china_dns_server" | grep -q ","; then
uci -q delete "homeproxy.config.china_dns_server"
for dns in ${china_dns_server//,/ }; do
uci -q add_list "homeproxy.config.china_dns_server"="$dns"
done
fi
if [ "$(uci -q get homeproxy.config.routing_port)" = "all" ]; then
uci -q delete "homeproxy.config.routing_port"
fi
[ -z "$(uci -q changes "homeproxy")" ] || uci -q commit "homeproxy"
exit 0