From 9e93da5839d44bedb6de3f61b6a8cc6db2273fdf Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Sat, 11 Apr 2020 15:31:01 +0500 Subject: [PATCH] skip clone --- cyberpanel_upgrade.sh | 2 +- plogical/upgrade.py | 51 +++++++++++++++++-------------------------- 2 files changed, 21 insertions(+), 32 deletions(-) diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 611bbdc56..e83db1620 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -191,7 +191,7 @@ fi if [ $SERVER_OS = "CentOS7" ] ; then yum -y install yum-utils yum -y groupinstall development - yum -y install python36u python36u-pip python36u-devel + yum -y install python36u python36u-pip python36u-devel openssl-devel MariaDB-shared mariadb-devel elif [ $SERVER_OS = "CentOS8" ] ; then 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 dnf --enablerepo=PowerTools install gpgme-devel -y diff --git a/plogical/upgrade.py b/plogical/upgrade.py index aee05c030..e668d8b27 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -1272,37 +1272,35 @@ class Upgrade: ## Extract Latest files - os.chdir('/usr/local') + os.chdir('/usr/local/CyberCP') - if os.path.exists('cyberpanel'): - shutil.rmtree('cyberpanel') + command = 'git config --global user.email "support@cyberpanel.met"' + Upgrade.executioner(command, command, 1) - ### check if imunify exists + command = 'git config --global user.name "CyberPanel"' + Upgrade.executioner(command, command, 1) - imunifyPublic = '/usr/local/CyberCP/public/imunify' - imunifyPublicBackup = '/usr/local' + command = 'git status' + currentBranch = subprocess.check_output(shlex.split(command)).decode() - try: + if currentBranch.find('On branch %s' % (branch)) > -1: - if os.path.exists(imunifyPublic): - shutil.move(imunifyPublic, imunifyPublicBackup) + command = 'git stash' + Upgrade.executioner(command, command, 1) - except: - pass + command = 'git pull' + Upgrade.executioner(command, command, 1) - if os.path.exists('CyberCP'): - shutil.rmtree('CyberCP') + else: + command = 'git stash' + Upgrade.executioner(command, command, 1) - command = 'git clone https://github.com/usmannasir/cyberpanel' - Upgrade.executioner(command, 'Download CyberPanel', 1) - - shutil.move('cyberpanel', 'CyberCP') - - if branch != 'stable': - os.chdir('CyberCP') command = 'git checkout %s' % (branch) Upgrade.executioner(command, command, 1) - os.chdir('/usr/local') + + command = 'git pull' + Upgrade.executioner(command, command, 1) + ## Copy settings file @@ -2148,18 +2146,9 @@ vmail time.sleep(3) ## Upgrade version + Upgrade.fixPermissions() - ### get back imunify - - imunifyPublicBackup = '/usr/local' - imunifyPublicBackup = '%s/imunify' % (imunifyPublicBackup) - - try: - shutil.move(imunifyPublicBackup, '/usr/local/CyberCP/public') - except: - pass - ## Upgrade.upgradeVersion()