update to 6.8.27

This commit is contained in:
aaPanel
2022-12-16 10:40:55 +08:00
parent d2a66661db
commit 7dcaa2b5ce
148 changed files with 22281 additions and 13876 deletions
+25 -12
View File
@@ -1,24 +1,37 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#CN='125.88.182.172'
#HK='download.bt.cn'
#HK2='103.224.251.67'
#US='128.1.164.196'
#sleep 0.5;
#CN_PING=`ping -c 1 -w 1 $CN|grep time=|awk '{print $7}'|sed "s/time=//"`
#HK_PING=`ping -c 1 -w 1 $HK|grep time=|awk '{print $7}'|sed "s/time=//"`
#HK2_PING=`ping -c 1 -w 1 $HK2|grep time=|awk '{print $7}'|sed "s/time=//"`
#US_PING=`ping -c 1 -w 1 $US|grep time=|awk '{print $7}'|sed "s/time=//"`
#echo "$HK_PING $HK" > ping.pl
#echo "$HK2_PING $HK2" >> ping.pl
#echo "$US_PING $US" >> ping.pl
#echo "$CN_PING $CN" >> ping.pl
nodeAddr=`sort -V ping.pl|sed -n '1p'|awk '{print $2}'`
#if [ "$nodeAddr" == "" ];then
# nodeAddr=$HK2
#fi
#serverUrl=http://$nodeAddr:5880/install
serverUrl=https://node.aapanel.com/install
mtype=$1
actionType=$2
name=$3
version=$4
. /www/server/panel/install/public.sh
serverUrl=$NODE_URL/install
if [ ! -f 'lib.sh' ];then
wget -O lib.sh $serverUrl/$mtype/lib.sh
wget -O lib.sh $serverUrl/$mtype/lib.sh --no-check-certificate
fi
libNull=`cat lib.sh`
if [ "$libNull" == '' ];then
wget -O lib.sh $serverUrl/$mtype/lib.sh
fi
wget -O $name.sh $serverUrl/$mtype/$name.sh
wget -O $name.sh $serverUrl/$mtype/$name.sh --no-check-certificate
if [ "$actionType" == 'install' ];then
bash lib.sh
sh lib.sh
fi
bash $name.sh $actionType $version
sh $name.sh $actionType $version
+115 -41
View File
@@ -1,48 +1,58 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
pyenv_bin=/www/server/panel/pyenv/bin
rep_path=${pyenv_bin}:$PATH
if [ -d "$pyenv_bin" ];then
PATH=$rep_path
fi
export PATH
export LANG=en_US.UTF-8
export LANGUAGE=en_US:en
get_node_url(){
nodes=(http://183.235.223.101:3389 http://125.88.182.172:5880 http://128.1.164.196 http://103.224.251.67:5880 http://download.bt.cn);
i=1;
for node in ${nodes[@]};
do
start=`date +%s.%N`
result=`curl -sS --connect-timeout 3 -m 60 $node/check.txt`
if [ "$result" = 'True' ];then
end=`date +%s.%N`
start_s=`echo $start | cut -d '.' -f 1`
start_ns=`echo $start | cut -d '.' -f 2`
end_s=`echo $end | cut -d '.' -f 1`
end_ns=`echo $end | cut -d '.' -f 2`
time_micro=$(( (10#$end_s-10#$start_s)*1000000 + (10#$end_ns/1000 - 10#$start_ns/1000) ))
time_ms=$(($time_micro/1000))
values[$i]=$time_ms;
urls[$time_ms]=$node
i=$(($i+1))
if [ $time_ms -lt 50 ];then
break;
fi
fi
done
j=5000
for n in ${values[@]};
do
if [ $j -gt $n ];then
j=$n
fi
if [ $j -lt 50 ];then
break;
fi
done
if [ $j = 5000 ];then
NODE_URL='http://download.bt.cn';
else
NODE_URL=${urls[$j]}
fi
NODE_URL='https://node.aapanel.com';
#nodes=(http://dg2.bt.cn http://dg1.bt.cn http://36.133.1.8:5880 http://123.129.198.197 http://38.34.185.130 http://116.213.43.206:5880 http://128.1.164.196);
#tmp_file1=/dev/shm/net_test1.pl
#tmp_file2=/dev/shm/net_test2.pl
#[ -f "${tmp_file1}" ] && rm -f ${tmp_file1}
#[ -f "${tmp_file2}" ] && rm -f ${tmp_file2}
#touch $tmp_file1
#touch $tmp_file2
#for node in ${nodes[@]};
#do
# NODE_CHECK=$(curl --connect-timeout 3 -m 3 2>/dev/null -w "%{http_code} %{time_total}" ${node}/net_test|xargs)
# RES=$(echo ${NODE_CHECK}|awk '{print $1}')
# NODE_STATUS=$(echo ${NODE_CHECK}|awk '{print $2}')
# TIME_TOTAL=$(echo ${NODE_CHECK}|awk '{print $3 * 1000 - 500 }'|cut -d '.' -f 1)
# if [ "${NODE_STATUS}" == "200" ];then
# if [ $TIME_TOTAL -lt 100 ];then
# if [ $RES -ge 1500 ];then
# echo "$RES $node" >> $tmp_file1
# fi
# else
# if [ $RES -ge 1500 ];then
# echo "$TIME_TOTAL $node" >> $tmp_file2
# fi
# fi
#
# i=$(($i+1))
# if [ $TIME_TOTAL -lt 100 ];then
# if [ $RES -ge 3000 ];then
# break;
# fi
# fi
# fi
# done
# NODE_URL=$(cat $tmp_file1|sort -r -g -t " " -k 1|head -n 1|awk '{print $2}')
# if [ -z "$NODE_URL" ];then
# NODE_URL=$(cat $tmp_file2|sort -g -t " " -k 1|head -n 1|awk '{print $2}')
# if [ -z "$NODE_URL" ];then
# NODE_URL='http://download.bt.cn';
# fi
# fi
# rm -f $tmp_file1
# rm -f $tmp_file2
}
GetCpuStat(){
@@ -70,6 +80,51 @@ GetPackManager(){
PM="apt-get"
fi
}
bt_check(){
p_path=/www/server/panel/class/panelPlugin.py
if [ -f $p_path ];then
is_ext=$(cat $p_path|grep btwaf)
if [ "$is_ext" != "" ];then
send_check
fi
fi
p_path=/www/server/panel/BTPanel/templates/default/index.html
if [ -f $p_path ];then
is_ext=$(cat $p_path|grep fbi)
if [ "$is_ext" != "" ];then
send_check
fi
fi
}
send_check(){
chattr -i /etc/init.d/bt
chmod +x /etc/init.d/bt
p_path2=/www/server/panel/class/common.py
p_version=$(cat $p_path2|grep "version = "|awk '{print $3}'|tr -cd [0-9.])
curl -sS --connect-timeout 3 -m 60 http://www.bt.cn/api/panel/notpro?version=$p_version
NODE_URL=""
exit 0;
}
GetSysInfo(){
if [ "${PM}" = "yum" ]; then
SYS_VERSION=$(cat /etc/redhat-release)
elif [ "${PM}" = "apt-get" ]; then
SYS_VERSION=$(cat /etc/issue)
fi
SYS_INFO=$(uname -msr)
SYS_BIT=$(getconf LONG_BIT)
MEM_TOTAL=$(free -m|grep Mem|awk '{print $2}')
CPU_INFO=$(getconf _NPROCESSORS_ONLN)
GCC_VER=$(gcc -v 2>&1|grep "gcc version"|awk '{print $3}')
CMAKE_VER=$(cmake --version|grep version|awk '{print $3}')
echo -e ${SYS_VERSION}
echo -e Bit:${SYS_BIT} Mem:${MEM_TOTAL}M Core:${CPU_INFO} gcc:${GCC_VER} cmake:${CMAKE_VER}
echo -e ${SYS_INFO}
}
cpuInfo=$(getconf _NPROCESSORS_ONLN)
if [ "${cpuInfo}" -ge "4" ];then
GetCpuStat
@@ -77,7 +132,26 @@ else
cpuCore="1"
fi
GetPackManager
if [ ! $NODE_URL ];then
echo 'Selecting download node...';
get_node_url
if [ -d "/www/server/phpmyadmin/pma" ];then
rm -rf /www/server/phpmyadmin/pma
EN_CHECK=$(cat /www/server/panel/config/config.json |grep English)
if [ "${EN_CHECK}" ];then
curl http://download.bt.cn/install/update6_en.sh|bash
else
curl http://download.bt.cn/install/update6.sh|bash
fi
echo > /www/server/panel/data/restart.pl
fi
if [ ! $NODE_URL ];then
EN_CHECK=$(cat /www/server/panel/config/config.json |grep English)
if [ -z "${EN_CHECK}" ];then
echo '正在选择下载节点...';
else
echo "selecting download node...";
fi
get_node_url
bt_check
fi