add progress to install

This commit is contained in:
Usman Nasir
2021-01-19 15:24:51 +05:00
parent ca6d619a52
commit 931ab00809
4 changed files with 26 additions and 4 deletions

View File

@@ -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

View File

@@ -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__":

View File

@@ -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()

View File

@@ -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()