From ce0ef71d64819d1b933e31109d8889d7dc51d980 Mon Sep 17 00:00:00 2001 From: vernesong <42875168+vernesong@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:37:31 +0800 Subject: [PATCH] chore: refine --- luci-app-openclash/Makefile | 1 + .../root/usr/share/openclash/openclash_core.sh | 2 ++ .../root/usr/share/openclash/openclash_update.sh | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/luci-app-openclash/Makefile b/luci-app-openclash/Makefile index 25bb39d1f5..5cb3695e3c 100644 --- a/luci-app-openclash/Makefile +++ b/luci-app-openclash/Makefile @@ -112,6 +112,7 @@ define Package/$(PKG_NAME)/prerm #!/bin/sh uci -q set openclash.config.enable=0 uci -q commit openclash + [ -n "$(pidof clash)" ] && /etc/init.d/openclash stop 2>/dev/null cp -f "/etc/config/openclash" "/tmp/openclash.bak" >/dev/null 2>&1 cp -rf "/etc/openclash" "/tmp/openclash" >/dev/null 2>&1 cp -rf "/usr/share/openclash/ui/yacd" "/tmp/openclash_yacd" >/dev/null 2>&1 diff --git a/luci-app-openclash/root/usr/share/openclash/openclash_core.sh b/luci-app-openclash/root/usr/share/openclash/openclash_core.sh index 1a2be0b103..ef35ed9a9e 100644 --- a/luci-app-openclash/root/usr/share/openclash/openclash_core.sh +++ b/luci-app-openclash/root/usr/share/openclash/openclash_core.sh @@ -90,6 +90,8 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then uci -q set openclash.config.config_reload=1 uci -q commit openclash if ([ -z "$2" ] || ([ -n "$2" ] && [ "$2" != "one_key_update" ])) && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then + uci -q set openclash.config.config_reload=0 + uci -q commit openclash /etc/init.d/openclash restart >/dev/null 2>&1 & fi else diff --git a/luci-app-openclash/root/usr/share/openclash/openclash_update.sh b/luci-app-openclash/root/usr/share/openclash/openclash_update.sh index b2fef6fecf..8f93705f4a 100644 --- a/luci-app-openclash/root/usr/share/openclash/openclash_update.sh +++ b/luci-app-openclash/root/usr/share/openclash/openclash_update.sh @@ -98,6 +98,8 @@ if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && [ "$(expr "$OP_LV" \> "$OP_CV")" -eq 1 if [ -z "$(opkg install /tmp/openclash.ipk --noaction 2>/dev/null |grep 'Upgrading luci-app-openclash on root' 2>/dev/null)" ]; then LOG_OUT "【OpenClash - v$LAST_VER】Pre Update Test Failed, The File is Saved in /tmp/openclash.ipk, Please Try to Update Manually!" if [ "$(uci -q get openclash.config.config_reload)" -eq 1 ]; then + uci -q set openclash.config.config_reload=0 + uci -q commit openclash /etc/init.d/openclash restart >/dev/null 2>&1 & else SLOG_CLEAN @@ -178,6 +180,8 @@ EOF rm -rf /tmp/openclash.ipk >/dev/null 2>&1 rm -rf /tmp/openclash.apk >/dev/null 2>&1 if [ "$(uci -q get openclash.config.config_reload)" -eq 1 ]; then + uci -q set openclash.config.config_reload=0 + uci -q commit openclash /etc/init.d/openclash restart >/dev/null 2>&1 & else SLOG_CLEAN @@ -190,6 +194,8 @@ else LOG_OUT "OpenClash Has not Been Updated, Stop Continuing!" fi if [ "$(uci -q get openclash.config.config_reload)" -eq 1 ]; then + uci -q set openclash.config.config_reload=0 + uci -q commit openclash /etc/init.d/openclash restart >/dev/null 2>&1 & else SLOG_CLEAN