From 6408b1c65f41b45240e80c52e57ab934219ca9f4 Mon Sep 17 00:00:00 2001 From: Sanaei Date: Wed, 14 Jan 2026 18:11:17 +0100 Subject: [PATCH] Updated Installation (markdown) --- Installation.md | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/Installation.md b/Installation.md index fbfb8d2..30d377f 100644 --- a/Installation.md +++ b/Installation.md @@ -173,7 +173,7 @@ case "${ARCH}" in armv7* | armv7) XUI_ARCH="armv7" ;; armv6* | armv6) XUI_ARCH="armv6" ;; armv5* | armv5) XUI_ARCH="armv5" ;; - s390x) echo 's390x' ;; + s390x) XUI_ARCH="s390x" ;; *) XUI_ARCH="amd64" ;; esac @@ -191,16 +191,47 @@ case "${ARCH}" in armv7* | armv7) XUI_ARCH="armv7" ;; armv6* | armv6) XUI_ARCH="armv6" ;; armv5* | armv5) XUI_ARCH="armv5" ;; - s390x) echo 's390x' ;; + s390x) XUI_ARCH="s390x" ;; *) XUI_ARCH="amd64" ;; esac +# Detect OS release +if [[ -f /etc/os-release ]]; then + source /etc/os-release + release=$ID +elif [[ -f /usr/lib/os-release ]]; then + source /usr/lib/os-release + release=$ID +else + echo "Failed to detect OS" + exit 1 +fi + cd /root/ rm -rf x-ui/ /usr/local/x-ui/ /usr/bin/x-ui tar zxvf x-ui-linux-${XUI_ARCH}.tar.gz chmod +x x-ui/x-ui x-ui/bin/xray-linux-* x-ui/x-ui.sh cp x-ui/x-ui.sh /usr/bin/x-ui -cp -f x-ui/x-ui.service /etc/systemd/system/ + +# Copy appropriate service file based on OS +if [ -f "x-ui/x-ui.service" ]; then + cp -f x-ui/x-ui.service /etc/systemd/system/ +elif [[ "$release" == "ubuntu" || "$release" == "debian" || "$release" == "armbian" ]]; then + if [ -f "x-ui/x-ui.service.debian" ]; then + cp -f x-ui/x-ui.service.debian /etc/systemd/system/x-ui.service + else + echo "Service file not found in archive, downloading..." + curl -fLo /etc/systemd/system/x-ui.service https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.service.debian + fi +else + if [ -f "x-ui/x-ui.service.rhel" ]; then + cp -f x-ui/x-ui.service.rhel /etc/systemd/system/x-ui.service + else + echo "Service file not found in archive, downloading..." + curl -fLo /etc/systemd/system/x-ui.service https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.service.rhel + fi +fi + mv x-ui/ /usr/local/ systemctl daemon-reload systemctl enable x-ui