From 2f41cdbc16789d25b220bd81592e52d15369296c Mon Sep 17 00:00:00 2001 From: qtwrk Date: Tue, 11 Feb 2020 17:16:51 +0100 Subject: [PATCH 1/4] DB name/user length check --- CPScripts/EasyEngine/EasyEngine-migration.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CPScripts/EasyEngine/EasyEngine-migration.sh b/CPScripts/EasyEngine/EasyEngine-migration.sh index c029e5e8b..d807447ca 100644 --- a/CPScripts/EasyEngine/EasyEngine-migration.sh +++ b/CPScripts/EasyEngine/EasyEngine-migration.sh @@ -397,6 +397,16 @@ echo -e "\nNo file on this server will be touched.\n" read -rsn1 -p "Please press any key to continue..." } +db_length_check() { + ssh_v="ssh -o StrictHostKeyChecking=no root@$server_ip -p$server_port -i /root/.ssh/cyberpanel_migration_key" + output=$($ssh_v "$sudoer cat /usr/local/CyberCP/plogical/mysqlUtilities.py") + if echo $output | grep -q "should be 16 at max" ; then + echo -e "\nPlease upgrade your CyberPanel to latest first..." + clean_up + exit + fi +} + check_dir #check if this is an easyengine server and create a temp dir for storing files during the process. @@ -429,9 +439,10 @@ echo -e "\n\nchecking necessary package..." fi fetch_cyberpanel_key - #function to get cyberpanel server key so future SSH command won't require password input. +db_length_check + tLen=${#domains[@]} #get the domain list and number of domains. From 545041cc4b1f849affbcdc27db8bd033e9880361 Mon Sep 17 00:00:00 2001 From: qtwrk Date: Tue, 11 Feb 2020 17:27:11 +0100 Subject: [PATCH 2/4] add wp cli check/install --- CPScripts/EasyEngine/EasyEngine-migration.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CPScripts/EasyEngine/EasyEngine-migration.sh b/CPScripts/EasyEngine/EasyEngine-migration.sh index d807447ca..81357b083 100644 --- a/CPScripts/EasyEngine/EasyEngine-migration.sh +++ b/CPScripts/EasyEngine/EasyEngine-migration.sh @@ -329,8 +329,16 @@ fi install_lscwp() { ssh_v="ssh -o StrictHostKeyChecking=no root@$server_ip -p$server_port -i /root/.ssh/cyberpanel_migration_key" + +$ssh_v "ls -l /usr/bin/wp" +if [[ $? != "0" ]] ; then + $ssh_v "$sudoer wget -O /usr/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar" + $ssh_v "$sudoer chmod +x /usr/bin/wp" +fi +#install WP CLI if not yet installed. $ssh_v "sudo -u $owner_user -i -- wp --path=/home/${domains[$i]}/public_html plugin install litespeed-cache" echo -e "\nInstalling LiteSpeed Cache for WordPress..." + } export_database() { From 562584a9f2009d8376d828b2e6f0e9ac7bb5be3a Mon Sep 17 00:00:00 2001 From: qtwrk Date: Mon, 17 Feb 2020 13:18:02 +0100 Subject: [PATCH 3/4] openvz pid file --- cyberpanel.sh | 63 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index f34aa98f1..ca9468e34 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -4,15 +4,6 @@ SUDO_TEST=$(set) -export LC_CTYPE=en_US.UTF-8 -export LC_ALL=en_US.UTF-8 -if [[ $? != "0" ]] ; then - apt upgrade - DEBIAN_FRONTEND=noninteractive apt install -y locales - locale-gen "en_US.UTF-8" - update-locale LC_ALL="en_US.UTF-8" -fi - DEV="OFF" BRANCH="stable" POSTFIX_VARIABLE="ON" @@ -35,6 +26,7 @@ TOTAL_RAM=$(free -m | awk '/Mem\:/ { print $2 }') CENTOS_8="False" WATCHDOG="OFF" BRANCH_NAME="v${TEMP:12:3}.${TEMP:25:1}" +VIRT_TYPE="" check_return() { #check previous command result , 0 = ok , non-0 = something wrong. @@ -110,14 +102,46 @@ echo ${WEBADMIN_PASS} > /etc/cyberpanel/webadmin_passwd chmod 600 /etc/cyberpanel/webadmin_passwd } +openvz_change() { +if [[ $VIRT_TYPE == "OpenVZ" ]] ; then + if [[ ! -d /etc/systemd/system/pure-ftpd.service.d ]] ; then + mkdir /etc/systemd/system/pure-ftpd.service.d + echo "[Service] +PIDFile=/run/pure-ftpd.pid" > /etc/systemd/system/pure-ftpd.service.d/override.conf + echo -e "PureFTPd service file modified for OpenVZ..." + fi + + if [[ ! -d /etc/systemd/system/lshttpd.service.d ]] ; then + mkdir /etc/systemd/system/lshttpd.service.d + echo "[Service] +PIDFile=/tmp/lshttpd/lshttpd.pid" > /etc/systemd/system/lshttpd.service.d/override.conf + echo -e "LiteSPeed service file modified for OpenVZ..." + fi + + if [[ ! -d /etc/systemd/system/spamassassin.service.d ]] ; then + mkdir /etc/systemd/system/spamassassin.service.d + echo "[Service] +PIDFile=/run/spamassassin.pid" > /etc/systemd/system/spamassassin.service.d/override.conf + echo -e "SpamAssassin service file modified for OpenVZ..." + fi + +fi +} + check_virtualization() { echo -e "Checking virtualization type..." -if hostnamectl | grep "Virtualization: lxc" ; then +if hostnamectl | grep -q "Virtualization: lxc" ; then echo -e "\nLXC detected..." echo -e "CyberPanel does not support LXC" echo -e "Exiting..." exit fi + +if hostnamectl | grep -q "Virtualization: openvz" ; then + echo -e "\nOpenVZ detected..." + VIRT_TYPE="OpenVZ" + openvz_change +fi } license_validation() { @@ -168,7 +192,7 @@ sed -i 's|cyberpanel.sh|'$DOWNLOAD_SERVER'|g' install.py sed -i 's|mirror.cyberpanel.net|'$DOWNLOAD_SERVER'|g' install.py sed -i 's|git clone https://github.com/usmannasir/cyberpanel|echo downloaded|g' install.py #change to CDN first, regardless country -sed -i 's|http://|https://|g' install.py +#sed -i 's|http://|https://|g' install.py if [[ $PROVIDER == "Alibaba Cloud" ]] ; then if ! grep -q "100.100.2.136" /etc/resolv.conf ; then @@ -1099,6 +1123,9 @@ if [[ $debug == "0" ]] ; then fi if [[ $debug == "1" ]] ; then + wget -O requirements.txt https://raw.githubusercontent.com/usmannasir/cyberpanel/$BRANCH_NAME/requirments.txt + /usr/local/CyberPanel/bin/pip3 install --ignore-installed -r requirements.txt + rm -f requirements.txt /usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --postfix $POSTFIX_VARIABLE --powerdns $POWERDNS_VARIABLE --ftp $PUREFTPD_VARIABLE if grep "CyberPanel installation successfully completed" /var/log/installLogs.txt > /dev/null; then @@ -1119,6 +1146,16 @@ fi } pip_virtualenv() { +if [[ $SERVER_OS == "Ubuntu" ]] ; then +DEBIAN_FRONTEND=noninteractive apt install -y locales +locale-gen "en_US.UTF-8" +update-locale LC_ALL="en_US.UTF-8" +fi + +export LC_CTYPE=en_US.UTF-8 +export LC_ALL=en_US.UTF-8 +#need to set lang to address some pip module installation issue. + if [[ $DEV == "OFF" ]] ; then if [[ $SERVER_COUNTRY == "CN" ]] ; then mkdir /root/.config @@ -1593,8 +1630,10 @@ fi SECONDS=0 install_required +openvz_change + pip_virtualenv system_tweak -main_install \ No newline at end of file +main_install From 175d3efa4f17a21313ddde31921310153a6ad45b Mon Sep 17 00:00:00 2001 From: qtwrk Date: Mon, 17 Feb 2020 16:06:45 +0100 Subject: [PATCH 4/4] mirror libzip --- cyberpanel.sh | 4 ++-- cyberpanel_upgrade.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index ca9468e34..02dbea122 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -1373,8 +1373,8 @@ if [[ ! -f /usr/local/lsws/lsphp74/lib64/php/modules/zip.so ]] && [[ $SERVER_OS if [[ $? == "0" ]] ; then yum remove -y libzip-devel fi - yum install -y http://packages.psychotic.ninja/7/plus/x86_64/RPMS/libzip-0.11.2-6.el7.psychotic.x86_64.rpm - yum install -y http://packages.psychotic.ninja/7/plus/x86_64/RPMS/libzip-devel-0.11.2-6.el7.psychotic.x86_64.rpm + yum install -y https://$DOWNLOAD_SERVER/libzip-0.11.2-6.el7.psychotic.x86_64.rpm + yum install -y https://$DOWNLOAD_SERVER/misc/libzip-devel-0.11.2-6.el7.psychotic.x86_64.rpm /usr/local/lsws/lsphp74/bin/pecl install zip echo "extension=zip.so" > /usr/local/lsws/lsphp74/etc/php.d/20-zip.ini chmod 755 /usr/local/lsws/lsphp74/lib64/php/modules/zip.so diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 311114562..4649929c2 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -227,8 +227,8 @@ if [[ ! -f /usr/local/lsws/lsphp74/lib64/php/modules/zip.so ]] && [[ $SERVER_OS yum remove -y libzip-devel fi - yum install -y http://packages.psychotic.ninja/7/plus/x86_64/RPMS/libzip-0.11.2-6.el7.psychotic.x86_64.rpm - yum install -y http://packages.psychotic.ninja/7/plus/x86_64/RPMS/libzip-devel-0.11.2-6.el7.psychotic.x86_64.rpm + yum install -y https://cdn.cyberpanel.sh/misc/libzip-0.11.2-6.el7.psychotic.x86_64.rpm + yum install -y https://cdn.cyberpanel.sh/misc/libzip-devel-0.11.2-6.el7.psychotic.x86_64.rpm yum install lsphp74-devel if [[ ! -d /usr/local/lsws/lsphp74/tmp ]] ; then