diff --git a/autoinstall/2.x/autoinstall.sh b/autoinstall/2.x/autoinstall.sh index 0e86421..a08666c 100755 --- a/autoinstall/2.x/autoinstall.sh +++ b/autoinstall/2.x/autoinstall.sh @@ -10,9 +10,9 @@ LUCI_APP=1 HTTPS_DNS_PROXY=1 OWRT_VERSION="current" -RUAB_VERSION="2.1.3-r1" -RUAB_MOD_LUA_VERSION="2.1.3-r1" -RUAB_LUCI_APP_VERSION="2.1.3-r2" +RUAB_VERSION="2.1.4-r1" +RUAB_MOD_LUA_VERSION="2.1.4-r1" +RUAB_LUCI_APP_VERSION="2.1.4-r1" BASE_URL="https://raw.githubusercontent.com/gSpotx2f/packages-openwrt/master" PKG_DIR="/tmp" diff --git a/luci-app-ruantiblock/Makefile b/luci-app-ruantiblock/Makefile index c161204..6aaa118 100644 --- a/luci-app-ruantiblock/Makefile +++ b/luci-app-ruantiblock/Makefile @@ -5,8 +5,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-ruantiblock -PKG_VERSION:=2.1.3 -PKG_RELEASE:=2 +PKG_VERSION:=2.1.4 +PKG_RELEASE:=1 LUCI_TITLE:=LuCI support for ruantiblock LUCI_DEPENDS:=+ruantiblock LUCI_PKGARCH:=all diff --git a/ruantiblock-mod-lua/Makefile b/ruantiblock-mod-lua/Makefile index 81e2d7c..ef2b6b9 100644 --- a/ruantiblock-mod-lua/Makefile +++ b/ruantiblock-mod-lua/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ruantiblock-mod-lua -PKG_VERSION:=2.1.3 +PKG_VERSION:=2.1.4 PKG_RELEASE:=1 PKG_MAINTAINER:=gSpot diff --git a/ruantiblock-mod-py/Makefile b/ruantiblock-mod-py/Makefile index 8404cd6..d482983 100644 --- a/ruantiblock-mod-py/Makefile +++ b/ruantiblock-mod-py/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ruantiblock-mod-py -PKG_VERSION:=2.1.3 +PKG_VERSION:=2.1.4 PKG_RELEASE:=1 PKG_MAINTAINER:=gSpot diff --git a/ruantiblock/Makefile b/ruantiblock/Makefile index ec852f7..2cfdfb5 100644 --- a/ruantiblock/Makefile +++ b/ruantiblock/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ruantiblock -PKG_VERSION:=2.1.3 +PKG_VERSION:=2.1.4 PKG_RELEASE:=1 PKG_MAINTAINER:=gSpot diff --git a/ruantiblock/files/etc/init.d/ruantiblock b/ruantiblock/files/etc/init.d/ruantiblock index 68db8e7..ca27be5 100755 --- a/ruantiblock/files/etc/init.d/ruantiblock +++ b/ruantiblock/files/etc/init.d/ruantiblock @@ -8,12 +8,12 @@ APP_EXEC="/usr/bin/${APP_NAME}" VAR_DIR="/tmp" get_dnsmasq_confdir() { - local _first_instance_dir + local _current_dir="$1" _first_instance_dir if [ -d "${VAR_DIR}/dnsmasq.d" ]; then printf "${VAR_DIR}/dnsmasq.d" return 0 else - _first_instance_dir=`ubus call service list | jsonfilter -e "VAR=$.dnsmasq.instances.*.mount" | awk ' + _first_instance_dir=`ubus call service list | jsonfilter -e "VAR=$.dnsmasq.instances.*.mount" | awk -v CUR_DIR="$_current_dir" ' BEGIN { RS = " "; } @@ -25,7 +25,7 @@ get_dnsmasq_confdir() { }; } END { - print a[0]; + print (CUR_DIR in a) ? CUR_DIR : a[0]; }'` if [ -n "$_first_instance_dir" ]; then printf "$_first_instance_dir" @@ -36,18 +36,18 @@ get_dnsmasq_confdir() { } start() { - local _update_at_startup _dnsmasq_confdir + local _update_at_startup _dnsmasq_confdir_cur _dnsmasq_confdir config_load $APP_NAME config_get _update_at_startup config update_at_startup - config_get _dnsmasq_confdir config dnsmasq_confdir "" - if [ -z "$_dnsmasq_confdir" ]; then - _dnsmasq_confdir=`get_dnsmasq_confdir` - if [ $? -eq 0 -a -n "$_dnsmasq_confdir" ]; then + config_get _dnsmasq_confdir_cur config dnsmasq_confdir "" + _dnsmasq_confdir=`get_dnsmasq_confdir "$_dnsmasq_confdir_cur"` + if [ $? -eq 0 -a -n "$_dnsmasq_confdir" ]; then + if [ "$_dnsmasq_confdir" != "$_dnsmasq_confdir_cur" ]; then uci set "${APP_NAME}.config.dnsmasq_confdir"="$_dnsmasq_confdir" uci commit ruantiblock - else - exit 1 fi + else + exit 1 fi $APP_EXEC start if [ $? -eq 0 -a "$_update_at_startup" = "1" ]; then diff --git a/ruantiblock/files/usr/bin/ruantiblock b/ruantiblock/files/usr/bin/ruantiblock index d81c94b..6e0da76 100755 --- a/ruantiblock/files/usr/bin/ruantiblock +++ b/ruantiblock/files/usr/bin/ruantiblock @@ -643,7 +643,6 @@ CheckStatus() { GetVpnRouteStatus() { local _inst _i=1 _ret_val=0 for _inst in $USER_INSTANCES_VPN_FNAMES - do if ! NftRouteStatus $(($VPN_ROUTE_TABLE_ID_START + $_i)); then _ret_val=1 @@ -662,16 +661,24 @@ ClearDataFiles() { if [ -d "$DATA_DIR" ]; then if [ -z "$_arg" -o "$_arg" = "main_instance" ]; then printf "" > "$IP_DATA_FILE" - printf "" > "$DNSMASQ_DATA_FILE" printf "0 0 0" > "$UPDATE_STATUS_FILE" fi if [ -z "$_arg" -o "$_arg" = "user_instances" ]; then printf "" > "$IP_DATA_FILE_USER_INSTANCES" - printf "" > "$DNSMASQ_DATA_FILE_USER_INSTANCES" printf "" > "$USER_ENTRIES_STATUS_FILE" fi if [ -z "$_arg" ]; then printf "" > "$IP_DATA_FILE_BYPASS" + fi + fi + if [ -d "$DNSMASQ_CONFDIR" ]; then + if [ -z "$_arg" -o "$_arg" = "main_instance" ]; then + printf "" > "$DNSMASQ_DATA_FILE" + fi + if [ -z "$_arg" -o "$_arg" = "user_instances" ]; then + printf "" > "$DNSMASQ_DATA_FILE_USER_INSTANCES" + fi + if [ -z "$_arg" ]; then printf "" > "$DNSMASQ_DATA_FILE_BYPASS" fi fi @@ -681,9 +688,11 @@ PreStartCheck() { [ -d "$DATA_DIR" ] || mkdir -p "$DATA_DIR" [ "$ENABLE_HTML_INFO" = "1" -a ! -d "$HTML_DIR" ] && mkdir -p "$HTML_DIR" ### Костыль для старта dnsmasq - [ -e "$DNSMASQ_DATA_FILE" ] || printf "" > "$DNSMASQ_DATA_FILE" - [ -e "$DNSMASQ_DATA_FILE_BYPASS" ] || printf "" > "$DNSMASQ_DATA_FILE_BYPASS" - [ -e "$DNSMASQ_DATA_FILE_USER_INSTANCES" ] || printf "" > "$DNSMASQ_DATA_FILE_USER_INSTANCES" + if [ -d "$DNSMASQ_CONFDIR" ]; then + [ -e "$DNSMASQ_DATA_FILE" ] || printf "" > "$DNSMASQ_DATA_FILE" + [ -e "$DNSMASQ_DATA_FILE_BYPASS" ] || printf "" > "$DNSMASQ_DATA_FILE_BYPASS" + [ -e "$DNSMASQ_DATA_FILE_USER_INSTANCES" ] || printf "" > "$DNSMASQ_DATA_FILE_USER_INSTANCES" + fi } AddBypassEntries() { @@ -1056,6 +1065,14 @@ MakeToken() { date +%s > "$TOKEN_FILE" } +CheckDnsmasqConfDir() { + if [ ! -d "$DNSMASQ_CONFDIR" ]; then + echo " Error! DNSMASQ_CONFDIR (${DNSMASQ_CONFDIR}) does not exists." >&2 + return 1 + fi + return 0 +} + Update() { local _arg="$1" _return_code=0 if CheckStatus; then @@ -1287,9 +1304,13 @@ case "$1" in ;; update|force-update) Init - Update "$1" - return_code=$? - StatusOutput + if CheckDnsmasqConfDir; then + Update "$1" + return_code=$? + StatusOutput + else + return_code=1 + fi ;; blacklist-files) Init @@ -1297,8 +1318,12 @@ case "$1" in echo " ${NAME} - Error! Another instance of update is already running" >&2 exit 2 else - GetBlacklistFiles - return_code=$? + if CheckDnsmasqConfDir; then + GetBlacklistFiles + return_code=$? + else + return_code=1 + fi fi ;; status)