/etc/init.d/ruantiblock: fixed gawk issue.

This commit is contained in:
gSpot
2025-04-09 17:57:56 +03:00
parent 9c38a0a531
commit 82fd11b612
3 changed files with 6 additions and 6 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.4-r2" RUAB_VERSION="2.1.4-r3"
RUAB_MOD_LUA_VERSION="2.1.4-r1" RUAB_MOD_LUA_VERSION="2.1.4-r1"
RUAB_LUCI_APP_VERSION="2.1.4-r1" RUAB_LUCI_APP_VERSION="2.1.4-r1"
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.4 PKG_VERSION:=2.1.4
PKG_RELEASE:=2 PKG_RELEASE:=3
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
+4 -4
View File
@@ -13,20 +13,20 @@ get_dnsmasq_confdir() {
printf "${VAR_DIR}/dnsmasq.d" printf "${VAR_DIR}/dnsmasq.d"
return 0 return 0
else else
_first_instance_dir=`ubus call service list | jsonfilter -e "VAR=$.dnsmasq.instances.*.mount" | awk -v CUR_DIR="$_current_dir" ' _first_instance_dir=$(ubus call service list | jsonfilter -e "VAR=$.dnsmasq.instances.*.mount" | awk -v CUR_DIR="$_current_dir" '
BEGIN { BEGIN {
RS = " "; RS = " ";
} }
{ {
sub("VAR=", "", $0); sub("VAR=", "", $0);
gsub(/[\047,\134,\073]/, "", $0); gsub(/[\047,\073,\\]/, "", $0);
if($0 ~ /^\/tmp\/dnsmasq\./ && !($0 in a)) { if($0 ~ /^\/tmp\/dnsmasq\./ && !($0 in a)) {
a[length(a)] = $0; a[length(a)] = $0;
}; };
} }
END { END {
print (CUR_DIR in a) ? CUR_DIR : a[0]; print (CUR_DIR in a) ? CUR_DIR : a[0];
}'` }')
if [ -n "$_first_instance_dir" ]; then if [ -n "$_first_instance_dir" ]; then
printf "$_first_instance_dir" printf "$_first_instance_dir"
return 0 return 0
@@ -40,7 +40,7 @@ start() {
config_load $APP_NAME config_load $APP_NAME
config_get _update_at_startup config update_at_startup config_get _update_at_startup config update_at_startup
config_get _dnsmasq_confdir_cur config dnsmasq_confdir "" config_get _dnsmasq_confdir_cur config dnsmasq_confdir ""
_dnsmasq_confdir=`get_dnsmasq_confdir "$_dnsmasq_confdir_cur"` _dnsmasq_confdir=$(get_dnsmasq_confdir "$_dnsmasq_confdir_cur")
if [ $? -eq 0 -a -n "$_dnsmasq_confdir" ]; then if [ $? -eq 0 -a -n "$_dnsmasq_confdir" ]; then
if [ "$_dnsmasq_confdir" != "$_dnsmasq_confdir_cur" ]; then if [ "$_dnsmasq_confdir" != "$_dnsmasq_confdir_cur" ]; then
uci set "${APP_NAME}.config.dnsmasq_confdir"="$_dnsmasq_confdir" uci set "${APP_NAME}.config.dnsmasq_confdir"="$_dnsmasq_confdir"