mirror of
				https://github.com/usmannasir/cyberpanel.git
				synced 2025-11-03 20:05:58 +01:00 
			
		
		
		
	Finally found the inspect code button for syntax errors.
This commit is contained in:
		@@ -9,8 +9,8 @@ from firewallUtilities import FirewallUtilities
 | 
				
			|||||||
import time
 | 
					import time
 | 
				
			||||||
import string
 | 
					import string
 | 
				
			||||||
import random
 | 
					import random
 | 
				
			||||||
import os.path
 | 
					from os.path import *
 | 
				
			||||||
import re
 | 
					from stat import *
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# There can not be peace without first a great suffering.
 | 
					# There can not be peace without first a great suffering.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -18,6 +18,9 @@ import re
 | 
				
			|||||||
centos=0
 | 
					centos=0
 | 
				
			||||||
ubuntu=1
 | 
					ubuntu=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					distro = centos
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class preFlightsChecks:
 | 
					class preFlightsChecks:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cyberPanelMirror = "mirror.cyberpanel.net/pip"
 | 
					    cyberPanelMirror = "mirror.cyberpanel.net/pip"
 | 
				
			||||||
@@ -204,7 +207,7 @@ class preFlightsChecks:
 | 
				
			|||||||
        cmd = []
 | 
					        cmd = []
 | 
				
			||||||
        count = 0
 | 
					        count = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if repo == ubuntu:
 | 
					        if distro == ubuntu:
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                filename = "enable_lst_debain_repo.sh"
 | 
					                filename = "enable_lst_debain_repo.sh"
 | 
				
			||||||
                command = "wget http://rpms.litespeedtech.com/debian/" + filename
 | 
					                command = "wget http://rpms.litespeedtech.com/debian/" + filename
 | 
				
			||||||
@@ -215,9 +218,9 @@ class preFlightsChecks:
 | 
				
			|||||||
                                                   " Error #" + str(res))
 | 
					                                                   " Error #" + str(res))
 | 
				
			||||||
                    preFlightsChecks.stdOut("Unable to download Ubuntu CyberPanel installer! [installCyberPanelRepo]:"
 | 
					                    preFlightsChecks.stdOut("Unable to download Ubuntu CyberPanel installer! [installCyberPanelRepo]:"
 | 
				
			||||||
                                            " Error #" + str(res))
 | 
					                                            " Error #" + str(res))
 | 
				
			||||||
                    os._exit(os.EX_NOINPUT);
 | 
					                    os._exit(os.EX_NOINPUT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                os.chmod(filename, stat.S_IRWXU | stat.s_S_IRWXG)
 | 
					                os.chmod(filename, S_IRWXU | S_IRWXG)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                command = "./" + filename
 | 
					                command = "./" + filename
 | 
				
			||||||
                cmd = shlex.split(command)
 | 
					                cmd = shlex.split(command)
 | 
				
			||||||
@@ -228,11 +231,11 @@ class preFlightsChecks:
 | 
				
			|||||||
                                                   " Error #" + str(res))
 | 
					                                                   " Error #" + str(res))
 | 
				
			||||||
                    preFlightsChecks.stdOut("Unable to install Ubuntu CyberPanel! [installCyberPanelRepo]:"
 | 
					                    preFlightsChecks.stdOut("Unable to install Ubuntu CyberPanel! [installCyberPanelRepo]:"
 | 
				
			||||||
                                            " Error #" + str(res))
 | 
					                                            " Error #" + str(res))
 | 
				
			||||||
                    os._exit(os.EX_NOINPUT);
 | 
					                    os._exit(os.EX_NOINPUT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            except OSError as err:
 | 
					            except OSError as err:
 | 
				
			||||||
                logging.InstallLog.writeToFile("Exception during CyberPanel install: " + err)
 | 
					                logging.InstallLog.writeToFile("Exception during CyberPanel install: " + str(err))
 | 
				
			||||||
                preFlightsChecks.stdOut("Exception during CyberPanel install: " + err)
 | 
					                preFlightsChecks.stdOut("Exception during CyberPanel install: " + str(err))
 | 
				
			||||||
                os._exit(os.EX_OSERR)
 | 
					                os._exit(os.EX_OSERR)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            except:
 | 
					            except:
 | 
				
			||||||
@@ -324,7 +327,7 @@ class preFlightsChecks:
 | 
				
			|||||||
    def install_python_dev(self):
 | 
					    def install_python_dev(self):
 | 
				
			||||||
        count = 0
 | 
					        count = 0
 | 
				
			||||||
        while (1):
 | 
					        while (1):
 | 
				
			||||||
            if distro == centos
 | 
					            if distro == centos:
 | 
				
			||||||
                command = "yum -y install python-devel"
 | 
					                command = "yum -y install python-devel"
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                command = "apt-get -y install python-dev"
 | 
					                command = "apt-get -y install python-dev"
 | 
				
			||||||
@@ -349,7 +352,7 @@ class preFlightsChecks:
 | 
				
			|||||||
        while (1):
 | 
					        while (1):
 | 
				
			||||||
            if distro == centos:
 | 
					            if distro == centos:
 | 
				
			||||||
                command = "yum -y install gcc"
 | 
					                command = "yum -y install gcc"
 | 
				
			||||||
            else
 | 
					            else:
 | 
				
			||||||
                command = "apt-get -y install gcc"
 | 
					                command = "apt-get -y install gcc"
 | 
				
			||||||
            res = subprocess.call(shlex.split(command))
 | 
					            res = subprocess.call(shlex.split(command))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -573,7 +576,7 @@ class preFlightsChecks:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if distro == ubuntu
 | 
					        if distro == ubuntu
 | 
				
			||||||
            command = "pip install MySQL-python"
 | 
					            command = "pip install MySQL-python"
 | 
				
			||||||
            res = subprocess.call(shlex.split())
 | 
					            res = subprocess.call(shlex.split(command))
 | 
				
			||||||
            if res != 0:
 | 
					            if res != 0:
 | 
				
			||||||
                logging.InstallLog.writeToFile(
 | 
					                logging.InstallLog.writeToFile(
 | 
				
			||||||
                    "Unable to install MySQL-python, exiting installer! [install_python_mysql_library] Error: " + str(res))
 | 
					                    "Unable to install MySQL-python, exiting installer! [install_python_mysql_library] Error: " + str(res))
 | 
				
			||||||
@@ -3061,17 +3064,17 @@ milter_default_action = accept
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
def get_distro():
 | 
					def get_distro():
 | 
				
			||||||
    distro = -1
 | 
					    distro = -1
 | 
				
			||||||
    distroFile = ""
 | 
					    distro_file = ""
 | 
				
			||||||
    if os.path.exists("/etc/lsb-release"):
 | 
					    if exists("/etc/lsb-release"):
 | 
				
			||||||
        distroFile = "/etc/lsb-release"
 | 
					        distro_file = "/etc/lsb-release"
 | 
				
			||||||
        with open(distroFile) as f:
 | 
					        with open(distro_file) as f:
 | 
				
			||||||
            for line in f:
 | 
					            for line in f:
 | 
				
			||||||
                if line == "DISTRIB_ID=Ubuntu":
 | 
					                if line == "DISTRIB_ID=Ubuntu":
 | 
				
			||||||
                    distro = ubuntu
 | 
					                    distro = ubuntu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    else if (exists("/etc/os-release")):
 | 
					    elif exists("/etc/os-release"):
 | 
				
			||||||
        distroFile = "/etc/os-release"
 | 
					        distro_file = "/etc/os-release"
 | 
				
			||||||
        with open(distroFile) as f:
 | 
					        with open(distro_file) as f:
 | 
				
			||||||
            for line in f:
 | 
					            for line in f:
 | 
				
			||||||
                if line == "ID=\"centos\"":
 | 
					                if line == "ID=\"centos\"":
 | 
				
			||||||
                    distro = centos
 | 
					                    distro = centos
 | 
				
			||||||
@@ -3082,15 +3085,15 @@ def get_distro():
 | 
				
			|||||||
        os._exit(os.EX_UNAVAILABLE)
 | 
					        os._exit(os.EX_UNAVAILABLE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if distro == -1:
 | 
					    if distro == -1:
 | 
				
			||||||
        logging.InstallLog.writeToFile("Can't find distro name in " + distroFile + " - fatal error")
 | 
					        logging.InstallLog.writeToFile("Can't find distro name in " + distro_file + " - fatal error")
 | 
				
			||||||
        preFlightsChecks.stdOut("Can't find distro name in " + distroFile + " - fatal error")
 | 
					        preFlightsChecks.stdOut("Can't find distro name in " + distro_file + " - fatal error")
 | 
				
			||||||
        os._exit(os.EX_UNAVAILABLE)
 | 
					        os._exit(os.EX_UNAVAILABLE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return distro
 | 
					    return distro
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def pgm_main():
 | 
					def main():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    parser = argparse.ArgumentParser(description='CyberPanel Installer')
 | 
					    parser = argparse.ArgumentParser(description='CyberPanel Installer')
 | 
				
			||||||
    parser.add_argument('publicip', help='Please enter public IP for your VPS or dedicated server.')
 | 
					    parser.add_argument('publicip', help='Please enter public IP for your VPS or dedicated server.')
 | 
				
			||||||
@@ -3113,8 +3116,8 @@ def pgm_main():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    cwd = os.getcwd()
 | 
					    cwd = os.getcwd()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    distro = get_distro()
 | 
				
			||||||
    checks = preFlightsChecks("/usr/local/lsws/",args.publicip,"/usr/local",cwd,"/usr/local/CyberCP", get_distro())
 | 
					    checks = preFlightsChecks("/usr/local/lsws/",args.publicip,"/usr/local",cwd,"/usr/local/CyberCP", distro)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if distro == ubuntu:
 | 
					    if distro == ubuntu:
 | 
				
			||||||
        os.chdir("/etc/cyberpanel")
 | 
					        os.chdir("/etc/cyberpanel")
 | 
				
			||||||
@@ -3210,5 +3213,6 @@ def pgm_main():
 | 
				
			|||||||
    logging.InstallLog.writeToFile("CyberPanel installation successfully completed!")
 | 
					    logging.InstallLog.writeToFile("CyberPanel installation successfully completed!")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pgm_main()
 | 
					if __name__ == "__main"_:
 | 
				
			||||||
 | 
					    main()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user