diff --git a/app/script/convert.sh b/app/script/convert.sh index 6573993..a05dffc 100644 --- a/app/script/convert.sh +++ b/app/script/convert.sh @@ -1,8 +1,8 @@ #!/bin/bash -Linux_Version="7.9.8" +Linux_Version="7.9.9" Windows_Version="7.8.0" -Btm_Version="2.0.8" +Btm_Version="2.0.9" FILES=( public/install/src/panel6.zip diff --git a/install.sql b/install.sql index 7f005f2..5d53c84 100644 --- a/install.sql +++ b/install.sql @@ -12,9 +12,9 @@ INSERT INTO `cloud_config` (`key`, `value`) VALUES ('bt_key', ''), ('whitelist', '0'), ('download_page', '1'), -('new_version', '7.9.8'), +('new_version', '7.9.9'), ('update_msg', '暂无更新日志'), -('update_date', '2023-01-29'), +('update_date', '2023-04-07'), ('new_version_win', '7.8.0'), ('update_msg_win', '暂无更新日志'), ('update_date_win', '2022-12-08'), diff --git a/public/install/install_6.0.sh b/public/install/install_6.0.sh index c37bff7..e164923 100644 --- a/public/install/install_6.0.sh +++ b/public/install/install_6.0.sh @@ -36,9 +36,9 @@ setup_path="/www" python_bin=$setup_path/server/panel/pyenv/bin/python cpu_cpunt=$(cat /proc/cpuinfo|grep processor|wc -l) -if [ "$1" ];then - IDC_CODE=$1 -fi +# if [ "$1" ];then +# IDC_CODE=$1 +# fi GetSysInfo(){ if [ -s "/etc/redhat-release" ];then @@ -231,7 +231,7 @@ get_node_url(){ echo '---------------------------------------------'; echo "Selected download node..."; - nodes=(https://dg2.bt.cn https://dg1.bt.cn https://download.bt.cn); + nodes=(https://dg2.bt.cn https://download.bt.cn https://ctcc1-node.bt.cn https://cmcc1-node.bt.cn https://ctcc2-node.bt.cn https://hk1-node.bt.cn https://na1-node.bt.cn https://jp1-node.bt.cn); if [ "$1" ];then nodes=($(echo ${nodes[*]}|sed "s#${1}##")) @@ -626,6 +626,9 @@ Install_Bt(){ else panelPort=$(expr $RANDOM % 55535 + 10000) fi + if [ "${PANEL_PORT}" ];then + panelPort=$PANEL_PORT + fi mkdir -p ${setup_path}/server/panel/logs mkdir -p ${setup_path}/server/panel/vhost/apache mkdir -p ${setup_path}/server/panel/vhost/nginx @@ -719,8 +722,15 @@ Set_Bt_Panel(){ fi password=$(cat /dev/urandom | head -n 16 | md5sum | head -c 8) + if [ "$PANEL_PASSWORD" ];then + password=$PANEL_PASSWORD + fi sleep 1 admin_auth="/www/server/panel/data/admin_path.pl" + if [ "${SAFE_PATH}" ];then + auth_path=$SAFE_PATH + echo "/${auth_path}" > ${admin_auth} + fi if [ ! -f ${admin_auth} ];then auth_path=$(cat /dev/urandom | head -n 16 | md5sum | head -c 8) echo "/${auth_path}" > ${admin_auth} @@ -742,6 +752,9 @@ Set_Bt_Panel(){ $python_bin -m py_compile tools.py $python_bin tools.py username username=$($python_bin tools.py panel ${password}) + if [ "$PANEL_USER" ];then + username=$PANEL_USER + fi cd ~ echo "${password}" > ${setup_path}/server/panel/default.pl chmod 600 ${setup_path}/server/panel/default.pl @@ -758,6 +771,12 @@ Set_Bt_Panel(){ lsattr python3.7 python Red_Error "ERROR: The BT-Panel service startup failed." "ERROR: 宝塔启动失败" fi + + if [ "$PANEL_USER" ];then + cd ${setup_path}/server/panel/ + btpython -c 'import tools;tools.set_panel_username("'$PANEL_USER'")' + cd ~ + fi } Set_Firewall(){ sshPort=$(cat /etc/ssh/sshd_config | grep 'Port '|awk '{print $2}') @@ -903,6 +922,35 @@ echo " | 为了您的正常使用,请确保使用全新或纯净的系统安装宝塔面板,不支持已部署项目/环境的系统安装 +---------------------------------------------------------------------- " + +while [ ${#} -gt 0 ]; do + case $1 in + -u|--user) + PANEL_USER=$2 + shift 1 + ;; + -p|--password) + PANEL_PASSWORD=$2 + shift 1 + ;; + -P|--port) + PANEL_PORT=$2 + shift 1 + ;; + --safe-path) + SAFE_PATH=$2 + shift 1 + ;; + -y) + go="y" + ;; + *) + IDC_CODE=$1 + ;; + esac + shift 1 +done + while [ "$go" != 'y' ] && [ "$go" != 'n' ] do read -p "Do you want to install Bt-Panel to the $setup_path directory now?(y/n): " go; @@ -915,7 +963,7 @@ fi ARCH_LINUX=$(cat /etc/os-release |grep "Arch Linux") if [ "${ARCH_LINUX}" ] && [ -f "/usr/bin/pacman" ];then pacman -Sy - pacman -S curl wget unzip firewalld openssl pkg-config make gcc cmake libxml2 libxslt libvpx gd libsodium oniguruma sqlite libzip autoconf inetutils sudo --noconfirm + pacman -S curl wget unzip firewalld openssl pkg-config make gcc cmake libxml2 libxslt libvpx gd libsodium oniguruma sqlite libzip autoconf inetutils sudo --noconfirm fi Install_Main @@ -948,3 +996,4 @@ endTime=`date +%s` ((outTime=($endTime-$startTime)/60)) echo -e "Time consumed:\033[32m $outTime \033[0mMinute!" + diff --git a/public/install/src/bt-monitor-2.0.8.zip b/public/install/src/bt-monitor-2.0.9.zip similarity index 85% rename from public/install/src/bt-monitor-2.0.8.zip rename to public/install/src/bt-monitor-2.0.9.zip index 2460275..a86f372 100644 Binary files a/public/install/src/bt-monitor-2.0.8.zip and b/public/install/src/bt-monitor-2.0.9.zip differ diff --git a/public/install/src/panel6.zip b/public/install/src/panel6.zip index af647db..0cf3b62 100644 Binary files a/public/install/src/panel6.zip and b/public/install/src/panel6.zip differ diff --git a/public/install/update/LinuxPanel-7.9.8.zip b/public/install/update/LinuxPanel-7.9.9.zip similarity index 82% rename from public/install/update/LinuxPanel-7.9.8.zip rename to public/install/update/LinuxPanel-7.9.9.zip index b16921c..5e88a2a 100644 Binary files a/public/install/update/LinuxPanel-7.9.8.zip and b/public/install/update/LinuxPanel-7.9.9.zip differ diff --git a/public/install/update6.sh b/public/install/update6.sh index 5a591be..3c01428 100644 --- a/public/install/update6.sh +++ b/public/install/update6.sh @@ -12,16 +12,16 @@ if [ ! -d /www/server/panel/BTPanel ];then exit 0; fi +if [ ! -f "/www/server/panel/pyenv/bin/python3" ];then + echo "=============================================" + echo "错误, 当前面板过旧/py-2.7/无pyenv环境,无法升级至最新版面板" + echo "请截图发帖至论坛www.bt.cn/bbs求助" + exit 0; +fi + public_file=/www/server/panel/install/public.sh -publicFileMd5=$(md5sum ${public_file} 2>/dev/null|awk '{print $1}') -md5check="f6ccaaec227577b87a22bf162004667b" -if [ "${publicFileMd5}" != "${md5check}" ]; then +if [ ! -f $public_file ];then wget -O Tpublic.sh $Btapi_Url/install/public.sh -T 20; - publicFileMd5=$(md5sum Tpublic.sh 2>/dev/null|awk '{print $1}') - if [ "${publicFileMd5}" == "${md5check}" ]; then - \cp -rpa Tpublic.sh $public_file - fi - rm -f Tpublic.sh fi . $public_file @@ -42,7 +42,7 @@ download_Url=$NODE_URL setup_path=/www version=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/panel/get_version) if [ "$version" = '' ];then - version='7.9.8' + version='7.9.9' fi armCheck=$(uname -m|grep arm) if [ "${armCheck}" ];then diff --git a/public/install/update_panel.sh b/public/install/update_panel.sh index c5943b8..8bc494b 100644 --- a/public/install/update_panel.sh +++ b/public/install/update_panel.sh @@ -70,7 +70,7 @@ select_node(){ get_version(){ version=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/panel/get_version) if [ "$version" = '' ];then - version='7.9.8' + version='7.9.9' fi } @@ -333,9 +333,9 @@ update_panel(){ chattr -i /etc/init.d/bt chmod +x /etc/init.d/bt - if [ $up_plugin = 1 ];then - $pyenv_bin/python /www/server/panel/tools.py update_to6 - fi + # if [ $up_plugin = 1 ];then + # $pyenv_bin/python /www/server/panel/tools.py update_to6 + # fi } update_start(){ diff --git a/public/win/install/panel_update.py b/public/win/install/panel_update.py index 03c476f..242e4ec 100644 --- a/public/win/install/panel_update.py +++ b/public/win/install/panel_update.py @@ -105,5 +105,8 @@ class panel_update: os.system("echo f|xcopy /s /c /e /y /r {} {}".format(public.to_path(tmpPath),public.to_path(panelPath))) - return public.returnMsg(True,"升级面板成功,重启面板后生效."); + if os.path.exists('C:/update.py'): os.remove('C:/update.py') + os.system('bt restart') + + return public.returnMsg(True,"升级面板成功.");