Skip to content

Commit

Permalink
测试
Browse files Browse the repository at this point in the history
  • Loading branch information
qist committed Jun 24, 2024
1 parent dac49c2 commit 4b3d77f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 23 deletions.
30 changes: 19 additions & 11 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,21 @@ else
echo -e "${red}未检测到系统版本,请联系脚本作者!${plain}\n" && exit 1
fi

arch=$(arch)
arch() {
case "$(uname -m)" in
x86_64 | x64 | amd64) echo 'amd64' ;;
i*86 | x86) echo '386' ;;
armv8* | armv8 | arm64 | aarch64) echo 'arm64' ;;
armv7* | armv7 | arm) echo 'armv7' ;;
armv6* | armv6) echo 'armv6' ;;
armv5* | armv5) echo 'armv5' ;;
s390x) echo 's390x' ;;
*) echo -e "${green}Unsupported CPU architecture! ${plain}" && rm -f install.sh && exit 1 ;;
esac
}

echo "arch: $(arch)"

if [[ $arch == "x86_64" || $arch == "x64" || $arch == "amd64" ]]; then
arch="amd64"
elif [[ $arch == "aarch64" || $arch == "arm64" ]]; then
arch="arm64"
elif [[ $arch == "s390x" ]]; then
arch="s390x"
else
arch="amd64"
echo -e "${red}检测架构失败,使用默认架构: ${arch}${plain}"
fi
sys() {
[ -f /etc/os-release ] && grep -i pretty_name /etc/os-release | cut -d \" -f2 && return
[ -f /etc/lsb-release ] && grep -i description /etc/lsb-release | cut -d \" -f2 && return
Expand Down Expand Up @@ -167,6 +170,11 @@ install_xray-ui() {
tar -zxvf xray-ui-linux-${arch}.tar.gz
rm xray-ui-linux-${arch}.tar.gz -f
cd xray-ui
# Check the system's architecture and rename the file accordingly
if [[ $(arch) == "armv5" || $(arch) == "armv6" || $(arch) == "armv7" ]]; then
mv bin/xray-linux-$(arch) bin/xray-linux-arm
chmod +x bin/xray-linux-arm
fi
chmod +x xray-ui bin/xray-linux-${arch}
cp -f xray-ui.service /etc/systemd/system/
wget --no-check-certificate -O /usr/bin/xray-ui https://raw.githubusercontent.com/qist/xray-ui/main/xray-ui.sh
Expand Down
31 changes: 19 additions & 12 deletions xray-ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ else
echo -e "${red}未检测到系统版本,请联系脚本作者!${plain}\n" && exit 1
fi

arch() {
case "$(uname -m)" in
x86_64 | x64 | amd64) echo 'amd64' ;;
i*86 | x86) echo '386' ;;
armv8* | armv8 | arm64 | aarch64) echo 'arm64' ;;
armv7* | armv7 | arm) echo 'armv7' ;;
armv6* | armv6) echo 'armv6' ;;
armv5* | armv5) echo 'armv5' ;;
s390x) echo 's390x' ;;
*) echo -e "${green}Unsupported CPU architecture! ${plain}" && rm -f install.sh && exit 1 ;;
esac
}

echo "arch: $(arch)"

os_version=""

# os version
Expand Down Expand Up @@ -127,18 +142,6 @@ update() {
fi
return 0
fi
arch=$(arch)
if [[ $arch == "x86_64" || $arch == "x64" || $arch == "amd64" ]]; then
arch="amd64"
elif [[ $arch == "aarch64" || $arch == "arm64" ]]; then
arch="arm64"
elif [[ $arch == "s390x" ]]; then
arch="s390x"
else
arch="amd64"
echo -e "${red}检测架构失败,使用默认架构: ${arch}${plain}"
fi

if [[ x"${release}" == x"centos" ]]; then
setenforce 0 >/dev/null 2>&1
fi
Expand Down Expand Up @@ -174,6 +177,10 @@ update() {
mv /tmp/xray/xray-ui/{xray-ui,xray-ui.service} /usr/local/xray-ui/
rm /tmp/xray -rf
cd /usr/local/xray-ui
if [[ $(arch) == "armv5" || $(arch) == "armv6" || $(arch) == "armv7" ]]; then
mv bin/xray-linux-$(arch) bin/xray-linux-arm
chmod +x bin/xray-linux-arm
fi
chmod +x xray-ui bin/xray-linux-${arch}
\cp -f xray-ui.service /etc/systemd/system/
wget --no-check-certificate -O /usr/bin/xray-ui https://raw.githubusercontent.com/qist/xray-ui/main/xray-ui.sh
Expand Down

0 comments on commit 4b3d77f

Please sign in to comment.