From b5d8183f799dbd1c6592fc91555129cc6495d9c9 Mon Sep 17 00:00:00 2001 From: spiritLHLS <103393591+spiritLHLS@users.noreply.github.com> Date: Sun, 5 Mar 2023 22:08:41 +0800 Subject: [PATCH 1/4] Update install_en.sh --- script/install_en.sh | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/script/install_en.sh b/script/install_en.sh index ea19f28..fdb26e3 100755 --- a/script/install_en.sh +++ b/script/install_en.sh @@ -43,11 +43,41 @@ pre_check() { os_arch="riscv64" fi - GITHUB_RAW_URL="raw.githubusercontent.com/naiba/nezha/master" - GITHUB_URL="github.com" - Get_Docker_URL="get.docker.com" - Get_Docker_Argu=" " - Docker_IMG="ghcr.io\/naiba\/nezha-dashboard" + ## China_IP + if [[ -z "${CN}" ]]; then + if [[ $(curl -m 10 -s https://ipapi.co/json | grep 'China') != "" ]]; then + echo "According to the information provided by ipapi.co, the current IP may be in China" + read -e -r -p "Is the installation done with a Chinese Mirror? [Y/n] " input + case $input in + [yY][eE][sS] | [yY]) + echo "Use China Mirror" + CN=true + ;; + + [nN][oO] | [nN]) + echo "No Use China Mirror" + ;; + *) + echo "Use China Mirror" + CN=true + ;; + esac + fi + fi + + if [[ -z "${CN}" ]]; then + GITHUB_RAW_URL="raw.githubusercontent.com/naiba/nezha/master" + GITHUB_URL="github.com" + Get_Docker_URL="get.docker.com" + Get_Docker_Argu=" " + Docker_IMG="ghcr.io\/naiba\/nezha-dashboard" + else + 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=" -s docker --mirror Aliyun" + Docker_IMG="registry.cn-shanghai.aliyuncs.com\/naibahq\/nezha-dashboard" + fi } confirm() { From 92e533c2a8643c8891603a6d70b1a80a39e637c2 Mon Sep 17 00:00:00 2001 From: spiritLHLS <103393591+spiritLHLS@users.noreply.github.com> Date: Sun, 5 Mar 2023 22:09:24 +0800 Subject: [PATCH 2/4] Update install_en.sh --- script/install_en.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/script/install_en.sh b/script/install_en.sh index fdb26e3..c1321e9 100755 --- a/script/install_en.sh +++ b/script/install_en.sh @@ -58,8 +58,7 @@ pre_check() { echo "No Use China Mirror" ;; *) - echo "Use China Mirror" - CN=true + echo "No Use China Mirror" ;; esac fi From fff662760045956ea2b0995aef7d4f3fde59a70f Mon Sep 17 00:00:00 2001 From: spiritLHLS <103393591+spiritLHLS@users.noreply.github.com> Date: Mon, 6 Mar 2023 10:21:15 +0800 Subject: [PATCH 3/4] Update install_en.sh --- script/install_en.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/script/install_en.sh b/script/install_en.sh index c1321e9..af16854 100755 --- a/script/install_en.sh +++ b/script/install_en.sh @@ -64,19 +64,22 @@ pre_check() { fi fi - if [[ -z "${CN}" ]]; then - GITHUB_RAW_URL="raw.githubusercontent.com/naiba/nezha/master" - GITHUB_URL="github.com" - Get_Docker_URL="get.docker.com" - Get_Docker_Argu=" " - Docker_IMG="ghcr.io\/naiba\/nezha-dashboard" - else + if [[ -n "${CN}" && "${CN}" == true ]]; then + # Use Chinese mirrors 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=" -s docker --mirror Aliyun" Docker_IMG="registry.cn-shanghai.aliyuncs.com\/naibahq\/nezha-dashboard" + else + # Use default + GITHUB_RAW_URL="raw.githubusercontent.com/naiba/nezha/master" + GITHUB_URL="github.com" + Get_Docker_URL="get.docker.com" + Get_Docker_Argu=" " + Docker_IMG="ghcr.io\/naiba\/nezha-dashboard" fi + } confirm() { From 7f7229dd196ad641a6be76d436b638b368947a23 Mon Sep 17 00:00:00 2001 From: spiritLHLS <103393591+spiritLHLS@users.noreply.github.com> Date: Mon, 6 Mar 2023 15:49:18 +0800 Subject: [PATCH 4/4] Update install_en.sh --- script/install_en.sh | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/script/install_en.sh b/script/install_en.sh index af16854..2bd6089 100755 --- a/script/install_en.sh +++ b/script/install_en.sh @@ -50,36 +50,33 @@ pre_check() { read -e -r -p "Is the installation done with a Chinese Mirror? [Y/n] " input case $input in [yY][eE][sS] | [yY]) - echo "Use China Mirror" + echo "Use Chinese Mirror" CN=true ;; [nN][oO] | [nN]) - echo "No Use China Mirror" + echo "No Use Chinese Mirror" ;; *) - echo "No Use China Mirror" + echo "No Use Chinese Mirror" ;; esac fi fi - if [[ -n "${CN}" && "${CN}" == true ]]; then - # Use Chinese mirrors - 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=" -s docker --mirror Aliyun" - Docker_IMG="registry.cn-shanghai.aliyuncs.com\/naibahq\/nezha-dashboard" - else - # Use default + if [[ -z "${CN}" ]]; then GITHUB_RAW_URL="raw.githubusercontent.com/naiba/nezha/master" GITHUB_URL="github.com" Get_Docker_URL="get.docker.com" Get_Docker_Argu=" " Docker_IMG="ghcr.io\/naiba\/nezha-dashboard" + else + 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=" -s docker --mirror Aliyun" + Docker_IMG="registry.cn-shanghai.aliyuncs.com\/naibahq\/nezha-dashboard" fi - } confirm() {