From 8cadbb90571a012770d921563b4c25f67b4ba7f5 Mon Sep 17 00:00:00 2001 From: Michael S2pac Date: Sat, 13 Dec 2025 18:40:37 +0300 Subject: [PATCH] Refactored xray-tools.sh --- docker-cron-runner/xray-tools.sh | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/docker-cron-runner/xray-tools.sh b/docker-cron-runner/xray-tools.sh index 9e439255..a91e5949 100644 --- a/docker-cron-runner/xray-tools.sh +++ b/docker-cron-runner/xray-tools.sh @@ -126,24 +126,20 @@ install_xray_core() { # Validate the downloaded zip file if [ ! -f "Xray-linux-${ARCH}.zip" ] || [ ! -s "Xray-linux-${ARCH}.zip" ]; then echo "[ERR] Failed to download Xray-core zip or file is empty" - cd "$OLD_DIR" - return 1 + exit 1 fi unzip -q "Xray-linux-${ARCH}.zip" -d ./xray-unzip # Validate the extracted xray binary - if [ ! -f "./xray-unzip/xray" ] || [ ! -s "./xray-unzip/xray" ]; then - echo "[ERR] Failed to extract xray binary" - rm -rf ./xray-unzip - rm -f "Xray-linux-${ARCH}.zip" - cd "$OLD_DIR" - return 1 + if [ -f "./xray-unzip/xray" ]; then + cp ./xray-unzip/xray ./"xray-linux-${FNAME}" + rm -r xray-unzip + rm "Xray-linux-${ARCH}.zip" + else + echo "[ERR] Failed to extract xray binary" + exit 1 fi - - cp ./xray-unzip/xray ./"xray-linux-${FNAME}" - rm -r xray-unzip - rm "Xray-linux-${ARCH}.zip" } if [ "${0##*/}" = "xray-tools.sh" ]; then