mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 12:40:07 +00:00
installer: restore the China mirror of agent (#389)
This commit is contained in:
@@ -12,7 +12,7 @@ NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
|
||||
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
|
||||
NZ_DASHBOARD_SERVICE="/etc/systemd/system/nezha-dashboard.service"
|
||||
NZ_DASHBOARD_SERVICERC="/etc/init.d/nezha-dashboard"
|
||||
NZ_VERSION="v0.17.0"
|
||||
NZ_VERSION="v0.17.1"
|
||||
|
||||
red='\033[0;31m'
|
||||
green='\033[0;32m'
|
||||
@@ -114,7 +114,7 @@ pre_check() {
|
||||
Docker_IMG="ghcr.io\/naiba\/nezha-dashboard"
|
||||
else
|
||||
GITHUB_RAW_URL="gitee.com/naibahq/nezha/raw/master"
|
||||
GITHUB_URL="github.com"
|
||||
GITHUB_URL="gitee.com"
|
||||
Get_Docker_URL="get.docker.com"
|
||||
Get_Docker_Argu=" -s docker --mirror Aliyun"
|
||||
Docker_IMG="registry.cn-shanghai.aliyuncs.com\/naibahq\/nezha-dashboard"
|
||||
@@ -339,6 +339,9 @@ install_agent() {
|
||||
echo "正在获取监控Agent版本号"
|
||||
|
||||
local version=$(curl -m 10 -sL "https://api.github.com/repos/nezhahq/agent/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
|
||||
if [ ! -n "$version" ]; then
|
||||
version=$(curl -m 10 -sL "https://gitee.com/api/v5/repos/naibahq/agent/releases/latest" | awk -F '"' '{for(i=1;i<=NF;i++){if($i=="tag_name"){print $(i+2)}}}')
|
||||
fi
|
||||
if [ ! -n "$version" ]; then
|
||||
version=$(curl -m 10 -sL "https://fastly.jsdelivr.net/gh/nezhahq/agent/" | grep "option\.value" | awk -F "'" '{print $2}' | sed 's/nezhahq\/agent@/v/g')
|
||||
fi
|
||||
@@ -358,7 +361,12 @@ install_agent() {
|
||||
sudo chmod -R 700 $NZ_AGENT_PATH
|
||||
|
||||
echo "正在下载监控端"
|
||||
wget -t 2 -T 60 -O nezha-agent_linux_${os_arch}.zip https://${GITHUB_URL}/nezhahq/agent/releases/download/${version}/nezha-agent_linux_${os_arch}.zip >/dev/null 2>&1
|
||||
if [ -z "$CN" ]; then
|
||||
NZ_AGENT_URL="https://${GITHUB_URL}/nezhahq/agent/releases/download/${version}/nezha-agent_linux_${os_arch}.zip"
|
||||
else
|
||||
NZ_AGENT_URL="https://${GITHUB_URL}/naibahq/agent/releases/download/${version}/nezha-agent_linux_${os_arch}.zip"
|
||||
fi
|
||||
wget -t 2 -T 60 -O nezha-agent_linux_${os_arch}.zip $NZ_AGENT_URL >/dev/null 2>&1
|
||||
if [ $? != 0 ]; then
|
||||
err "Release 下载失败,请检查本机能否连接 ${GITHUB_URL}"
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user