Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMHSanaei <ho3ein.sanaei@gmail.com>2026-01-03 09:27:39 +0300
committerMHSanaei <ho3ein.sanaei@gmail.com>2026-01-03 09:27:39 +0300
commit947fd4fae109503fcc00a21991a51de0e7f392db (patch)
treee2ab00cbe76d57760ec4732a331bdd5f737a9714 /update.sh
parente69a31dd5940af51a88d477ffd3dfe14330c7810 (diff)
fix
Diffstat (limited to 'update.sh')
-rwxr-xr-xupdate.sh42
1 files changed, 38 insertions, 4 deletions
diff --git a/update.sh b/update.sh
index f7b499ca..dbbdc05c 100755
--- a/update.sh
+++ b/update.sh
@@ -679,19 +679,53 @@ update_x-ui() {
if [ -f "x-ui.service" ]; then
echo -e "${green}Installing systemd unit...${plain}"
cp -f x-ui.service ${xui_service}/ >/dev/null 2>&1
+ if [[ $? -ne 0 ]]; then
+ echo -e "${red}Failed to copy x-ui.service${plain}"
+ exit 1
+ fi
else
+ service_installed=false
case "${release}" in
ubuntu | debian | armbian)
- echo -e "${green}Installing debian-like systemd unit...${plain}"
- cp -f x-ui.service.debian ${xui_service}/x-ui.service >/dev/null 2>&1
+ if [ -f "x-ui.service.debian" ]; then
+ echo -e "${green}Installing debian-like systemd unit...${plain}"
+ cp -f x-ui.service.debian ${xui_service}/x-ui.service >/dev/null 2>&1
+ if [[ $? -eq 0 ]]; then
+ service_installed=true
+ fi
+ fi
;;
*)
- echo -e "${green}Installing rhel-like systemd unit...${plain}"
- cp -f x-ui.service.rhel ${xui_service}/x-ui.service >/dev/null 2>&1
+ if [ -f "x-ui.service.rhel" ]; then
+ echo -e "${green}Installing rhel-like systemd unit...${plain}"
+ cp -f x-ui.service.rhel ${xui_service}/x-ui.service >/dev/null 2>&1
+ if [[ $? -eq 0 ]]; then
+ service_installed=true
+ fi
+ fi
;;
esac
+
+ # If service file not found in tar.gz, download from GitHub
+ if [ "$service_installed" = false ]; then
+ echo -e "${yellow}Service files not found in tar.gz, downloading from GitHub...${plain}"
+ case "${release}" in
+ ubuntu | debian | armbian)
+ ${curl_bin} -4fLRo ${xui_service}/x-ui.service https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.service.debian >/dev/null 2>&1
+ ;;
+ *)
+ ${curl_bin} -4fLRo ${xui_service}/x-ui.service https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.service.rhel >/dev/null 2>&1
+ ;;
+ esac
+
+ if [[ $? -ne 0 ]]; then
+ echo -e "${red}Failed to install x-ui.service from GitHub${plain}"
+ exit 1
+ fi
+ fi
fi
chown root:root ${xui_service}/x-ui.service >/dev/null 2>&1
+ chmod 644 ${xui_service}/x-ui.service >/dev/null 2>&1
systemctl daemon-reload >/dev/null 2>&1
systemctl enable x-ui >/dev/null 2>&1
systemctl start x-ui >/dev/null 2>&1