UCI_SECTION="ruantiblock.config"
UCI_VARS="proxy_mode proxy_local_clients nftset_clear_sets allowed_hosts_mode allowed_hosts_list bypass_mode bypass_entries_dns enable_fproxy fproxy_list enable_bllist_proxy if_vpn vpn_gw_ip vpn_route_check tor_trans_port onion_dns_addr t_proxy_port_tcp t_proxy_port_udp t_proxy_allow_udp add_user_entries user_entries_dns enable_logging bllist_min_entries bllist_module bllist_preset bllist_ip_limit bllist_gr_excluded_nets bllist_summarize_ip bllist_summarize_cidr bllist_ip_filter bllist_ip_filter_type bllist_sd_limit bllist_gr_excluded_sld bllist_fqdn_filter bllist_fqdn_filter_type bllist_enable_idn bllist_alt_nslookup bllist_alt_dns_addr update_at_startup"
UCI_CMD=`which uci`
if [ $? -ne 0 ]; then
    echo " Error! UCI doesn't exists" >&2
    exit 1
fi
AWK_CMD="awk"

eval `$UCI_CMD show "$UCI_SECTION" | $AWK_CMD -F "=" -v UCI_VARS="$UCI_VARS" '
    BEGIN {
        split(UCI_VARS, split_array, " ");
        for(i in split_array)
            vars_array[split_array[i]]="";
    }
    {
        sub(/^.*[.]/, "", $1);
        gsub(/["\047]/, "", $2);
        if($1 in vars_array) {
            print toupper($1) "=\"" $2 "\"";
            delete vars_array[$1];
        };
    }
    END {
        if(length(vars_array) > 0) {
            for(i in vars_array)
                print toupper(i) "=\"""\"";
        };
    }'`
