mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-10-14 12:09:12 +00:00
Add IPv4 for wget in install
This commit is contained in:
parent
89def9aee6
commit
ffd4c068fa
1 changed files with 34 additions and 6 deletions
40
install.sh
40
install.sh
|
@ -149,14 +149,22 @@ install_x-ui() {
|
||||||
if [ $# == 0 ]; then
|
if [ $# == 0 ]; then
|
||||||
tag_version=$(curl -Ls "https://api.github.com/repos/MHSanaei/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
tag_version=$(curl -Ls "https://api.github.com/repos/MHSanaei/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||||
if [[ ! -n "$tag_version" ]]; then
|
if [[ ! -n "$tag_version" ]]; then
|
||||||
echo -e "${red}Failed to fetch x-ui version, it may be due to GitHub API restrictions, please try it later${plain}"
|
echo -e "${yellow}Trying to fetch version with IPv4...${plain}"
|
||||||
exit 1
|
tag_version=$(curl -4 -Ls "https://api.github.com/repos/MHSanaei/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||||
|
if [[ ! -n "$tag_version" ]]; then
|
||||||
|
echo -e "${red}Failed to fetch x-ui version, it may be due to GitHub API restrictions, please try it later${plain}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
echo -e "Got x-ui latest version: ${tag_version}, beginning the installation..."
|
echo -e "Got x-ui latest version: ${tag_version}, beginning the installation..."
|
||||||
wget -N -O /usr/local/x-ui-linux-$(arch).tar.gz https://github.com/MHSanaei/3x-ui/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz
|
wget --inet4-only -N -O /usr/local/x-ui-linux-$(arch).tar.gz https://github.com/MHSanaei/3x-ui/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo -e "${red}Downloading x-ui failed, please be sure that your server can access GitHub ${plain}"
|
echo -e "${red}Downloading x-ui failed, please be sure that your server can access GitHub ${plain}"
|
||||||
exit 1
|
exit 1
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo -e "${red}Downloading x-ui failed, please be sure that your server can access GitHub ${plain}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
tag_version=$1
|
tag_version=$1
|
||||||
|
@ -170,13 +178,25 @@ install_x-ui() {
|
||||||
|
|
||||||
url="https://github.com/MHSanaei/3x-ui/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz"
|
url="https://github.com/MHSanaei/3x-ui/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz"
|
||||||
echo -e "Beginning to install x-ui $1"
|
echo -e "Beginning to install x-ui $1"
|
||||||
wget -N -O /usr/local/x-ui-linux-$(arch).tar.gz ${url}
|
wget --inet4-only -N -O /usr/local/x-ui-linux-$(arch).tar.gz ${url}
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo -e "${red}Download x-ui $1 failed, please check if the version exists ${plain}"
|
echo -e "${red}Download x-ui $1 failed, please check if the version exists ${plain}"
|
||||||
exit 1
|
exit 1
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo -e "${red}Download x-ui $1 failed, please check if the version exists ${plain}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
wget --inet4-only -O /usr/bin/x-ui-temp https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.sh
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo -e "${red}Failed to download x-ui.sh${plain}"
|
||||||
|
exit 1
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo -e "${red}Failed to download x-ui.sh${plain}"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
wget -O /usr/bin/x-ui-temp https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.sh
|
|
||||||
|
|
||||||
# Stop x-ui service and remove old resources
|
# Stop x-ui service and remove old resources
|
||||||
if [[ -e /usr/local/x-ui/ ]]; then
|
if [[ -e /usr/local/x-ui/ ]]; then
|
||||||
|
@ -209,7 +229,15 @@ install_x-ui() {
|
||||||
config_after_install
|
config_after_install
|
||||||
|
|
||||||
if [[ $release == "alpine" ]]; then
|
if [[ $release == "alpine" ]]; then
|
||||||
wget -O /etc/init.d/x-ui https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.rc
|
wget --inet4-only -O /etc/init.d/x-ui https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.rc
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo -e "${red}Failed to download x-ui.rc${plain}"
|
||||||
|
exit 1
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo -e "${red}Failed to download x-ui.rc${plain}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
chmod +x /etc/init.d/x-ui
|
chmod +x /etc/init.d/x-ui
|
||||||
rc-update add x-ui
|
rc-update add x-ui
|
||||||
rc-service x-ui start
|
rc-service x-ui start
|
||||||
|
|
Loading…
Reference in a new issue