mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 01:29:26 +08:00
update
This commit is contained in:
+5
-4
@@ -38,10 +38,11 @@ fi
|
||||
if [ "$LOCAL_ADDR" != "common" ];then
|
||||
declare -A PROXY_URL
|
||||
PROXY_URL["gh_proxy_com"]="https://gh-proxy.com/"
|
||||
PROXY_URL["github_do"]="https://github.do/"
|
||||
PROXY_URL["gitclone_com"]="https://gitclone.com/"
|
||||
PROXY_URL["ghfast_top"]="https://ghfast.top/"
|
||||
PROXY_URL["source"]="https://"
|
||||
PROXY_URL["github_do"]="https://github.do/"
|
||||
PROXY_URL["gh_llkk_cc"]="https://gh.llkk.cc/https://"
|
||||
PROXY_URL["gh_felicity_ac_cn"]="https://gh.felicity.ac.cn/https://"
|
||||
PROXY_URL["ghfast_top"]="https://ghfast.top/"
|
||||
PROXY_URL["source"]="https://"
|
||||
|
||||
|
||||
SOURCE_LIST_KEY_SORT_TMP=$(echo ${!PROXY_URL[@]} | tr ' ' '\n' | sort -n)
|
||||
|
||||
@@ -43,10 +43,11 @@ fi
|
||||
if [ "$LOCAL_ADDR" != "common" ];then
|
||||
declare -A PROXY_URL
|
||||
PROXY_URL["gh_proxy_com"]="https://gh-proxy.com/"
|
||||
PROXY_URL["github_do"]="https://github.do/"
|
||||
PROXY_URL["gitclone_com"]="https://gitclone.com/"
|
||||
PROXY_URL["ghfast_top"]="https://ghfast.top/"
|
||||
PROXY_URL["source"]="https://"
|
||||
PROXY_URL["github_do"]="https://github.do/"
|
||||
PROXY_URL["gh_llkk_cc"]="https://gh.llkk.cc/https://"
|
||||
PROXY_URL["gh_felicity_ac_cn"]="https://gh.felicity.ac.cn/https://"
|
||||
PROXY_URL["ghfast_top"]="https://ghfast.top/"
|
||||
PROXY_URL["source"]="https://"
|
||||
|
||||
|
||||
SOURCE_LIST_KEY_SORT_TMP=$(echo ${!PROXY_URL[@]} | tr ' ' '\n' | sort -n)
|
||||
|
||||
+87
-86
@@ -7,10 +7,10 @@ is64bit=`getconf LONG_BIT`
|
||||
startTime=`date +%s`
|
||||
|
||||
if [ -f /www/server/mdserver-web/tools.py ];then
|
||||
echo -e "存在旧版代码,不能安装!,已知风险的情况下"
|
||||
echo -e "rm -rf /www/server/mdserver-web"
|
||||
echo -e "可安装!"
|
||||
exit 0
|
||||
echo -e "存在旧版代码,不能安装!,已知风险的情况下"
|
||||
echo -e "rm -rf /www/server/mdserver-web"
|
||||
echo -e "可安装!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ if [ "$EUID" -ne 0 ]
|
||||
fi
|
||||
|
||||
if [ ${_os} != "Darwin" ] && [ ! -d /www/server/mdserver-web/logs ]; then
|
||||
mkdir -p /www/server/mdserver-web/logs
|
||||
mkdir -p /www/server/mdserver-web/logs
|
||||
fi
|
||||
|
||||
LOG_FILE=/var/log/mw-update.log
|
||||
@@ -33,43 +33,44 @@ HTTP_PREFIX="https://"
|
||||
LOCAL_ADDR=common
|
||||
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
|
||||
LOCAL_ADDR=cn
|
||||
LOCAL_ADDR=cn
|
||||
fi
|
||||
|
||||
if [ "$LOCAL_ADDR" != "common" ];then
|
||||
declare -A PROXY_URL
|
||||
PROXY_URL["gh_proxy_com"]="https://gh-proxy.com/"
|
||||
PROXY_URL["github_do"]="https://github.do/"
|
||||
PROXY_URL["gitclone_com"]="https://gitclone.com/"
|
||||
PROXY_URL["ghfast_top"]="https://ghfast.top/"
|
||||
PROXY_URL["source"]="https://"
|
||||
declare -A PROXY_URL
|
||||
PROXY_URL["gh_proxy_com"]="https://gh-proxy.com/"
|
||||
PROXY_URL["github_do"]="https://github.do/"
|
||||
PROXY_URL["gh_llkk_cc"]="https://gh.llkk.cc/https://"
|
||||
PROXY_URL["gh_felicity_ac_cn"]="https://gh.felicity.ac.cn/https://"
|
||||
PROXY_URL["ghfast_top"]="https://ghfast.top/"
|
||||
PROXY_URL["source"]="https://"
|
||||
|
||||
|
||||
SOURCE_LIST_KEY_SORT_TMP=$(echo ${!PROXY_URL[@]} | tr ' ' '\n' | sort -n)
|
||||
SOURCE_LIST_KEY=(${SOURCE_LIST_KEY_SORT_TMP//'\n'/})
|
||||
SOURCE_LIST_LEN=${#PROXY_URL[*]}
|
||||
SOURCE_LIST_KEY_SORT_TMP=$(echo ${!PROXY_URL[@]} | tr ' ' '\n' | sort -n)
|
||||
SOURCE_LIST_KEY=(${SOURCE_LIST_KEY_SORT_TMP//'\n'/})
|
||||
SOURCE_LIST_LEN=${#PROXY_URL[*]}
|
||||
fi
|
||||
|
||||
|
||||
function AutoSizeStr(){
|
||||
NAME_STR=$1
|
||||
NAME_NUM=$2
|
||||
NAME_STR=$1
|
||||
NAME_NUM=$2
|
||||
|
||||
NAME_STR_LEN=`echo "$NAME_STR" | wc -L`
|
||||
NAME_NUM_LEN=`echo "$NAME_NUM" | wc -L`
|
||||
NAME_STR_LEN=`echo "$NAME_STR" | wc -L`
|
||||
NAME_NUM_LEN=`echo "$NAME_NUM" | wc -L`
|
||||
|
||||
fix_len=35
|
||||
remaining_len=`expr $fix_len - $NAME_STR_LEN - $NAME_NUM_LEN`
|
||||
FIX_SPACE=' '
|
||||
for ((ass_i=1;ass_i<=$remaining_len;ass_i++))
|
||||
do
|
||||
FIX_SPACE="$FIX_SPACE "
|
||||
done
|
||||
echo -e " ❖ ${1}${FIX_SPACE}${2})"
|
||||
fix_len=35
|
||||
remaining_len=`expr $fix_len - $NAME_STR_LEN - $NAME_NUM_LEN`
|
||||
FIX_SPACE=' '
|
||||
for ((ass_i=1;ass_i<=$remaining_len;ass_i++))
|
||||
do
|
||||
FIX_SPACE="$FIX_SPACE "
|
||||
done
|
||||
echo -e " ❖ ${1}${FIX_SPACE}${2})"
|
||||
}
|
||||
|
||||
function ChooseProxyURL(){
|
||||
clear
|
||||
clear
|
||||
echo -e '+---------------------------------------------------+'
|
||||
echo -e '| |'
|
||||
echo -e '| ============================================= |'
|
||||
@@ -89,9 +90,9 @@ function ChooseProxyURL(){
|
||||
cm_i=0
|
||||
for V in ${SOURCE_LIST_KEY[@]}; do
|
||||
num=`expr $cm_i + 1`
|
||||
AutoSizeStr "${V}" "$num"
|
||||
cm_i=`expr $cm_i + 1`
|
||||
done
|
||||
AutoSizeStr "${V}" "$num"
|
||||
cm_i=`expr $cm_i + 1`
|
||||
done
|
||||
echo -e ''
|
||||
echo -e '#####################################################'
|
||||
echo -e ''
|
||||
@@ -110,20 +111,20 @@ function ChooseProxyURL(){
|
||||
fi
|
||||
|
||||
if [ "$INPUT" -lt "0" ];then
|
||||
INPUT=1
|
||||
TMP_INPUT=`expr $INPUT - 1`
|
||||
INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]}
|
||||
echo -e "\n低于边界错误!选择[${BLUE}${INPUT_KEY}${PLAIN}]安装!"
|
||||
sleep 2s
|
||||
fi
|
||||
INPUT=1
|
||||
TMP_INPUT=`expr $INPUT - 1`
|
||||
INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]}
|
||||
echo -e "\n低于边界错误!选择[${BLUE}${INPUT_KEY}${PLAIN}]安装!"
|
||||
sleep 2s
|
||||
fi
|
||||
|
||||
if [ "$INPUT" -gt "${SOURCE_LIST_LEN}" ];then
|
||||
INPUT=${SOURCE_LIST_LEN}
|
||||
TMP_INPUT=`expr $INPUT - 1`
|
||||
INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]}
|
||||
echo -e "\n超出边界错误!选择[${BLUE}${INPUT_KEY}${PLAIN}]安装!"
|
||||
sleep 2s
|
||||
fi
|
||||
if [ "$INPUT" -gt "${SOURCE_LIST_LEN}" ];then
|
||||
INPUT=${SOURCE_LIST_LEN}
|
||||
TMP_INPUT=`expr $INPUT - 1`
|
||||
INPUT_KEY=${SOURCE_LIST_KEY[$TMP_INPUT]}
|
||||
echo -e "\n超出边界错误!选择[${BLUE}${INPUT_KEY}${PLAIN}]安装!"
|
||||
sleep 2s
|
||||
fi
|
||||
|
||||
INPUT=`expr $INPUT - 1`
|
||||
INPUT_KEY=${SOURCE_LIST_KEY[$INPUT]}
|
||||
@@ -132,68 +133,68 @@ function ChooseProxyURL(){
|
||||
|
||||
|
||||
if [ "$LOCAL_ADDR" != "common" ];then
|
||||
ChooseProxyURL
|
||||
ChooseProxyURL
|
||||
|
||||
if [ "$DOMAIN" != "https://" ];then
|
||||
DOMAIN=`echo $HTTP_PREFIX | sed 's|https://||g'`
|
||||
DOMAIN=`echo $DOMAIN | sed 's|/||g'`
|
||||
ping -c 3 $DOMAIN > /dev/null 2>&1
|
||||
if [ "$?" != "0" ];then
|
||||
echo "无效代理地址:${DOMAIN}"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
if [ "$DOMAIN" != "https://" ];then
|
||||
DOMAIN=`echo $HTTP_PREFIX | sed 's|https://||g'`
|
||||
DOMAIN=`echo $DOMAIN | sed 's|/||g'`
|
||||
ping -c 3 $DOMAIN > /dev/null 2>&1
|
||||
if [ "$?" != "0" ];then
|
||||
echo "无效代理地址:${DOMAIN}"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ${_os} == "Darwin" ]; then
|
||||
OSNAME='macos'
|
||||
OSNAME='macos'
|
||||
elif grep -Eqi "openSUSE" /etc/*-release; then
|
||||
OSNAME='opensuse'
|
||||
zypper refresh
|
||||
OSNAME='opensuse'
|
||||
zypper refresh
|
||||
elif grep -Eqi "EulerOS" /etc/*-release || grep -Eqi "openEuler" /etc/*-release; then
|
||||
OSNAME='euler'
|
||||
OSNAME='euler'
|
||||
elif grep -Eqi "FreeBSD" /etc/*-release; then
|
||||
OSNAME='freebsd'
|
||||
OSNAME='freebsd'
|
||||
elif grep -Eqi "CentOS" /etc/issue || grep -Eqi "CentOS" /etc/*-release; then
|
||||
OSNAME='rhel'
|
||||
yum install -y wget zip unzip
|
||||
OSNAME='rhel'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Fedora" /etc/issue || grep -Eqi "Fedora" /etc/*-release; then
|
||||
OSNAME='rhel'
|
||||
yum install -y wget zip unzip
|
||||
OSNAME='rhel'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Rocky" /etc/issue || grep -Eqi "Rocky" /etc/*-release; then
|
||||
OSNAME='rhel'
|
||||
yum install -y wget zip unzip
|
||||
OSNAME='rhel'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eqi "AlmaLinux" /etc/*-release; then
|
||||
OSNAME='rhel'
|
||||
yum install -y wget zip unzip
|
||||
OSNAME='rhel'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Anolis" /etc/issue || grep -Eqi "Anolis" /etc/*-release; then
|
||||
OSNAME='rhel'
|
||||
yum install -y wget curl zip unzip tar crontabs
|
||||
OSNAME='rhel'
|
||||
yum install -y wget curl zip unzip tar crontabs
|
||||
elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eqi "Amazon Linux" /etc/*-release; then
|
||||
OSNAME='amazon'
|
||||
yum install -y wget zip unzip
|
||||
OSNAME='amazon'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Debian" /etc/issue || grep -Eqi "Debian" /etc/*-release; then
|
||||
OSNAME='debian'
|
||||
apt install -y wget zip unzip
|
||||
OSNAME='debian'
|
||||
apt install -y wget zip unzip
|
||||
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eqi "Ubuntu" /etc/*-release; then
|
||||
OSNAME='ubuntu'
|
||||
apt install -y wget zip unzip
|
||||
OSNAME='ubuntu'
|
||||
apt install -y wget zip unzip
|
||||
elif grep -Eqi "Raspbian" /etc/issue || grep -Eqi "Raspbian" /etc/*-release; then
|
||||
OSNAME='raspbian'
|
||||
OSNAME='raspbian'
|
||||
elif grep -Eqi "Alpine" /etc/issue || grep -Eqi "Alpine" /etc/*-release; then
|
||||
OSNAME='alpine'
|
||||
apk update
|
||||
apk add devscripts -force-broken-world
|
||||
apk add wget zip unzip tar -force-broken-world
|
||||
OSNAME='alpine'
|
||||
apk update
|
||||
apk add devscripts -force-broken-world
|
||||
apk add wget zip unzip tar -force-broken-world
|
||||
else
|
||||
OSNAME='unknow'
|
||||
OSNAME='unknow'
|
||||
fi
|
||||
|
||||
echo "LOCAL:${LOCAL_ADDR}"
|
||||
|
||||
CP_CMD=/usr/bin/cp
|
||||
if [ -f /bin/cp ];then
|
||||
CP_CMD=/bin/cp
|
||||
CP_CMD=/bin/cp
|
||||
fi
|
||||
|
||||
echo "update mdserver-web code start"
|
||||
@@ -215,13 +216,13 @@ bash /etc/rc.d/init.d/mw restart
|
||||
bash /etc/rc.d/init.d/mw default
|
||||
|
||||
if [ -f /usr/bin/mw ];then
|
||||
rm -rf /usr/bin/mw
|
||||
rm -rf /usr/bin/mw
|
||||
fi
|
||||
|
||||
if [ ! -e /usr/bin/mw ]; then
|
||||
if [ ! -f /usr/bin/mw ];then
|
||||
ln -s /etc/rc.d/init.d/mw /usr/bin/mw
|
||||
fi
|
||||
if [ ! -f /usr/bin/mw ];then
|
||||
ln -s /etc/rc.d/init.d/mw /usr/bin/mw
|
||||
fi
|
||||
fi
|
||||
|
||||
endTime=`date +%s`
|
||||
|
||||
Reference in New Issue
Block a user