diff --git a/scripts/update.sh b/scripts/update.sh index 50d255d10..623c1f03d 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -55,8 +55,17 @@ else fi -cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"") -if [ ! -z "$cn" ];then +# cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"") +HTTP_PREFIX="https://" +LOCAL_ADDR=common +ping -c 1 github.com > /dev/null 2>&1 +if [ "$?" != "0" ];then + LOCAL_ADDR=cn + HTTP_PREFIX="https://ghproxy.com/" +fi + + +if [ "$LOCAL_ADDR" != "common" ];then curl -sSLo /tmp/master.zip https://gitee.com/midoks/mdserver-web/repository/archive/master.zip else curl -sSLo /tmp/master.zip https://codeload.github.com/midoks/mdserver-web/zip/master diff --git a/scripts/update_dev.sh b/scripts/update_dev.sh index fa49022af..07e40dfe5 100755 --- a/scripts/update_dev.sh +++ b/scripts/update_dev.sh @@ -54,8 +54,16 @@ else OSNAME='unknow' fi -cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"") -if [ ! -z "$cn" ];then +# cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"") +HTTP_PREFIX="https://" +LOCAL_ADDR=common +ping -c 1 github.com > /dev/null 2>&1 +if [ "$?" != "0" ];then + LOCAL_ADDR=cn + HTTP_PREFIX="https://ghproxy.com/" +fi + +if [ "$LOCAL_ADDR" != "common" ];then curl -sSLo /tmp/dev.zip https://gitee.com/midoks/mdserver-web/repository/archive/dev.zip else curl -sSLo /tmp/dev.zip https://github.com/midoks/mdserver-web/archive/refs/heads/dev.zip