forked from wangzhe12588/bt59happy
-
Notifications
You must be signed in to change notification settings - Fork 4
/
update_pro.sh
88 lines (74 loc) · 2.27 KB
/
update_pro.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
LANG=en_US.UTF-8
vp=$1
m=`cat /www/server/panel/class/common.py|grep checkSafe`
if [ "${vp}" == "free" ]; then
vp=""
Ver="免费版"
elif [ "${vp}" == "pro" ] || [ "${m}" != "" ] ;then
vp="_pro"
Ver="专业版"
elif [ -f /www/server/panel/plugin/beta/config.conf ]; then
updateApi=https://www.bt.cn/Api/updateLinuxBeta
vp=""
Ver="内测版"
fi
public_file=/www/server/panel/install/public.sh
if [ ! -f $public_file ];then
wget -O $public_file http://download.bt.cn/install/public.sh -T 5;
fi
. $public_file
download_Url=$NODE_URL
btpanel_Url=
setup_path=/www
version=''
pcreRpm=`rpm -qa |grep bt-pcre`
if [ "${pcreRpm}" != "" ];then
rpm -e bt-pcre
yum reinstall pcre pcre-devel -y
fi
if [ "$version" = '' ];then
if [ "${updateApi}" == "" ];then
updateApi=https://www.bt.cn/Api/updateLinux
fi
if [ -f /usr/local/curl/bin/curl ]; then
version=`/usr/local/curl/bin/curl $updateApi 2>/dev/null|grep -Po '"version":".*?"'|grep -Po '[0-9\.]+'`
else
version=`curl $updateApi 2>/dev/null|grep -Po '"version":".*?"'|grep -Po '[0-9\.]+'`
fi
fi
if [ "$version" = '' ];then
version=`cat /www/server/panel/class/common.py|grep "\.version"|awk '{print $3}'|sed 's/"//g'|sed 's/;//g'`
version=${version:0:-1}
fi
if [ "$version" = '' ];then
echo '版本号获取失败,请手动在第一个参数传入!';
exit;
fi
wget --no-check-certificate -T 5 -O panel.zip https://raw.githubusercontent.com/a8866051/bt59happy/master/LinuxPanel-5.9.1_pro.zip
if [ ! -f "panel.zip" ];then
echo "获取更新包失败,请稍后更新或联系宝塔运维"
exit;
fi
unzip -o panel.zip -d $setup_path/server/ > /dev/null
rm -f panel.zip
cd $setup_path/server/panel/
rm -f $setup_path/server/panel/data/templates.pl
check_bt=`cat /etc/init.d/bt`
if [ "${check_bt}" = "" ];then
rm -f /etc/init.d/bt
wget -O /etc/init.d/bt $download_Url/install/src/bt.init -T 10
chmod +x /etc/init.d/bt
fi
if [ ! -f "/etc/init.d/bt" ]; then
wget -O /etc/init.d/bt $download_Url/install/src/bt.init -T 10
chmod +x /etc/init.d/bt
fi
cd /www/server/panel
python tools.py o
/etc/init.d/bt restart
sleep 1 && service bt restart > /dev/null 2>&1 &
echo "====================================="
echo "已成功升级到[$version]${Ver}";