Update xray.sh

This commit is contained in:
windyday 2025-06-22 02:43:58 +08:00 committed by GitHub
parent c91aa95fc6
commit b47041da3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -267,9 +267,9 @@ InstallFile() {
mkdir -p "${xray_install_directory:=/usr/local/xray}" || Error "Create xray install directory failed." mkdir -p "${xray_install_directory:=/usr/local/xray}" || Error "Create xray install directory failed."
cd "$xray_install_directory" || Error "Create cns install directory failed." cd "$xray_install_directory" || Error "Create cns install directory failed."
#install xray #install xray
github_repo="https://github.010507.xyz/https://github.com/CoverUp137/cns/releases/download/xray" github_repo="https://gh.0507.dpdns.org/https://github.com/CoverUp137/cns/releases/download/xray"
$download_tool_cmd xray "$github_repo/xray-linux-${machine}" || Error "xray download failed." $download_tool_cmd xray "$github_repo/xray-linux-${machine}" || Error "xray download failed."
$download_tool_cmd xray.init https://github.010507.xyz/https://raw.githubusercontent.com/CoverUp137/cns/refs/heads/main/xray/xray.init || Error "xray.init download failed." $download_tool_cmd xray.init https://gh.0507.dpdns.org/https://raw.githubusercontent.com/CoverUp137/cns/refs/heads/main/xray/xray.init || Error "xray.init download failed."
[ -f '/etc/rc.common' ] && rcCommon='/etc/rc.common' [ -f '/etc/rc.common' ] && rcCommon='/etc/rc.common'
sed -i "s~#!/bin/sh~#!$SHELL $rcCommon~" xray.init sed -i "s~#!/bin/sh~#!$SHELL $rcCommon~" xray.init
sed -i "s~\[xray_install_directory\]~$xray_install_directory~g" xray.init sed -i "s~\[xray_install_directory\]~$xray_install_directory~g" xray.init
@ -278,7 +278,7 @@ InstallFile() {
ln -s "$xray_install_directory/xray.init" /etc/init.d/xray ln -s "$xray_install_directory/xray.init" /etc/init.d/xray
chmod -R +rwx "$xray_install_directory" /etc/init.d/xray chmod -R +rwx "$xray_install_directory" /etc/init.d/xray
if which systemctl &>/dev/null && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then if which systemctl &>/dev/null && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
$download_tool_cmd /lib/systemd/system/xray.service https://github.010507.xyz/https://raw.githubusercontent.com/CoverUp137/cns/refs/heads/main/xray/xray.service || Error "xray.service download failed." $download_tool_cmd /lib/systemd/system/xray.service https://gh.0507.dpdns.org/https://raw.githubusercontent.com/CoverUp137/cns/refs/heads/main/xray/xray.service || Error "xray.service download failed."
chmod +rwx /lib/systemd/system/xray.service chmod +rwx /lib/systemd/system/xray.service
sed -i "s~\[xray_install_directory\]~$xray_install_directory~g" /lib/systemd/system/xray.service sed -i "s~\[xray_install_directory\]~$xray_install_directory~g" /lib/systemd/system/xray.service
systemctl daemon-reload systemctl daemon-reload