39 lines
1.0 KiB
Bash
Executable File
39 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
default_proxy=$(uci -q get fchomo.routing.default_proxy)
|
|
if [ -n "$default_proxy" ]; then
|
|
uci -q batch <<-EOF >"/dev/null"
|
|
delete fchomo.routing.default_proxy
|
|
set fchomo.routing.client_enabled="1"
|
|
set fchomo.autogened_final_host="rules"
|
|
set fchomo.autogened_final_host.label="Auto Generated Final"
|
|
set fchomo.autogened_final_host.entry="MATCH,$default_proxy"
|
|
commit fchomo
|
|
EOF
|
|
fi
|
|
|
|
for option in routing_tcpport routing_udpport; do
|
|
value=$(uci -q get fchomo.routing.$option)
|
|
if [ -z "$value" ]; then
|
|
uci -q batch <<-EOF >"/dev/null"
|
|
delete fchomo.routing.$option
|
|
add_list fchomo.routing.$option="all"
|
|
EOF
|
|
elif [ "$value" = "common" ]; then
|
|
uci -q batch <<-EOF >"/dev/null"
|
|
delete fchomo.routing.$option
|
|
add_list fchomo.routing.$option="${option/routing/common}"
|
|
EOF
|
|
elif [ "$value" = "common_stun" ]; then
|
|
uci -q batch <<-EOF >"/dev/null"
|
|
delete fchomo.routing.$option
|
|
add_list fchomo.routing.$option="${option/routing/common}"
|
|
add_list fchomo.routing.$option="stun_port"
|
|
EOF
|
|
fi
|
|
done
|
|
|
|
uci commit fchomo
|
|
|
|
exit 0
|