mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-12-23 06:42:41 +00:00
Refactored xray-tools.sh
This commit is contained in:
parent
e9757350f3
commit
8cadbb9057
1 changed files with 8 additions and 12 deletions
|
|
@ -126,24 +126,20 @@ install_xray_core() {
|
||||||
# Validate the downloaded zip file
|
# Validate the downloaded zip file
|
||||||
if [ ! -f "Xray-linux-${ARCH}.zip" ] || [ ! -s "Xray-linux-${ARCH}.zip" ]; then
|
if [ ! -f "Xray-linux-${ARCH}.zip" ] || [ ! -s "Xray-linux-${ARCH}.zip" ]; then
|
||||||
echo "[ERR] Failed to download Xray-core zip or file is empty"
|
echo "[ERR] Failed to download Xray-core zip or file is empty"
|
||||||
cd "$OLD_DIR"
|
exit 1
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unzip -q "Xray-linux-${ARCH}.zip" -d ./xray-unzip
|
unzip -q "Xray-linux-${ARCH}.zip" -d ./xray-unzip
|
||||||
|
|
||||||
# Validate the extracted xray binary
|
# Validate the extracted xray binary
|
||||||
if [ ! -f "./xray-unzip/xray" ] || [ ! -s "./xray-unzip/xray" ]; then
|
if [ -f "./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
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp ./xray-unzip/xray ./"xray-linux-${FNAME}"
|
cp ./xray-unzip/xray ./"xray-linux-${FNAME}"
|
||||||
rm -r xray-unzip
|
rm -r xray-unzip
|
||||||
rm "Xray-linux-${ARCH}.zip"
|
rm "Xray-linux-${ARCH}.zip"
|
||||||
|
else
|
||||||
|
echo "[ERR] Failed to extract xray binary"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "${0##*/}" = "xray-tools.sh" ]; then
|
if [ "${0##*/}" = "xray-tools.sh" ]; then
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue