Skip to content

Commit 11c45c4

Browse files
committed
bash-ize the upgrade script
1 parent 139f4ef commit 11c45c4

1 file changed

Lines changed: 133 additions & 0 deletions

File tree

cyberpanel_upgrade.sh

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
#!/bin/bash
2+
3+
SERVER_OS='Undefined'
4+
OUTPUT=$(cat /etc/*release)
5+
6+
check_return() {
7+
#check previous command result , 0 = ok , non-0 = something wrong.
8+
if [[ $? -eq "0" ]] ; then
9+
:
10+
else
11+
echo -e "\ncommand failed, exiting..."
12+
exit
13+
fi
14+
}
15+
16+
echo -e "\nChecking OS..."
17+
OUTPUT=$(cat /etc/*release)
18+
if echo $OUTPUT | grep -q "CentOS Linux 7" ; then
19+
echo -e "\nDetecting CentOS 7.X...\n"
20+
SERVER_OS="CentOS7"
21+
yum clean all
22+
yum update -y
23+
elif echo $OUTPUT | grep -q "CloudLinux 7" ; then
24+
echo -e "\nDetecting CloudLinux 7.X...\n"
25+
SERVER_OS="CentOS7"
26+
yum clean all
27+
yum update -y
28+
elif echo $OUTPUT | grep -q "CentOS Linux 8" ; then
29+
echo -e "\nDetecting CentOS 8.X...\n"
30+
SERVER_OS="CentOS8"
31+
yum clean all
32+
yum update -y
33+
elif echo $OUTPUT | grep -q "Ubuntu 18.04" ; then
34+
echo -e "\nDetecting Ubuntu 18.04...\n"
35+
SERVER_OS="Ubuntu"
36+
else
37+
cat /etc/*release
38+
echo -e "\nUnable to detect your OS...\n"
39+
echo -e "\nCyberPanel is supported on Ubuntu 18.04, CentOS 7.x, CentOS 8.x and CloudLinux 7.x...\n"
40+
exit 1
41+
fi
42+
43+
if [ $SERVER_OS = "CentOS7" ] ; then
44+
yum -y install yum-utils
45+
yum -y groupinstall development
46+
yum -y install https://centos7.iuscommunity.org/ius-release.rpm
47+
yum -y install python36u python36u-pip python36u-devel
48+
elif [ $SERVER_OS = "CentOS8" ] ; then
49+
yum install -y wget strace htop net-tools telnet curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel mariadb-devel curl-devel git platform-python-devel tar
50+
dnf --enablerepo=PowerTools install gpgme-devel -y
51+
dnf install python3 -y
52+
else
53+
apt update -y
54+
DEBIAN_FRONTEND=noninteractive apt upgrade -y
55+
DEBIAN_FRONTEND=noninteracitve apt install -y htop telnet python-mysqldb python-dev libcurl4-gnutls-dev libgnutls28-dev libgcrypt20-dev libattr1 libattr1-dev liblzma-dev libgpgme-dev libmariadbclient-dev libcurl4-gnutls-dev libssl-dev nghttp2 libnghttp2-dev idn2 libidn2-dev libidn2-0-dev librtmp-dev libpsl-dev nettle-dev libgnutls28-dev libldap2-dev libgssapi-krb5-2 libk5crypto3 libkrb5-dev libcomerr2 libldap2-dev python-gpg python python-minimal python-setuptools virtualenv python-dev python-pip git
56+
DEBIAN_FRONTEND=noninteractive apt install -y python3-pip
57+
DEBIAN_FRONTEND=noninteractive apt install -y build-essential libssl-dev libffi-dev python3-dev
58+
DEBIAN_FRONTEND=noninteractive apt install -y python3-venv
59+
fi
60+
61+
if [ $SERVER_OS = "Ubuntu" ] ; then
62+
pip3 install virtualenv
63+
check_return
64+
else
65+
pip3.6 install virtualenv
66+
check_return
67+
fi
68+
69+
rm -rf /usr/local/CyberPanel
70+
virtualenv -p /usr/bin/python3 --system-site-packages /usr/local/CyberPanel
71+
check_return
72+
rm -rf requirments.txt
73+
wget https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/requirments.txt
74+
. /usr/local/CyberPanel/bin/activate
75+
check_return
76+
77+
if [ $SERVER_OS = "Ubuntu" ] ; then
78+
. /usr/local/CyberPanel/bin/activate
79+
check_return
80+
pip3 install --ignore-installed -r requirments.txt
81+
check_return
82+
else
83+
source /usr/local/CyberPanel/bin/activate
84+
check_return
85+
pip3.6 install --ignore-installed -r requirments.txt
86+
check_return
87+
fi
88+
89+
virtualenv -p /usr/bin/python3 --system-site-packages /usr/local/CyberPanel
90+
check_return
91+
rm -rf upgrade.py
92+
wget https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/plogical/upgrade.py
93+
/usr/local/CyberPanel/bin/python upgrade.py stable
94+
check_return
95+
##
96+
97+
virtualenv -p /usr/bin/python3 /usr/local/CyberCP
98+
check_return
99+
wget -O requirements.txt https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/requirments.txt
100+
101+
if [ $SERVER_OS = "Ubuntu" ] ; then
102+
. /usr/local/CyberCP/bin/activate
103+
check_return
104+
pip3 install --ignore-installed -r requirments.txt
105+
check_return
106+
else
107+
source /usr/local/CyberCP/bin/activate
108+
check_return
109+
pip3.6 install --ignore-installed -r requirments.txt
110+
check_return
111+
fi
112+
113+
114+
##
115+
116+
rm -f wsgi-lsapi-1.4.tgz
117+
rm -rf wsgi-lsapi-1.4
118+
wget http://www.litespeedtech.com/packages/lsapi/wsgi-lsapi-1.4.tgz
119+
tar xf wsgi-lsapi-1.4.tgz
120+
cd wsgi-lsapi-1.4
121+
/usr/local/CyberPanel/bin/python ./configure.py
122+
make
123+
124+
cp lswsgi /usr/local/CyberCP/bin/
125+
126+
chmod 700 /usr/bin/adminPass
127+
128+
##
129+
systemctl restart lscpd
130+
131+
echo "###################################################################"
132+
echo " CyberPanel Upgraded "
133+
echo "###################################################################"

0 commit comments

Comments
 (0)