luci: fix UI not display after upgrade issue.

This commit is contained in:
Nick Peng
2022-12-28 19:45:37 +08:00
parent 58aaaa5d5b
commit dd9cf62d10

View File

@@ -655,6 +655,33 @@ download_file() {
fi
}
check_and_add_entry() {
local docommit=0
uci -q get smartdns.@smartdns[0] >/dev/null
if [ $? -ne 0 ]; then
uci -q add smartdns smartdns >/dev/null
docommit=1
fi
uci -q get smartdns.@domain-rule[0] >/dev/null
if [ $? -ne 0 ]; then
uci -q add smartdns domain-rule >/dev/null
docommit=1
fi
if [ "$docommit" = "1" ]; then
uci -q commit smartdns >/dev/null
fi
if [ ! -d "$SMARTDNS_DOMAIN_LIST_DOWNLOAD_DIR" ]; then
mkdir -p "$SMARTDNS_DOMAIN_LIST_DOWNLOAD_DIR"
fi
if [ ! -d "$SMARTDNS_CONF_DOWNLOAD_DIR" ]; then
mkdir -p "$SMARTDNS_CONF_DOWNLOAD_DIR"
fi
}
updatefiles() {
config_load "smartdns"
config_foreach download_file "download-file"
@@ -669,6 +696,7 @@ service_stopped()
start_service()
{
check_and_add_entry
config_load "smartdns"
config_foreach load_service "smartdns"
}