mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-26 19:02:51 +08:00
🐤 Sync 2026-10-03 00:12:36
This commit is contained in:
1 parent
ce3df55b24
commit
cb1d978497
58 files changed
+1627
-1018
No files matched your search
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall2
|
||||
PKG_VERSION:=26.10.1
|
||||
PKG_RELEASE:=133
|
||||
PKG_RELEASE:=134
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
||||
@@ -5,11 +5,10 @@ STOP=15
|
||||
|
||||
. $IPKG_INSTROOT/usr/share/passwall2/utils.sh
|
||||
APP_FILE=${APP_PATH}/app.sh
|
||||
LOCK_FILE_DIR=/var/lock
|
||||
LOCK_FILE=${LOCK_FILE_DIR}/${CONFIG}.lock
|
||||
LOCK_FILE=${LOCK_PATH}/${CONFIG}.lock
|
||||
|
||||
set_lock() {
|
||||
[ ! -d "$LOCK_FILE_DIR" ] && mkdir -p $LOCK_FILE_DIR
|
||||
[ ! -d "$LOCK_PATH" ] && mkdir -p $LOCK_PATH
|
||||
exec 999>"$LOCK_FILE"
|
||||
flock -xn 999
|
||||
}
|
||||
@@ -33,13 +32,16 @@ unlock() {
|
||||
}
|
||||
|
||||
boot_func() {
|
||||
rm -f ${LOCK_PATH}/${CONFIG}_ready.lock
|
||||
rm -f ${LOCK_PATH}/${CONFIG}_rule_update.lock
|
||||
rm -f ${LOCK_PATH}/${CONFIG}_subscribe.lock
|
||||
local delay=$(uci -q get ${CONFIG}.@global_delay[0].start_delay || echo 1)
|
||||
if [ "$delay" -gt 0 ]; then
|
||||
log_i18n 0 "Start after a delay of %s seconds!" "${delay}"
|
||||
sleep $delay
|
||||
fi
|
||||
restart boot
|
||||
touch ${LOCK_FILE_DIR}/${CONFIG}_ready.lock
|
||||
touch ${LOCK_PATH}/${CONFIG}_ready.lock
|
||||
}
|
||||
|
||||
boot() {
|
||||
@@ -64,8 +66,8 @@ stop() {
|
||||
restart() {
|
||||
set_lock
|
||||
[ $? == 1 ] && log_i18n 0 "The script is already running, do not run it again. Exit." && exit 0
|
||||
rule_lock=${LOCK_FILE_DIR}/${CONFIG}_rule_update.lock
|
||||
sub_lock=${LOCK_FILE_DIR}/${CONFIG}_subscribe.lock
|
||||
rule_lock=${LOCK_PATH}/${CONFIG}_rule_update.lock
|
||||
sub_lock=${LOCK_PATH}/${CONFIG}_subscribe.lock
|
||||
for i in $(seq 1 300); do
|
||||
if [ ! -f "$rule_lock" ] && [ ! -f "$sub_lock" ]; then
|
||||
break
|
||||
|
||||
@@ -591,7 +591,7 @@ start_socks() {
|
||||
}
|
||||
|
||||
clean_crontab() {
|
||||
[ -f "/tmp/lock/${CONFIG}_cron.lock" ] && return
|
||||
[ -f "${LOCK_PATH}/${CONFIG}_cron.lock" ] && return
|
||||
touch /etc/crontabs/root
|
||||
#sed -i "/${CONFIG}/d" /etc/crontabs/root >/dev/null 2>&1
|
||||
sed -i "/$(echo "/etc/init.d/${CONFIG}" | sed 's#\/#\\\/#g')/d" /etc/crontabs/root >/dev/null 2>&1
|
||||
@@ -599,7 +599,7 @@ clean_crontab() {
|
||||
sed -i "/$(echo "lua ${APP_PATH}/subscribe.lua start" | sed 's#\/#\\\/#g')/d" /etc/crontabs/root >/dev/null 2>&1
|
||||
|
||||
busybox pgrep -af "${CONFIG}/" | awk '/tasks\.sh/{print $1}' | xargs kill -9 >/dev/null 2>&1
|
||||
rm -rf /tmp/lock/${CONFIG}_tasks.lock
|
||||
rm -f ${LOCK_PATH}/${CONFIG}_tasks.lock
|
||||
}
|
||||
|
||||
start_crontab() {
|
||||
@@ -608,8 +608,8 @@ start_crontab() {
|
||||
[ "$start_daemon" = "1" ] && { $APP_PATH/monitor.sh > /dev/null 2>&1 & }
|
||||
fi
|
||||
|
||||
[ -f "/tmp/lock/${CONFIG}_cron.lock" ] && {
|
||||
rm -rf "/tmp/lock/${CONFIG}_cron.lock"
|
||||
[ -f "${LOCK_PATH}/${CONFIG}_cron.lock" ] && {
|
||||
rm -rf "${LOCK_PATH}/${CONFIG}_cron.lock"
|
||||
log_i18n 0 "The task is currently running automatically as a scheduled task; no reconfiguration of the scheduled task is required."
|
||||
return
|
||||
}
|
||||
@@ -716,7 +716,7 @@ start_crontab() {
|
||||
}
|
||||
|
||||
stop_crontab() {
|
||||
[ -f "/tmp/lock/${CONFIG}_cron.lock" ] && return
|
||||
[ -f "${LOCK_PATH}/${CONFIG}_cron.lock" ] && return
|
||||
clean_crontab
|
||||
/etc/init.d/cron restart
|
||||
#log_i18n 0 "Clear scheduled commands."
|
||||
@@ -934,6 +934,9 @@ start() {
|
||||
}
|
||||
fi
|
||||
run_process_queue
|
||||
[ "$1" = "boot" ] && {
|
||||
rm -f "${LOCK_PATH}/${CONFIG}_cron.lock"
|
||||
}
|
||||
start_crontab
|
||||
log_i18n 0 "Running complete!"
|
||||
echolog "\n"
|
||||
@@ -996,8 +999,15 @@ stop() {
|
||||
[ -n "${bak_bridge_nf_ip6t}" ] && sysctl -w net.bridge.bridge-nf-call-ip6tables=${bak_bridge_nf_ip6t} >/dev/null 2>&1
|
||||
}
|
||||
rm -rf $TMP_PATH
|
||||
rm -rf /tmp/lock/${CONFIG}_socks_auto_switch*
|
||||
rm -rf /tmp/lock/${CONFIG}_lease2hosts*
|
||||
rm -f ${LOCK_PATH}/${CONFIG}_socks_auto_switch*
|
||||
rm -f ${LOCK_PATH}/${CONFIG}_lease2hosts*
|
||||
rm -f ${LOCK_PATH}/${CONFIG}_monitor*
|
||||
if ! busybox pgrep -af "${CONFIG}/" | grep -q '/subscribe\.lua'; then
|
||||
rm -f "${LOCK_PATH}/${CONFIG}_subscribe.lock"
|
||||
fi
|
||||
if ! busybox pgrep -af "${CONFIG}/" | grep -q '/rule_update\.lua'; then
|
||||
rm -f "${LOCK_PATH}/${CONFIG}_rule_update.lock"
|
||||
fi
|
||||
log_i18n 0 "Clearing and closing related programs and cache complete."
|
||||
exit 0
|
||||
}
|
||||
|
||||
@@ -239,8 +239,8 @@ uci_save(true)
|
||||
|
||||
if reboot == 1 then
|
||||
if arg3 == "cron" then
|
||||
if not fs.access("/var/lock/" .. appname .. ".lock") then
|
||||
sys.call("touch /tmp/lock/" .. appname .. "_cron.lock")
|
||||
if not fs.access(api.LOCK_PREFIX .. ".lock") then
|
||||
sys.call("touch %s_cron.lock" % api.LOCK_PREFIX)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user