Fixed config scripts.

This commit is contained in:
gSpot
2025-06-08 15:33:56 +03:00
parent f1839c9388
commit 212ec22d7a
4 changed files with 51 additions and 43 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ LUCI_APP=1
HTTPS_DNS_PROXY=1 HTTPS_DNS_PROXY=1
OWRT_VERSION="current" OWRT_VERSION="current"
RUAB_VERSION="2.1.6-r1" RUAB_VERSION="2.1.6-r2"
RUAB_MOD_LUA_VERSION="2.1.6-r1" RUAB_MOD_LUA_VERSION="2.1.6-r1"
RUAB_LUCI_APP_VERSION="2.1.6-r2" RUAB_LUCI_APP_VERSION="2.1.6-r2"
BASE_URL="https://raw.githubusercontent.com/gSpotx2f/packages-openwrt/master" BASE_URL="https://raw.githubusercontent.com/gSpotx2f/packages-openwrt/master"
+1 -1
View File
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=ruantiblock PKG_NAME:=ruantiblock
PKG_VERSION:=2.1.6 PKG_VERSION:=2.1.6
PKG_RELEASE:=1 PKG_RELEASE:=2
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/ruantiblock_openwrt> PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/ruantiblock_openwrt>
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
@@ -1,5 +1,5 @@
UCI_SECTION="ruantiblock.config" UCI_SECTION="${NAME}.config"
UCI_VARS="dnsmasq_confdir 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_type t_proxy_port_tcp t_proxy_port_udp t_proxy_allow_udp enable_logging bllist_min_entries bllist_module bllist_preset bllist_ip_limit bllist_summarize_ip bllist_summarize_cidr bllist_ip_filter bllist_ip_filter_type bllist_sd_limit bllist_fqdn_filter bllist_fqdn_filter_type bllist_enable_idn bllist_alt_nslookup bllist_alt_dns_addr update_at_startup enable_tmp_downloads" UCI_VARS="dnsmasq_confdir 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_type t_proxy_port_tcp t_proxy_port_udp t_proxy_allow_udp enable_logging bllist_min_entries bllist_module bllist_preset bllist_ip_limit bllist_summarize_ip bllist_summarize_cidr bllist_ip_filter bllist_ip_filter_type bllist_sd_limit bllist_fqdn_filter bllist_fqdn_filter_type bllist_enable_idn bllist_alt_nslookup bllist_alt_dns_addr update_at_startup enable_tmp_downloads"
UCI_CMD="$(which uci)" UCI_CMD="$(which uci)"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@@ -8,26 +8,30 @@ if [ $? -ne 0 ]; then
fi fi
AWK_CMD="awk" AWK_CMD="awk"
eval $($UCI_CMD show "$UCI_SECTION" | $AWK_CMD -F "=" -v UCI_VARS="$UCI_VARS" ' eval $($UCI_CMD show "$UCI_SECTION" | $AWK_CMD -v UCI_VARS="$UCI_VARS" '
BEGIN { BEGIN {
split(UCI_VARS, split_array, " "); split(UCI_VARS, split_array, " ");
for(i in split_array) for(i in split_array)
vars_array[split_array[i]]=""; vars_array[split_array[i]]="";
} }
{ {
sub(/^.*[.]/, "", $1); match($0, /^[^=]+/);
gsub(/["\047]/, "", $2); end = RSTART + RLENGTH;
if($1 in vars_array) { name = substr($0, RSTART, end - 1);
print toupper($1) "=\"" $2 "\""; val = substr($0, end + 1);
delete vars_array[$1]; sub(/^.*[.]/, "", name);
}; gsub(/["\047]/, "", val);
} if(name in vars_array) {
END { print toupper(name) "=\"" val "\"";
if(length(vars_array) > 0) { delete vars_array[name];
for(i in vars_array) };
print toupper(i) "=\"""\""; }
}; END {
}') if(length(vars_array) > 0) {
for(i in vars_array)
print toupper(i) "=\"""\"";
};
}')
. /lib/functions/network.sh . /lib/functions/network.sh
network_get_subnet subnet_lan "lan" network_get_subnet subnet_lan "lan"
@@ -27,26 +27,30 @@ IncludeUserInstanceVars() {
local _inst="$1" local _inst="$1"
local _uci_section="${NAME}.${_inst}" local _uci_section="${NAME}.${_inst}"
U_NAME="$_inst" U_NAME="$_inst"
eval $($UCI_CMD show "$_uci_section" | $AWK_CMD -F "=" -v UCI_VARS="$UCI_VARS" ' eval $($UCI_CMD show "$_uci_section" | $AWK_CMD -v UCI_VARS="$UCI_VARS" '
BEGIN { BEGIN {
split(UCI_VARS, split_array, " "); split(UCI_VARS, split_array, " ");
for(i in split_array) for(i in split_array)
vars_array[split_array[i]]=""; vars_array[split_array[i]]="";
} }
{ {
sub(/^.*[.]/, "", $1); match($0, /^[^=]+/);
gsub(/["\047]/, "", $2); end = RSTART + RLENGTH;
if($1 in vars_array) { name = substr($0, RSTART, end - 1);
print toupper($1) "=\"" $2 "\""; val = substr($0, end + 1);
delete vars_array[$1]; sub(/^.*[.]/, "", name);
}; gsub(/["\047]/, "", val);
} if(name in vars_array) {
END { print toupper(name) "=\"" val "\"";
if(length(vars_array) > 0) { delete vars_array[name];
for(i in vars_array) };
print toupper(i) "=\"""\""; }
}; END {
}') if(length(vars_array) > 0) {
for(i in vars_array)
print toupper(i) "=\"""\"";
};
}')
if [ $DEBUG -ge 2 ]; then if [ $DEBUG -ge 2 ]; then
echo " user_instances_config_script.IncludeUserInstanceVars: _inst=${_inst} U_NAME=${U_NAME} U_PROXY_MODE=${U_PROXY_MODE}" >&2 echo " user_instances_config_script.IncludeUserInstanceVars: _inst=${_inst} U_NAME=${U_NAME} U_PROXY_MODE=${U_PROXY_MODE}" >&2