Minor improvements: optional update scripts (pre_update_script, post_update_script).

This commit is contained in:
gSpot
2025-03-02 15:24:11 +03:00
parent 8c9560f91c
commit 9c38a0a531
3 changed files with 12 additions and 4 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ LUCI_APP=1
HTTPS_DNS_PROXY=1
OWRT_VERSION="current"
RUAB_VERSION="2.1.4-r1"
RUAB_VERSION="2.1.4-r2"
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"
+1 -1
View File
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=ruantiblock
PKG_VERSION:=2.1.4
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/ruantiblock_openwrt>
include $(INCLUDE_DIR)/package.mk
+10 -2
View File
@@ -190,10 +190,14 @@ export BLLIST_ALT_DNS_ADDR="8.8.8.8"
CONFIG_SCRIPT="${SCRIPTS_DIR}/config_script"
export USER_INSTANCES_COMMON="${SCRIPTS_DIR}/user_instances_common"
export CONFIG_SCRIPT_USER_INSTANCES="${SCRIPTS_DIR}/config_script_user_instances"
START_SCRIPT="${SCRIPTS_DIR}/start_script"
STOP_SCRIPT="${SCRIPTS_DIR}/stop_script"
BLLIST_SOURCES_SCRIPT="${SCRIPTS_DIR}/blacklist_sources"
### Event scripts
START_SCRIPT="${MODULES_DIR}/start_script"
STOP_SCRIPT="${MODULES_DIR}/stop_script"
PRE_UPDATE_SCRIPT="${MODULES_DIR}/pre_update_script"
POST_UPDATE_SCRIPT="${MODULES_DIR}/post_update_script"
### Config script
[ -f "$CONFIG_SCRIPT" ] && . "$CONFIG_SCRIPT"
@@ -1088,6 +1092,8 @@ Update() {
MakeLogRecord "err" "${_arg} - Error! Another instance of update is already running"
_return_code=2
else
### Pre-update script
[ -x "$PRE_UPDATE_SCRIPT" ] && $PRE_UPDATE_SCRIPT > /dev/null 2>&1 &
ToggleUPIDFile add
echo " ${NAME} ${_arg}..."
MakeLogRecord "notice" "${_arg}..."
@@ -1100,6 +1106,8 @@ Update() {
_return_code=$?
RestartDnsmasq
ToggleUPIDFile del
### Pre-update script
[ -x "$POST_UPDATE_SCRIPT" ] && $POST_UPDATE_SCRIPT > /dev/null 2>&1 &
fi
MakeToken
return $_return_code