fix
Some checks are pending
Release 3X-UI / build (386) (push) Waiting to run
Release 3X-UI / build (amd64) (push) Waiting to run
Release 3X-UI / build (arm64) (push) Waiting to run
Release 3X-UI / build (armv5) (push) Waiting to run
Release 3X-UI / build (armv6) (push) Waiting to run
Release 3X-UI / build (armv7) (push) Waiting to run
Release 3X-UI / build (s390x) (push) Waiting to run
Release 3X-UI / Build for Windows (push) Waiting to run

This commit is contained in:
MHSanaei 2026-01-03 07:27:39 +01:00
parent e69a31dd59
commit 947fd4fae1
No known key found for this signature in database
GPG key ID: 7E4060F2FBE5AB7A
2 changed files with 94 additions and 11 deletions

View file

@ -671,21 +671,70 @@ install_x-ui() {
rc-update add x-ui rc-update add x-ui
rc-service x-ui start rc-service x-ui start
else else
# Install systemd service file
service_installed=false
if [ -f "x-ui.service" ]; then if [ -f "x-ui.service" ]; then
cp -f x-ui.service ${xui_service}/ echo -e "${green}Found x-ui.service in extracted files, installing...${plain}"
else cp -f x-ui.service ${xui_service}/ >/dev/null 2>&1
if [[ $? -eq 0 ]]; then
service_installed=true
fi
fi
if [ "$service_installed" = false ]; then
case "${release}" in case "${release}" in
ubuntu | debian | armbian) ubuntu | debian | armbian)
cp -f x-ui.service.debian ${xui_service}/x-ui.service if [ -f "x-ui.service.debian" ]; then
echo -e "${green}Found x-ui.service.debian in extracted files, installing...${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
;; ;;
*) *)
cp -f x-ui.service.rhel ${xui_service}/x-ui.service if [ -f "x-ui.service.rhel" ]; then
echo -e "${green}Found x-ui.service.rhel in extracted files, installing...${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 esac
fi fi
systemctl daemon-reload
systemctl enable x-ui # If service file not found in tar.gz, download from GitHub
systemctl start x-ui 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 -4fLRo ${xui_service}/x-ui.service https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.service.debian >/dev/null 2>&1
;;
*)
curl -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
service_installed=true
fi
if [ "$service_installed" = true ]; then
echo -e "${green}Setting up systemd unit...${plain}"
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
systemctl enable x-ui
systemctl start x-ui
else
echo -e "${red}Failed to install x-ui.service file${plain}"
exit 1
fi
fi fi
echo -e "${green}x-ui ${tag_version}${plain} installation finished, it is running now..." echo -e "${green}x-ui ${tag_version}${plain} installation finished, it is running now..."

View file

@ -679,19 +679,53 @@ update_x-ui() {
if [ -f "x-ui.service" ]; then if [ -f "x-ui.service" ]; then
echo -e "${green}Installing systemd unit...${plain}" echo -e "${green}Installing systemd unit...${plain}"
cp -f x-ui.service ${xui_service}/ >/dev/null 2>&1 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 else
service_installed=false
case "${release}" in case "${release}" in
ubuntu | debian | armbian) ubuntu | debian | armbian)
echo -e "${green}Installing debian-like systemd unit...${plain}" if [ -f "x-ui.service.debian" ]; then
cp -f x-ui.service.debian ${xui_service}/x-ui.service >/dev/null 2>&1 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}" if [ -f "x-ui.service.rhel" ]; then
cp -f x-ui.service.rhel ${xui_service}/x-ui.service >/dev/null 2>&1 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 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 fi
chown root:root ${xui_service}/x-ui.service >/dev/null 2>&1 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 daemon-reload >/dev/null 2>&1
systemctl enable x-ui >/dev/null 2>&1 systemctl enable x-ui >/dev/null 2>&1
systemctl start x-ui >/dev/null 2>&1 systemctl start x-ui >/dev/null 2>&1