CLScripts

This commit is contained in:
Usman Nasir
2019-12-28 18:01:12 +05:00
parent 067b2688c1
commit 85c05952de
3 changed files with 86 additions and 4 deletions

View File

@@ -3,9 +3,9 @@ import json
class CLMain():
def __init__(self):
self.path = '/usr/local/CyberCP/version.txt'
versionInfo = json.loads(open(self.path, 'r').read())
self.version = versionInfo['version']
self.build = versionInfo['build']
#versionInfo = json.loads(open(self.path, 'r').read())
self.version = '1.9'
self.build = '2'
ipFile = "/etc/cyberpanel/machineIP"
f = open(ipFile)

View File

@@ -648,6 +648,15 @@ class preFlightsChecks:
command = 'chmod +x /usr/local/CyberCP/CLManager/CLPackages.py'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
clScripts = ['/usr/local/CyberCP/CLScript/panel_info.py', '/usr/local/CyberCP/CLScript/CloudLinuxPackages.py',
'/usr/local/CyberCP/CLScript/CloudLinuxUsers.py',
'/usr/local/CyberCP/CLScript/CloudLinuxDomains.py'
, '/usr/local/CyberCP/CLScript/CloudLinuxResellers.py', '/usr/local/CyberCP/CLScript/CloudLinuxAdmins.py']
for items in clScripts:
command = 'chmod +x %s' % (items)
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
def install_unzip(self):
self.stdOut("Install unzip")
try:
@@ -2123,6 +2132,38 @@ milter_default_action = accept
except:
pass
def installCLScripts(self):
try:
CentOSPath = '/etc/redhat-release'
if os.path.exists(CentOSPath):
command = 'mkdir -p /opt/cpvendor/etc/'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
content = """[integration_scripts]
panel_info = /usr/local/CyberCP/CLScript/panel_info.py
packages = /usr/local/CyberCP/CLScript/CloudLinuxPackages.py
users = /usr/local/CyberCP/CLScript/CloudLinuxUsers.py
domains = /usr/local/CyberCP/CLScript/CloudLinuxDomains.py
resellers = /usr/local/CyberCP/CLScript/CloudLinuxResellers.py
admins = /usr/local/CyberCP/CLScript/CloudLinuxAdmins.py
[lvemanager_config]
run_service = 1
service_port = 9000
"""
writeToFile = open('/opt/cpvendor/etc/integration.ini', 'w')
writeToFile.write(content)
writeToFile.close()
except:
pass
def installAcme(self):
command = 'wget -O - https://get.acme.sh | sh'
subprocess.call(command, shell=True)
@@ -2276,7 +2317,7 @@ def main():
else:
preFlightsChecks.stdOut("Pure-FTPD will be installed and enabled.")
checks.enableDisableFTP('On', distro)
checks.installCLScripts()
logging.InstallLog.writeToFile("CyberPanel installation successfully completed!")

View File

@@ -1723,6 +1723,14 @@ CSRF_COOKIE_SECURE = True
command = 'chmod +x /usr/local/CyberCP/CLManager/CLPackages.py'
Upgrade.executioner(command, command, 0)
clScripts = ['/usr/local/CyberCP/CLScript/panel_info.py', '/usr/local/CyberCP/CLScript/CloudLinuxPackages.py',
'/usr/local/CyberCP/CLScript/CloudLinuxUsers.py', '/usr/local/CyberCP/CLScript/CloudLinuxDomains.py'
,'/usr/local/CyberCP/CLScript/CloudLinuxResellers.py', '/usr/local/CyberCP/CLScript/CloudLinuxAdmins.py']
for items in clScripts:
command = 'chmod +x %s' % (items)
Upgrade.executioner(command, 0)
Upgrade.stdOut("Permissions updated.")
except BaseException as msg:
@@ -2048,6 +2056,38 @@ failovermethod=priority
command = "sed -i 's|<maxSSLConnections>200</maxSSLConnections>|<maxSSLConnections>10000</maxSSLConnections>|g' /usr/local/lsws/conf/httpd_config.xml"
Upgrade.executioner(command, 0)
@staticmethod
def installCLScripts():
try:
CentOSPath = '/etc/redhat-release'
if os.path.exists(CentOSPath):
command = 'mkdir -p /opt/cpvendor/etc/'
Upgrade.executioner(command, 0)
content = """[integration_scripts]
panel_info = /usr/local/CyberCP/CLScript/panel_info.py
packages = /usr/local/CyberCP/CLScript/CloudLinuxPackages.py
users = /usr/local/CyberCP/CLScript/CloudLinuxUsers.py
domains = /usr/local/CyberCP/CLScript/CloudLinuxDomains.py
resellers = /usr/local/CyberCP/CLScript/CloudLinuxResellers.py
admins = /usr/local/CyberCP/CLScript/CloudLinuxAdmins.py
[lvemanager_config]
run_service = 1
service_port = 9000
"""
if not os.path.exists('/opt/cpvendor/etc/integration.ini'):
writeToFile = open('/opt/cpvendor/etc/integration.ini', 'w')
writeToFile.write(content)
writeToFile.close()
except:
pass
@staticmethod
@@ -2167,6 +2207,7 @@ failovermethod=priority
command = 'systemctl start cpssh'
Upgrade.executioner(command, 'fix csf if there', 0)
Upgrade.AutoUpgradeAcme()
Upgrade.installCLScripts()
Upgrade.stdOut("Upgrade Completed.")