From ddf93bb80b97e0ca7f413603a367f1b565212948 Mon Sep 17 00:00:00 2001 From: Erope Date: Tue, 6 Apr 2021 17:04:56 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=8A=A0=E5=BC=BA=E4=BA=86=E4=B8=AD?= =?UTF-8?q?=E5=9B=BD=E5=A4=A7=E9=99=86=E5=AE=89=E8=A3=85=E6=97=B6=E5=80=99?= =?UTF-8?q?=E7=9A=84=E7=A8=B3=E5=AE=9A=E6=80=A7=E5=92=8C=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/install.sh | 47 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/script/install.sh b/script/install.sh index ec2d117..fb5c519 100755 --- a/script/install.sh +++ b/script/install.sh @@ -42,12 +42,43 @@ pre_check() { os_arch="arm" fi + ## China_IP + + IP_JSON= + if [[ $(curl -m 10 -s https://api.ip.sb/geoip | grep 'China') != "" ]]; then + echo "根据ip.sb提供的信息,当前IP可能在中国" + while true + do + read -r -p "是否选用中国镜像完成安装? [Y/n] " input + case $input in + [yY][eE][sS]|[yY]) + echo "使用中国镜像" + CN=true + ;; + + [nN][oO]|[nN]) + echo "不使用中国镜像" + ;; + + *) + echo "错误输入..." + ;; + esac + done + + if [[ -z "${CN}" ]]; then - GITHUB_RAW_URL="raw.githubusercontent.com" + GITHUB_RAW_URL="raw.githubusercontent.com/naiba/nezha/master" GITHUB_URL="github.com" + Get_Docker_URL="get.docker.com" + Get_Docker_Argu ="" else - GITHUB_RAW_URL="raw.sevencdn.com" - GITHUB_URL="hub.fastgit.org" + GITHUB_RAW_URL="cdn.jsdelivr.net/gh/naiba/nezha@master" + GITHUB_URL="dn-dao-github-mirror.daocloud.io" + Get_Docker_URL="get.daocloud.io/docker" + Get_Docker_Argu=" --mirror Aliyun" + echo "写入/etc/hosts 52.68.132.128 ghcr.io" + echo "52.68.132.128 ghcr.io" >> /etc/hosts fi } @@ -96,9 +127,9 @@ install_dashboard() { command -v docker >/dev/null 2>&1 if [[ $? != 0 ]]; then echo -e "正在安装 Docker" - bash <(curl -sL https://get.docker.com) >/dev/null 2>&1 + bash <(curl -sL https://${Get_Docker_URL}) ${Get_Docker_Argu} >/dev/null 2>&1 if [[ $? != 0 ]]; then - echo -e "${red}下载脚本失败,请检查本机能否连接 get.docker.com${plain}" + echo -e "${red}下载脚本失败,请检查本机能否连接 ${Get_Docker_URL}${plain}" return 0 fi systemctl enable docker.service @@ -154,7 +185,7 @@ install_agent() { modify_agent_config() { echo -e "> 修改Agent配置" - wget -O $NZ_AGENT_SERVICE https://${GITHUB_RAW_URL}/naiba/nezha/master/script/nezha-agent.service >/dev/null 2>&1 + wget -O $NZ_AGENT_SERVICE https://${GITHUB_RAW_URL}/script/nezha-agent.service >/dev/null 2>&1 if [[ $? != 0 ]]; then echo -e "${red}文件下载失败,请检查本机能否连接 ${GITHUB_RAW_URL}${plain}" return 0 @@ -193,7 +224,7 @@ modify_dashboard_config() { echo -e "> 修改面板配置" echo -e "正在下载 Docker 脚本" - wget -O ${NZ_DASHBOARD_PATH}/docker-compose.yaml https://${GITHUB_RAW_URL}/naiba/nezha/master/script/docker-compose.yaml >/dev/null 2>&1 + wget -O ${NZ_DASHBOARD_PATH}/docker-compose.yaml https://${GITHUB_RAW_URL}/script/docker-compose.yaml >/dev/null 2>&1 if [[ $? != 0 ]]; then echo -e "${red}下载脚本失败,请检查本机能否连接 ${GITHUB_RAW_URL}${plain}" return 0 @@ -201,7 +232,7 @@ modify_dashboard_config() { mkdir -p $NZ_DASHBOARD_PATH/data - wget -O ${NZ_DASHBOARD_PATH}/data/config.yaml https://${GITHUB_RAW_URL}/naiba/nezha/master/script/config.yaml >/dev/null 2>&1 + wget -O ${NZ_DASHBOARD_PATH}/data/config.yaml https://${GITHUB_RAW_URL}/script/config.yaml >/dev/null 2>&1 if [[ $? != 0 ]]; then echo -e "${red}下载脚本失败,请检查本机能否连接 ${GITHUB_RAW_URL}${plain}" return 0 From 0e85821be0b4ac34ff5f43da2a4cf414cddadd2e Mon Sep 17 00:00:00 2001 From: Erope Date: Tue, 6 Apr 2021 17:06:25 +0800 Subject: [PATCH 2/5] =?UTF-8?q?install.sh=E4=BF=AE=E8=A1=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/install.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/script/install.sh b/script/install.sh index fb5c519..11fb985 100755 --- a/script/install.sh +++ b/script/install.sh @@ -43,8 +43,6 @@ pre_check() { fi ## China_IP - - IP_JSON= if [[ $(curl -m 10 -s https://api.ip.sb/geoip | grep 'China') != "" ]]; then echo "根据ip.sb提供的信息,当前IP可能在中国" while true From 08235da644bc4bcccf0412c73eeb0ec122f649f4 Mon Sep 17 00:00:00 2001 From: Erope Date: Tue, 6 Apr 2021 18:02:55 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9install.sh=E4=B8=AD?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/install.sh | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/script/install.sh b/script/install.sh index 11fb985..2371bf9 100755 --- a/script/install.sh +++ b/script/install.sh @@ -45,25 +45,22 @@ pre_check() { ## China_IP if [[ $(curl -m 10 -s https://api.ip.sb/geoip | grep 'China') != "" ]]; then echo "根据ip.sb提供的信息,当前IP可能在中国" - while true - do - read -r -p "是否选用中国镜像完成安装? [Y/n] " input - case $input in - [yY][eE][sS]|[yY]) - echo "使用中国镜像" - CN=true - ;; - - [nN][oO]|[nN]) - echo "不使用中国镜像" - ;; - - *) - echo "错误输入..." - ;; - esac - done + read -r -p "是否选用中国镜像完成安装? [Y/n] " input + case $input in + [yY][eE][sS]|[yY]) + echo "使用中国镜像" + CN=true + ;; + [nN][oO]|[nN]) + echo "不使用中国镜像" + ;; + *) + echo "使用中国镜像" + CN=true + ;; + esac + fi if [[ -z "${CN}" ]]; then GITHUB_RAW_URL="raw.githubusercontent.com/naiba/nezha/master" @@ -74,7 +71,7 @@ pre_check() { GITHUB_RAW_URL="cdn.jsdelivr.net/gh/naiba/nezha@master" GITHUB_URL="dn-dao-github-mirror.daocloud.io" Get_Docker_URL="get.daocloud.io/docker" - Get_Docker_Argu=" --mirror Aliyun" + Get_Docker_Argu=" -s docker --mirror Aliyun" echo "写入/etc/hosts 52.68.132.128 ghcr.io" echo "52.68.132.128 ghcr.io" >> /etc/hosts fi From 2a6a81b0dc39fba4f6b926c7b63cc11a92037a52 Mon Sep 17 00:00:00 2001 From: Erope Date: Tue, 6 Apr 2021 18:06:46 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9README=E5=AF=B9=E5=9B=BD?= =?UTF-8?q?=E5=86=85=E9=95=9C=E5=83=8F=E7=9A=84=E4=BB=8B=E7=BB=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5f5353a..221cd15 100644 --- a/README.md +++ b/README.md @@ -23,16 +23,13 @@ curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh - ./nezha.sh ``` -
- 国内镜像加速:(有缓存,版本更新不及时,能不用尽量不用,非作者维护) +国内镜像加速: ```shell -curl -L https://raw.sevencdn.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh +curl -L https://cdn.jsdelivr.net/gh/naiba/nezha@master/script/install.sh -o nezha.sh && chmod +x nezha.sh CN=true ./nezha.sh ``` -
- _\* 使用 WatchTower 可以自动更新面板,Windows 终端可以使用 nssm 配置自启动(见尾部教程)_ ## 功能说明 From 1d598c0d2b17da190890a821ed2c8c9fc1f2e606 Mon Sep 17 00:00:00 2001 From: Erope Date: Tue, 6 Apr 2021 18:11:19 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=B8=80=E4=B8=AA=E5=B0=8F=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/install.sh b/script/install.sh index 2371bf9..0175309 100755 --- a/script/install.sh +++ b/script/install.sh @@ -66,7 +66,7 @@ pre_check() { GITHUB_RAW_URL="raw.githubusercontent.com/naiba/nezha/master" GITHUB_URL="github.com" Get_Docker_URL="get.docker.com" - Get_Docker_Argu ="" + Get_Docker_Argu=" " else GITHUB_RAW_URL="cdn.jsdelivr.net/gh/naiba/nezha@master" GITHUB_URL="dn-dao-github-mirror.daocloud.io"