From ed6f98f3f260de05d5af661e70c59e3398f1d96d Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Tue, 19 Jan 2021 15:24:51 +0500 Subject: [PATCH] add progress to install --- cyberpanel.sh | 11 ++++++++++- install/install.py | 4 ++-- install/installCyberPanel.py | 3 +++ install/installLog.py | 12 +++++++++++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index a8bbe272c..1c22dbcf8 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -40,6 +40,7 @@ VIRT_TYPE="" MASTER_GIT_URL="github.com/usmannasir/cyberpanel" set_git_repos_and_branch() { + echo 'Setting up Branches,1' >/var/log/installLogs.txt local GIT_DIR local GIT_USER local GIT_REPO @@ -66,6 +67,7 @@ set_git_repos_and_branch() { printf "Github Content URL: %s\n" "$GIT_CONTENT_URL" printf "Github Branch: %s\n" "$BRANCH_NAME" printf "~~~~~~~~~~\n" + echo 'Setting up Branches,1' >/var/log/installLogs.txt } disable_repos() { @@ -404,7 +406,7 @@ root hard nproc 65535" >>/etc/security/limits.conf } install_required() { - + echo 'Installing necessary components..,3' >/var/log/installLogs.txt if [[ -d /etc/yum.repos.d ]]; then yum clean all @@ -504,6 +506,7 @@ EOF check_return fi + echo 'Necessary components installed,5' >/var/log/installLogs.txt } memcached_installation() { @@ -1250,6 +1253,7 @@ EOF } after_install() { + echo 'Finalization..,80' >>/var/log/installLogs.txt if [ ! -d "/var/lib/php" ]; then mkdir /var/lib/php fi @@ -1524,6 +1528,7 @@ options edns0" /etc/resolv.conf echo "something went wrong..." exit fi + } argument_mode() { @@ -1669,6 +1674,8 @@ initialize() { else DOWNLOAD_SERVER="cdn.cyberpanel.sh" fi + + echo 'Initialization completed..,2' >/var/log/installLogs.txt } begin_install() { @@ -1695,3 +1702,5 @@ begin_install() { } begin_install "$@" + +echo 'Completed [200]' >>/var/log/installLogs.txt \ No newline at end of file diff --git a/install/install.py b/install/install.py index fe9c43845..f973a5dd8 100755 --- a/install/install.py +++ b/install/install.py @@ -2157,7 +2157,7 @@ def main(): parser.add_argument('--mysqlport', help='MySQL port if remote is chosen.') args = parser.parse_args() - logging.InstallLog.writeToFile("Starting CyberPanel installation..") + logging.InstallLog.writeToFile("Starting CyberPanel installation..,10") preFlightsChecks.stdOut("Starting CyberPanel installation..") if args.ent == None: @@ -2348,7 +2348,7 @@ echo $oConfig->Save() ? 'Done' : 'Error'; except: pass - logging.InstallLog.writeToFile("CyberPanel installation successfully completed!") + logging.InstallLog.writeToFile("CyberPanel installation successfully completed!,80") if __name__ == "__main__": diff --git a/install/installCyberPanel.py b/install/installCyberPanel.py index d526db048..baeed20d7 100755 --- a/install/installCyberPanel.py +++ b/install/installCyberPanel.py @@ -656,13 +656,16 @@ def Main(cwd, mysql, distro, ent, serial = None, port = "8090", ftp = None, dns installer = InstallCyberPanel("/usr/local/lsws/",cwd, distro, ent, serial, port, ftp, dns, publicip, remotemysql, mysqlhost, mysqldb, mysqluser, mysqlpassword, mysqlport) + logging.InstallLog.writeToFile('Installing LiteSpeed Web server,40') installer.installLiteSpeed() if ent == 0: installer.changePortTo80() + logging.InstallLog.writeToFile('Installing Optimized PHPs..,50') installer.installAllPHPVersions() if ent == 0: installer.fix_ols_configs() + logging.InstallLog.writeToFile('Installing MySQL,60') installer.installMySQL(mysql) installer.changeMYSQLRootPassword() diff --git a/install/installLog.py b/install/installLog.py index 6aa1b7254..eef104cbf 100755 --- a/install/installLog.py +++ b/install/installLog.py @@ -3,9 +3,19 @@ import time class InstallLog: fileName = "/var/log/installLogs.txt" + currentPercent = '10' + @staticmethod def writeToFile(message): + + if message.find(',') == -1: + message = '%s,%s' % (message, InstallLog.currentPercent) + elif message.find('mount -o') > -1 or message.find('usermod -G lscpd,') > -1: + message = '%s,%s' % (message.replace(',', '-'), InstallLog.currentPercent) + else: + InstallLog.currentPercent = message.split(',')[1] + file = open(InstallLog.fileName,'a') file.writelines("[" + time.strftime( - "%m.%d.%Y_%H-%M-%S") + "] "+message + "\n") + "%m.%d.%Y_%H-%M-%S") + "] " + message + "\n") file.close()