Update install.py

Fixed syntax error due to missing parenthesis

```
SWAP set...

Preparing...

  File "install.py", line 801
    preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
    ^
SyntaxError: invalid syntax
Oops, something went wrong...
```
This commit is contained in:
WhatTheServer
2021-04-16 22:34:18 -04:00
committed by GitHub
parent b4bea92eea
commit 53ca15f833

View File

@@ -24,9 +24,9 @@ char_set = {'small': 'abcdefghijklmnopqrstuvwxyz',
def generate_pass(length=14):
chars = string.ascii_uppercase + string.ascii_lowercase + string.digits
size = length
return ''.join(random.choice(chars) for x in range(size))
chars = string.ascii_uppercase + string.ascii_lowercase + string.digits
size = length
return ''.join(random.choice(chars) for x in range(size))
# There can not be peace without first a great suffering.
@@ -96,7 +96,8 @@ class preFlightsChecks:
cyberPanelMirror = "mirror.cyberpanel.net/pip"
cdn = 'cyberpanel.sh'
def __init__(self, rootPath, ip, path, cwd, cyberPanelPath, distro, remotemysql = None , mysqlhost = None, mysqldb = None, mysqluser = None, mysqlpassword = None, mysqlport = None):
def __init__(self, rootPath, ip, path, cwd, cyberPanelPath, distro, remotemysql=None, mysqlhost=None, mysqldb=None,
mysqluser=None, mysqlpassword=None, mysqlport=None):
self.ipAddr = ip
self.path = path
self.cwd = cwd
@@ -276,12 +277,11 @@ class preFlightsChecks:
if self.distro == ubuntu:
self.stdOut("Add Cyberpanel user")
command = 'adduser --disabled-login --gecos "" cyberpanel'
preFlightsChecks.call(command, self.distro, command,command,1, 1, os.EX_OSERR)
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
else:
command = "useradd -s /bin/false cyberpanel"
preFlightsChecks.call(command, self.distro, command,command,1, 1, os.EX_OSERR)
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
###############################
@@ -292,21 +292,21 @@ class preFlightsChecks:
else:
command = "adduser docker"
preFlightsChecks.call(command, self.distro, command,command,1, 0, os.EX_OSERR)
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'groupadd docker'
preFlightsChecks.call(command, self.distro, command,command,1, 0, os.EX_OSERR)
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'usermod -aG docker docker'
preFlightsChecks.call(command, self.distro, command,command,1, 0, os.EX_OSERR)
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'usermod -aG docker cyberpanel'
preFlightsChecks.call(command, self.distro, command,command,1, 0, os.EX_OSERR)
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
###
command = "mkdir -p /etc/letsencrypt/live/"
preFlightsChecks.call(command, self.distro, command,command,1, 0, os.EX_OSERR)
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
except BaseException as msg:
logging.InstallLog.writeToFile("[ERROR] setup_account_cyberpanel. " + str(msg))
@@ -451,7 +451,7 @@ class preFlightsChecks:
logging.InstallLog.writeToFile("settings.py updated!")
#self.setupVirtualEnv(self.distro)
# self.setupVirtualEnv(self.distro)
### Applying migrations
@@ -645,7 +645,7 @@ class preFlightsChecks:
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
except BaseException as msg:
logging.InstallLog.writeToFile('[ERROR] '+ str(msg) + " [install_unzip]")
logging.InstallLog.writeToFile('[ERROR] ' + str(msg) + " [install_unzip]")
def install_zip(self):
self.stdOut("Install zip")
@@ -665,7 +665,8 @@ class preFlightsChecks:
if not os.path.exists("/usr/local/CyberCP/public"):
os.mkdir("/usr/local/CyberCP/public")
command = 'wget -O /usr/local/CyberCP/public/phpmyadmin.zip https://%s/misc/phpmyadmin.zip' % (preFlightsChecks.cdn)
command = 'wget -O /usr/local/CyberCP/public/phpmyadmin.zip https://%s/misc/phpmyadmin.zip' % (
preFlightsChecks.cdn)
preFlightsChecks.call(command, self.distro, '[download_install_phpmyadmin]',
command, 1, 0, os.EX_OSERR)
@@ -681,7 +682,6 @@ class preFlightsChecks:
preFlightsChecks.call(command, self.distro, '[download_install_phpmyadmin]',
command, 1, 0, os.EX_OSERR)
## Write secret phrase
rString = ''.join([random.choice(string.ascii_letters + string.digits) for n in range(32)])
@@ -725,15 +725,16 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
'chown -R lscpd:lscpd /usr/local/CyberCP/public/phpmyadmin', 1, 0, os.EX_OSERR)
if self.remotemysql == 'ON':
command = "sed -i 's|'localhost'|'%s'|g' %s" % (self.mysqlhost, '/usr/local/CyberCP/public/phpmyadmin/config.inc.php')
command = "sed -i 's|'localhost'|'%s'|g' %s" % (
self.mysqlhost, '/usr/local/CyberCP/public/phpmyadmin/config.inc.php')
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'cp /usr/local/CyberCP/plogical/phpmyadminsignin.php /usr/local/CyberCP/public/phpmyadmin/phpmyadminsignin.php'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if self.remotemysql == 'ON':
command = "sed -i 's|localhost|%s|g' /usr/local/CyberCP/public/phpmyadmin/phpmyadminsignin.php" % (self.mysqlhost)
command = "sed -i 's|localhost|%s|g' /usr/local/CyberCP/public/phpmyadmin/phpmyadminsignin.php" % (
self.mysqlhost)
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
@@ -754,7 +755,6 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
command = 'apt-get -y remove postfix'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
self.stdOut("Install dovecot - do the install")
if self.distro == centos:
@@ -783,8 +783,7 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
# os.remove(file_name)
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
##
if self.distro == centos:
@@ -795,18 +794,17 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
command = 'apt-get -y install dovecot-mysql dovecot-imapd dovecot-pop3d'
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
# We are going to leverage postconfig -e to edit the settings for hostname
command = '"postconf -e "myhostname = %s"' % (str(socket.getfqdn())
command = "postconf -e 'myhostname = %s'" % (str(socket.getfqdn()))
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = '"postconf -e "myhostname = %s"' % (str(socket.getfqdn())
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
# We are explicitly going to use sed to set the hostname default from "myhostname = server.example.com" to the fqdn from socket if the default is still found
# We are explicitly going to use sed to set the hostname default from "myhostname = server.example.com"
# to the fqdn from socket if the default is still found
postfix_main = '/etc/postfix/main.cf'
command = "sed -i 's|server.example.com|%s|g' %s" % (str(socket.getfqdn(), postfix_main)
command = "sed -i 's|server.example.com|%s|g' %s" % (str(socket.getfqdn(), postfix_main))
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
# if self.distro != centos:
# command = 'curl https://repo.dovecot.org/DOVECOT-REPO-GPG | gpg --import'
# subprocess.call(command, shell=True)
@@ -859,7 +857,6 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
mysql_virtual_email2email = "email-configs-one/mysql-virtual_email2email.cf"
dovecotmysql = "email-configs-one/dovecot-sql.conf.ext"
### update password:
data = open(dovecotmysql, "r").readlines()
@@ -877,7 +874,6 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
else:
writeDataToFile.writelines(items)
writeDataToFile.close()
### update password:
@@ -944,8 +940,6 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
writeDataToFile.close()
if self.remotemysql == 'ON':
command = "sed -i 's|host=localhost|host=%s|g' %s" % (self.mysqlhost, dovecotmysql)
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
@@ -959,7 +953,7 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
command = "sed -i 's|localhost|%s:%s|g' %s" % (
self.mysqlhost, self.mysqlport, mysql_virtual_forwardings)
self.mysqlhost, self.mysqlport, mysql_virtual_forwardings)
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
command = "sed -i 's|localhost|%s:%s|g' %s" % (
@@ -993,8 +987,9 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
fd.write(line)
fd.close()
except IOError as err:
self.stdOut("[ERROR] Error converting: " + filename + " from centos defaults to ubuntu defaults: " + str(err), 1,
1, os.EX_OSERR)
self.stdOut(
"[ERROR] Error converting: " + filename + " from centos defaults to ubuntu defaults: " + str(err), 1,
1, os.EX_OSERR)
def setup_postfix_dovecot_config(self, mysql):
try:
@@ -1066,7 +1061,6 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
shutil.copy("email-configs-one/dovecot.conf", dovecot)
shutil.copy("email-configs-one/dovecot-sql.conf.ext", dovecotmysql)
######################################## Permissions
command = 'chmod o= /etc/postfix/mysql-virtual_domains.cf'
@@ -1642,7 +1636,7 @@ imap_folder_list_limit = 0
##
command = 'systemctl start lscpd'
#preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
# preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
preFlightsChecks.stdOut("LSCPD Daemon Set!")
@@ -1692,7 +1686,6 @@ imap_folder_list_limit = 0
cronFile = open(cronPath, "w")
content = """
0 * * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/findBWUsage.py >/dev/null 2>&1
0 * * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/postfixSenderPolicy/client.py hourlyCleanup >/dev/null 2>&1
@@ -1711,7 +1704,6 @@ imap_folder_list_limit = 0
command = 'chmod 600 %s' % (cronPath)
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if self.distro == centos or self.distro == cent8:
command = 'systemctl restart crond.service'
else:
@@ -2144,7 +2136,6 @@ vmail
def disablePackegeUpdates(self):
if self.distro == centos:
mainConfFile = '/etc/yum.conf'
content = 'exclude=MariaDB-client MariaDB-common MariaDB-devel MariaDB-server MariaDB-shared ' \
'pdns pdns-backend-mysql dovecot dovecot-mysql postfix3 postfix3-ldap postfix3-mysql ' \
@@ -2154,6 +2145,7 @@ vmail
writeToFile.write(content)
writeToFile.close()
def main():
parser = argparse.ArgumentParser(description='CyberPanel Installer')
parser.add_argument('publicip', help='Please enter public IP for your VPS or dedicated server.')
@@ -2217,7 +2209,8 @@ def main():
mysqldb = args.mysqldb
if preFlightsChecks.debug:
print('mysqlhost: %s, mysqldb: %s, mysqluser: %s, mysqlpassword: %s, mysqlport: %s' % (mysqlhost, mysqldb, mysqluser, mysqlpassword, mysqlport))
print('mysqlhost: %s, mysqldb: %s, mysqluser: %s, mysqlpassword: %s, mysqlport: %s' % (
mysqlhost, mysqldb, mysqluser, mysqlpassword, mysqlport))
time.sleep(10)
else:
@@ -2229,7 +2222,8 @@ def main():
mysqldb = ''
distro = get_distro()
checks = preFlightsChecks("/usr/local/lsws/", args.publicip, "/usr/local", cwd, "/usr/local/CyberCP", distro, remotemysql, mysqlhost, mysqldb, mysqluser, mysqlpassword, mysqlport)
checks = preFlightsChecks("/usr/local/lsws/", args.publicip, "/usr/local", cwd, "/usr/local/CyberCP", distro,
remotemysql, mysqlhost, mysqldb, mysqluser, mysqlpassword, mysqlport)
checks.mountTemp()
if args.port == None:
@@ -2250,11 +2244,12 @@ def main():
import installCyberPanel
if ent == 0:
installCyberPanel.Main(cwd, mysql, distro, ent, None, port, args.ftp, args.powerdns, args.publicip, remotemysql, mysqlhost, mysqldb, mysqluser, mysqlpassword, mysqlport)
installCyberPanel.Main(cwd, mysql, distro, ent, None, port, args.ftp, args.powerdns, args.publicip, remotemysql,
mysqlhost, mysqldb, mysqluser, mysqlpassword, mysqlport)
else:
installCyberPanel.Main(cwd, mysql, distro, ent, serial, port, args.ftp, args.powerdns, args.publicip, remotemysql, mysqlhost, mysqldb, mysqluser, mysqlpassword, mysqlport)
installCyberPanel.Main(cwd, mysql, distro, ent, serial, port, args.ftp, args.powerdns, args.publicip,
remotemysql, mysqlhost, mysqldb, mysqluser, mysqlpassword, mysqlport)
checks.setupPHPAndComposer()
checks.fix_selinux_issue()
@@ -2325,7 +2320,7 @@ def main():
checks.enableDisableFTP('on', distro)
checks.installCLScripts()
#checks.disablePackegeUpdates()
# checks.disablePackegeUpdates()
try:
# command = 'mkdir -p /usr/local/lscp/cyberpanel/rainloop/data/data/default/configs/'
@@ -2357,10 +2352,9 @@ echo $oConfig->Save() ? 'Done' : 'Error';
writeToFile.write(content)
writeToFile.close()
command = '/usr/local/lsws/lsphp72/bin/php /usr/local/CyberCP/public/rainloop.php'
subprocess.call(shlex.split(command))
command = "chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop/data"
subprocess.call(shlex.split(command))
except: