From 6f1e11e474b0fef064a210dfc22e035fdc47a83c Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 23 Mar 2023 15:21:22 +0800 Subject: [PATCH] Update lib.sh --- scripts/lib.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/lib.sh b/scripts/lib.sh index 573e51a6e..f243f99c7 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -47,13 +47,16 @@ else echo "OK" fi -# cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"") + HTTP_PREFIX="https://" LOCAL_ADDR=common -ping -c 1 pypi.python.org > /dev/null 2>&1 -if [ "$?" != "0" ];then - LOCAL_ADDR=cn - HTTP_PREFIX="https://ghproxy.com/" +ping -c 1 ipinfo.io > /dev/null 2>&1 +if [ "$?" == "0" ];then + CN=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"") + if [ -z $CN ];then + LOCAL_ADDR=cn + HTTP_PREFIX="https://ghproxy.com/" + fi fi PIPSRC="https://pypi.python.org/simple" @@ -69,6 +72,7 @@ fi which pip && pip install --upgrade pip -i $PIPSRC pip3 install --upgrade pip setuptools wheel -i $PIPSRC + cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt -i $PIPSRC # pip3 install flask-caching==1.10.1