diff --git a/scripts/update_dev.sh b/scripts/update_dev.sh index 024b9ecc2..7598d9c26 100755 --- a/scripts/update_dev.sh +++ b/scripts/update_dev.sh @@ -54,15 +54,23 @@ else OSNAME='unknow' fi -# 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 + +cn=$(curl -fsSL -m 10 -s 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 +if [ ! -z "$cn" ];then LOCAL_ADDR=cn - HTTP_PREFIX="https://ghproxy.com/" + HTTP_PREFIX="https://ghproxy.com/" fi + CP_CMD=/usr/bin/cp if [ -f /bin/cp ];then CP_CMD=/bin/cp @@ -78,7 +86,7 @@ if [ "$LOCAL_ADDR" != "common" ];then rm -rf /tmp/master.zip rm -rf /tmp/mdserver-web else - curl --insecure -sSLo /tmp/dev.zip https://github.com/midoks/mdserver-web/archive/refs/heads/dev.zip + curl --insecure -sSLo /tmp/dev.zip ${HTTP_PREFIX}github.com/midoks/mdserver-web/archive/refs/heads/dev.zip cd /tmp && unzip /tmp/dev.zip $CP_CMD -rf /tmp/mdserver-web-dev/* /www/server/mdserver-web rm -rf /tmp/dev.zip