mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
New installation scheme
This commit is contained in:
@ -1,27 +1,65 @@
|
||||
import sys
|
||||
sys.path.append('../build_tools/scripts')
|
||||
import base
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
def check_nodejs_version():
|
||||
progsToInstall = []
|
||||
progsToUninstall = []
|
||||
pathsToRemove = []
|
||||
pathToValidMySQLServer = ''
|
||||
|
||||
def check_nodejs():
|
||||
global progsToInstall, progsToUninstall
|
||||
base.print_info('Check Node.js version')
|
||||
nodejs_version = run_command('node -v')['stdout']
|
||||
if (nodejs_version == ''):
|
||||
return ""
|
||||
|
||||
nodejs_cur_version = int(nodejs_version.split('.')[0][1:])
|
||||
print('Node.js not found.')
|
||||
progsToInstall.append('Node.js')
|
||||
return False
|
||||
else:
|
||||
nodejs_cur_version = int(nodejs_version.split('.')[0][1:])
|
||||
print('Installed Node.js version: ' + str(nodejs_cur_version))
|
||||
nodejs_min_version = 8
|
||||
nodejs_max_version = 10
|
||||
if (nodejs_min_version > nodejs_cur_version or nodejs_cur_version > nodejs_max_version):
|
||||
print('Node.js version must be 8.x to 10.x')
|
||||
progsToUninstall.append('Node.js')
|
||||
progsToInstall.append('Node.js')
|
||||
return False
|
||||
else:
|
||||
print('Node.js version is valid')
|
||||
return True
|
||||
|
||||
return nodejs_cur_version
|
||||
|
||||
def check_java_bitness():
|
||||
global progsToInstall
|
||||
base.print_info('Check Java bitness')
|
||||
java_version = run_command('java -version')['stderr']
|
||||
|
||||
if (java_version.find('64-Bit') == -1):
|
||||
return 'x32'
|
||||
elif (java_version.find('32-Bit') == -1):
|
||||
return 'x64'
|
||||
if (java_version.find('64-Bit') != -1):
|
||||
print('Java bitness is valid')
|
||||
return True
|
||||
elif (java_version.find('32-Bit') != -1):
|
||||
print('Installed java: ' + javaBitness)
|
||||
print('Java bitness must be x64')
|
||||
progsToInstall.append('Java')
|
||||
return False
|
||||
else:
|
||||
return ''
|
||||
print('Java not found.')
|
||||
pprogsToInstall.append('Java')
|
||||
|
||||
def check_rabbitmq():
|
||||
return run_command('sc query RabbitMQ')['stdout']
|
||||
global progsToInstall
|
||||
base.print_info('Check RabbitMQ')
|
||||
result = run_command('sc query RabbitMQ')['stdout']
|
||||
if (result.find('RabbitMQ') == -1):
|
||||
progsToInstall.append('RabbitMQ')
|
||||
return False
|
||||
else:
|
||||
print('RabbitMQ is installed')
|
||||
return True
|
||||
|
||||
def get_erlangPath():
|
||||
if (sys.version_info[0] >= 3):
|
||||
@ -46,6 +84,43 @@ def get_erlangPath():
|
||||
except:
|
||||
return Path
|
||||
|
||||
def check_erlang():
|
||||
global progsToInstall, progsToUninstall
|
||||
base.print_info('Check Erlang')
|
||||
erlangPath = get_erlangPath()
|
||||
|
||||
if (erlangPath == ""):
|
||||
print('Erlang not found')
|
||||
progsToInstall.append('Erlang')
|
||||
progsToInstall.append('RabbitMQ')
|
||||
return False
|
||||
else:
|
||||
erlangBitness = run_command('cd ' + erlangPath + '/bin && erl -eval "erlang:display(erlang:system_info(wordsize)), halt()." -noshell')['stdout']
|
||||
if (erlangBitness == '4'):
|
||||
print('Erlang bitness (x32) is not valid')
|
||||
progsToUninstall('Erlang')
|
||||
progsToInstall.append('Erlang')
|
||||
progsToInstall.append('RabbitMQ')
|
||||
return False
|
||||
elif (erlangBitness == '8'):
|
||||
if (os.getenv("ERLANG_HOME") != get_erlangPath()):
|
||||
progsToInstall.append('ERLANG_HOME')
|
||||
print("Erlang bitness is valid")
|
||||
return True
|
||||
|
||||
def check_gruntcli():
|
||||
global progsToInstall
|
||||
base.print_info('Check Grunt-Cli')
|
||||
result = run_command('npm list -g --depth=0')['stdout']
|
||||
|
||||
if (result.find('grunt-cli') == -1):
|
||||
print('Grunt-Cli not found')
|
||||
progsToInstall.append('GruntCli')
|
||||
return False
|
||||
else:
|
||||
print('Grunt-Cli is installed')
|
||||
return True
|
||||
|
||||
def get_mysqlServersPaths():
|
||||
if (sys.version_info[0] >= 3):
|
||||
import winreg
|
||||
@ -57,9 +132,13 @@ def get_mysqlServersPaths():
|
||||
|
||||
try:
|
||||
keyValue = r"SOFTWARE\WOW6432Node\MySQL AB"
|
||||
aKey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, keyValue)
|
||||
count_subkey = winreg.QueryInfoKey(aKey)[0]
|
||||
|
||||
try:
|
||||
aKey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, keyValue)
|
||||
except:
|
||||
return Versions
|
||||
|
||||
count_subkey = winreg.QueryInfoKey(aKey)[0]
|
||||
for i in range(count_subkey):
|
||||
asubkey_name = winreg.EnumKey(aKey, i)
|
||||
if (asubkey_name.find('MySQL Server') != - 1):
|
||||
@ -83,9 +162,13 @@ def get_mysqlServersDataPaths():
|
||||
|
||||
try:
|
||||
keyValue = r"SOFTWARE\WOW6432Node\MySQL AB"
|
||||
aKey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, keyValue)
|
||||
count_subkey = winreg.QueryInfoKey(aKey)[0]
|
||||
|
||||
try:
|
||||
aKey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, keyValue)
|
||||
except:
|
||||
return Versions
|
||||
|
||||
count_subkey = winreg.QueryInfoKey(aKey)[0]
|
||||
for i in range(count_subkey):
|
||||
asubkey_name = winreg.EnumKey(aKey, i)
|
||||
if (asubkey_name.find('MySQL Server') != - 1):
|
||||
@ -109,9 +192,13 @@ def get_mysqlServersVersions():
|
||||
|
||||
try:
|
||||
keyValue = r"SOFTWARE\WOW6432Node\MySQL AB"
|
||||
aKey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, keyValue)
|
||||
count_subkey = winreg.QueryInfoKey(aKey)[0]
|
||||
|
||||
try:
|
||||
aKey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, keyValue)
|
||||
except:
|
||||
return Versions
|
||||
|
||||
count_subkey = winreg.QueryInfoKey(aKey)[0]
|
||||
for i in range(count_subkey):
|
||||
asubkey_name = winreg.EnumKey(aKey, i)
|
||||
if (asubkey_name.find('MySQL Server') != - 1):
|
||||
@ -124,22 +211,33 @@ def get_mysqlServersVersions():
|
||||
except:
|
||||
return Versions
|
||||
|
||||
def check_erlang():
|
||||
erlangPath = get_erlangPath()
|
||||
|
||||
if (erlangPath == ""):
|
||||
return None
|
||||
def check_mysqlInstaller():
|
||||
global progsToInstall
|
||||
if (sys.version_info[0] >= 3):
|
||||
import winreg
|
||||
else:
|
||||
return run_command('cd ' + erlangPath + '/bin && erl -eval "erlang:display(erlang:system_info(wordsize)), halt()." -noshell')['stdout']
|
||||
import _winreg as winreg
|
||||
|
||||
def check_gruntcli():
|
||||
result = run_command('npm list -g --depth=0')['stdout']
|
||||
|
||||
if (result.find('grunt-cli') == -1):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
try:
|
||||
keyValue = r"SOFTWARE\WOW6432Node\MySQL"
|
||||
|
||||
try:
|
||||
aKey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, keyValue)
|
||||
except:
|
||||
progsToInstall.append('MySQLInstaller')
|
||||
return False
|
||||
|
||||
count_subkey = winreg.QueryInfoKey(aKey)[0]
|
||||
for i in range(count_subkey):
|
||||
asubkey_name = winreg.EnumKey(aKey, i)
|
||||
if (asubkey_name.find('MySQL Installer') != - 1):
|
||||
return True
|
||||
|
||||
progsToInstall.append('MySQLInstaller')
|
||||
return False
|
||||
except:
|
||||
return False
|
||||
|
||||
def check_mysqlServersBitness(MySQLPaths):
|
||||
serversBitness = []
|
||||
|
||||
@ -158,8 +256,51 @@ def check_mysqlServersBitness(MySQLPaths):
|
||||
serversBitness.append('')
|
||||
return serversBitness
|
||||
|
||||
def check_mysqlServer(serversBitness, serversVersions, serversPaths, dataPaths, bAddToArrayToInstall):
|
||||
global progsToInstall, progsToUninstall, pathsToRemove, pathToValidMySQLServer
|
||||
base.print_info('Check MySQL Server')
|
||||
for i in range(len(serversBitness)):
|
||||
if serversBitness[i] != '':
|
||||
break
|
||||
if (i == len(serversBitness) - 1):
|
||||
print('MySQL Server not found')
|
||||
progsToInstall.append('MySQLServer')
|
||||
return False
|
||||
|
||||
for i in range(len(serversBitness)):
|
||||
result = serversBitness[i]
|
||||
if (result == ""):
|
||||
continue
|
||||
elif (result == 'x32'):
|
||||
print('MySQL Server ' + serversVersions[i][0:3] + ' bitness is x32, is not valid')
|
||||
progsToUninstall.append('MySQL Server ' + serversVersions[i][0:3])
|
||||
continue
|
||||
elif (result == 'x64'):
|
||||
print('MySQL Server bitness is valid')
|
||||
connectionResult = run_command('cd ' + serversPaths[i] + 'bin && mysql -u root -ponlyoffice -e "SHOW GLOBAL VARIABLES LIKE ' + r"'PORT';" + '"')['stdout']
|
||||
if (connectionResult.find('port') != -1 and connectionResult.find('3306') != -1):
|
||||
if (run_command('cd ' + serversPaths[i] + 'bin && mysql -u root -ponlyoffice -e "SHOW DATABASES;"')['stdout'].find('onlyoffice') == -1):
|
||||
print('Database onlyoffice not found')
|
||||
progsToInstall.append('MySQLDatabase')
|
||||
pathToValidMySQLServer = serversPaths[i]
|
||||
progsToInstall.append('MySQLEncrypt')
|
||||
return True
|
||||
else:
|
||||
print('MySQL Server configuration is not valid')
|
||||
progsToUninstall.append('MySQL Server ' + serversVersions[i][0:3])
|
||||
pathsToRemove.append(serversPaths[i])
|
||||
progsToInstall.append('MySQLServer')
|
||||
continue
|
||||
|
||||
def check_buildTools():
|
||||
return True
|
||||
global progsToInstall
|
||||
base.print_info('Check Build Tools')
|
||||
result = run_command(os.path.split(os.getcwd())[0] + r'\build_tools\tools\win\vswhere\vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property DisplayName')['stdout']
|
||||
if (result == ''):
|
||||
progsToInstall.append('BuildTools')
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def run_command(sCommand):
|
||||
popen = subprocess.Popen(sCommand, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
@ -175,3 +316,21 @@ def run_command(sCommand):
|
||||
|
||||
return result
|
||||
|
||||
def check_all():
|
||||
global progsToInstall, progsToUninstall, pathsToRemove, pathToValidMySQLServer
|
||||
check_nodejs()
|
||||
check_java_bitness()
|
||||
check_erlang()
|
||||
check_rabbitmq()
|
||||
check_gruntcli()
|
||||
check_buildTools()
|
||||
check_mysqlInstaller()
|
||||
|
||||
mySQLServersPaths = get_mysqlServersPaths()
|
||||
mySQLServersBitness = check_mysqlServersBitness(mySQLServersPaths)
|
||||
mySQLServersVersions = get_mysqlServersVersions()
|
||||
mySQLServersDataPaths = get_mysqlServersDataPaths()
|
||||
|
||||
check_mysqlServer(mySQLServersBitness, mySQLServersVersions, mySQLServersPaths, mySQLServersDataPaths, True)
|
||||
return {'Uninstall': progsToUninstall, 'Install': progsToInstall, 'Paths': pathsToRemove, 'MySQLServer' : pathToValidMySQLServer}
|
||||
|
||||
|
||||
@ -7,17 +7,16 @@ import ctypes
|
||||
import checks_develop as check
|
||||
import shutil
|
||||
|
||||
|
||||
def is_admin():
|
||||
try:
|
||||
return ctypes.windll.shell32.IsUserAnAdmin()
|
||||
except:
|
||||
return False
|
||||
|
||||
def installingProgram(sProgram, bSilent = False):
|
||||
def installingProgram(sProgram, sParam = ''):
|
||||
if (sProgram == 'Node.js'):
|
||||
print("Installing Node.js...")
|
||||
base.download("https://nodejs.org/dist/latest-v10.x/node-v10.22.0-x64.msi", './nodejs.msi')
|
||||
base.download("https://nodejs.org/dist/latest-v10.x/node-v10.22.1-x64.msi", './nodejs.msi')
|
||||
code = subprocess.call('msiexec.exe /i nodejs.msi /qn', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
if (code == 0):
|
||||
print("Install success!")
|
||||
@ -63,6 +62,12 @@ def installingProgram(sProgram, bSilent = False):
|
||||
print("Error!")
|
||||
base.delete_file('./erlang.exe')
|
||||
return False
|
||||
elif (sProgram == 'ERLANG_HOME'):
|
||||
code = subprocess.call('SETX /M ERLANG_HOME "' + check.get_erlangPath() + '"')
|
||||
if (code == 0):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
elif (sProgram == 'GruntCli'):
|
||||
print('Installing Grunt-Cli...')
|
||||
code = subprocess.call('npm install -g grunt-cli', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
@ -86,14 +91,22 @@ def installingProgram(sProgram, bSilent = False):
|
||||
return False
|
||||
elif (sProgram == 'MySQLServer'):
|
||||
print('Installing MySQL Server...')
|
||||
code = subprocess.call('cd C:\Program Files (x86)\MySQL\MySQL Installer for Windows && MySQLInstallerConsole.exe community install server;8.0.21;x64:*:type=config;openfirewall=true;generallog=true;binlog=true;serverid=3306;enable_tcpip=true;port=3306;rootpasswd=onlyoffice -silent', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
code = subprocess.call('cd ' + os.path.abspath(os.sep) + 'Program Files (x86)\MySQL\MySQL Installer for Windows && MySQLInstallerConsole.exe community install server;8.0.21;x64:*:type=config;openfirewall=true;generallog=true;binlog=true;serverid=3306;enable_tcpip=true;port=3306;rootpasswd=onlyoffice -silent', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
if (code == 0):
|
||||
print("Install success!")
|
||||
return True
|
||||
else:
|
||||
print("Error!")
|
||||
return False
|
||||
elif (sProgram == "Build Tools"):
|
||||
elif (sProgram == 'MySQLDatabase'):
|
||||
print('Setting database...')
|
||||
subprocess.call('cd ' + sParam + 'bin && mysql -u root -ponlyoffice -e "source ' + os.getcwd() + '\schema\mysql\createdb.sql"', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
return True
|
||||
elif (sProgram == 'MySQLEncrypt'):
|
||||
print('Setting MySQL password encrypting...')
|
||||
subprocess.call('cd ' + sParam + 'bin && mysql -u root -ponlyoffice -e "' + "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'onlyoffice';" + '"', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
return True
|
||||
elif (sProgram == "BuildTools"):
|
||||
print('Installing Build Tools...')
|
||||
base.download("https://download.visualstudio.microsoft.com/download/pr/11503713/e64d79b40219aea618ce2fe10ebd5f0d/vs_BuildTools.exe", './vs_BuildTools.exe')
|
||||
code = subprocess.call('vs_buildtools.exe --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --quiet --wait', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
@ -130,145 +143,40 @@ def deleteProgram(sName):
|
||||
ctypes.windll.shell32.ShellExecuteW(None, u"runas", unicode(sys.executable), unicode(''.join(sys.argv)), None, 1)
|
||||
sys.exit()
|
||||
|
||||
def installNodejs(installedVersion):
|
||||
if (installedVersion == ''):
|
||||
print('Node.js not found.')
|
||||
else:
|
||||
print('Installed Node.js version: ' + str(installedVersion))
|
||||
|
||||
nodejs_min_version = 8
|
||||
nodejs_max_version = 10
|
||||
if (installedVersion == ''):
|
||||
return installingProgram('Node.js')
|
||||
elif (nodejs_min_version > installedVersion or installedVersion > nodejs_max_version):
|
||||
print('Node.js version must be 8.x to 10.x')
|
||||
deleteProgram('Node.js')
|
||||
return installingProgram('Node.js')
|
||||
else:
|
||||
print('Valid Node.js version')
|
||||
return True
|
||||
|
||||
def installJava(javaBitness):
|
||||
if (javaBitness == ''):
|
||||
print('Java not found.')
|
||||
return installingProgram('Java')
|
||||
elif (javaBitness == 'x32'):
|
||||
print('Installed java: ' + javaBitness)
|
||||
print('Java bitness must be x64')
|
||||
return installingProgram('Java')
|
||||
elif (javaBitness == 'x64'):
|
||||
print('Valid Java bitness')
|
||||
return True
|
||||
|
||||
def installRabbitMQ(result):
|
||||
if (result.find('RabbitMQ') == -1):
|
||||
return installingProgram('RabbitMQ')
|
||||
else:
|
||||
print('RabbitMQ is installed')
|
||||
return True
|
||||
|
||||
def installErlang(result):
|
||||
if (result == None):
|
||||
installingProgram('Erlang')
|
||||
installingProgram('RabbitMQ')
|
||||
path = check.get_erlangPath()
|
||||
code = subprocess.call('SETX /M ERLANG_HOME "' + path + '"')
|
||||
if (code == 0):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
elif (result == '4'):
|
||||
print('Erlang bitness (x32) is not valid')
|
||||
deleteProgram('Erlang')
|
||||
if (True != installingProgram('Erlang')):
|
||||
exit(0)
|
||||
installingProgram('RabbitMQ')
|
||||
elif (result == '8'):
|
||||
if (os.getenv("ERLANG_HOME") != check.get_erlangPath()):
|
||||
path = check.get_erlangPath()
|
||||
code = subprocess.call('SETX /M ERLANG_HOME "' + path + '"')
|
||||
if (code == 0):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
print("Erlang is valid")
|
||||
return True
|
||||
|
||||
def installGruntCli(result):
|
||||
if (result == False):
|
||||
print('Grunt-Cli not found')
|
||||
return installingProgram('GruntCli')
|
||||
else:
|
||||
print('Grunt-Cli is installed')
|
||||
return True
|
||||
|
||||
def installMySQLServer(serversBitness, serversVersions, serversPaths, dataPaths):
|
||||
for i in range(len(serversBitness)):
|
||||
result = serversBitness[i]
|
||||
if (result == ""):
|
||||
continue
|
||||
elif (result == 'x32'):
|
||||
print('MySQL Server bitness is x32, is not valid')
|
||||
deleteProgram('MySQL Server ' + serversVersions[i][0:3])
|
||||
continue
|
||||
elif (result == 'x64'):
|
||||
connectionResult = check.run_command('cd ' + serversPaths[i] + 'bin && mysql -u root -ponlyoffice -e "SHOW GLOBAL VARIABLES LIKE ' + r"'PORT';" + '"')['stdout']
|
||||
if (connectionResult.find('port') != -1 and connectionResult.find('3306') != -1):
|
||||
if (check.run_command('cd ' + serversPaths[i] + 'bin && mysql -u root -ponlyoffice -e "SHOW DATABESES;')['stdout'].find('onlyoffice') == -1):
|
||||
subprocess.call('cd ' + serversPaths[i] + 'bin && mysql -u root -ponlyoffice -e "source ./schema\mysql\createdb.sql"', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
subprocess.call('cd ' + serversPaths[i] + 'bin && mysql -u root -ponlyoffice -e "' + "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'onlyoffice';" + '"', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
print('MySQL Server ' + serversVersions[i][0:3] + ' is valid')
|
||||
return True
|
||||
else:
|
||||
print('MySQL Server configuration is not valid')
|
||||
deleteProgram('MySQL Server ' + serversVersions[i][0:3])
|
||||
shutil.rmtree(dataPaths[i])
|
||||
continue
|
||||
|
||||
if (True != installingProgram('MySQLInstaller')):
|
||||
deleteProgram('MySQL Installer - Community')
|
||||
if (True != installingProgram('MySQLInstaller')):
|
||||
return False
|
||||
|
||||
def installMySQLServer():
|
||||
installingProgram('MySQLServer')
|
||||
dirPaths = check.get_mysqlServersPaths()
|
||||
|
||||
for i in range(len(dirPaths)):
|
||||
if (dirPaths[i].find('Server 8.0') != -1):
|
||||
connectionResult = run_command('cd ' + dirPaths[i] + 'bin && mysql -u root -ponlyoffice -e "SHOW GLOBAL VARIABLES LIKE ' + r"'PORT';" + '"')['stdout']
|
||||
if (connectionResult.find('port') != -1 and connectionResult.find('3306') != -1):
|
||||
if (run_command('cd ' + dirPaths[i] + 'bin && mysql -u root -ponlyoffice -e "SHOW DATABESES;')['stdout'].find('onlyoffice') == -1):
|
||||
subprocess.call('cd ' + dirPaths[i] + 'bin && mysql -u root -ponlyoffice -e "source ./schema\mysql\createdb.sql"', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
subprocess.call('cd ' + dirPaths[i] + 'bin && mysql -u root -ponlyoffice -e "' + "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'onlyoffice';" + '"', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
print('MySQL Server 8.0 is valid')
|
||||
return True
|
||||
else:
|
||||
continue
|
||||
|
||||
mysqlPaths = check.get_mysqlServersPaths()
|
||||
mysqlVersions = check.get_mysqlServersVersions()
|
||||
|
||||
for i in range(len(mysqlVersions)):
|
||||
if (mysqlVersions[i] == '8.0.21'):
|
||||
print('Setting MySQL database...')
|
||||
subprocess.call('cd ' + mysqlPaths[i] + 'bin && mysql -u root -ponlyoffice -e "source ' + os.getcwd() + '\schema\mysql\createdb.sql"', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
subprocess.call('cd ' + mysqlPaths[i] + 'bin && mysql -u root -ponlyoffice -e "' + "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'onlyoffice';" + '"', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
print('MySQL Server ' + mysqlVersions[i][0:3] + ' is valid')
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
||||
try:
|
||||
if is_admin():
|
||||
base.print_info('Check Node.js version')
|
||||
installNodejs(check.check_nodejs_version())
|
||||
base.print_info('Check Java bitness')
|
||||
installJava(check.check_java_bitness())
|
||||
base.print_info('Check Erlang')
|
||||
installErlang(check.check_erlang())
|
||||
base.print_info('Check RabbitMQ')
|
||||
installRabbitMQ(check.check_rabbitmq())
|
||||
base.print_info('Check Grunt-Cli')
|
||||
installGruntCli(check.check_gruntcli())
|
||||
base.print_info('Check MySQL Server')
|
||||
installMySQLServer(check.check_mysqlServersBitness(check.get_mysqlServersPaths()), check.get_mysqlServersVersions(), check.get_mysqlServersPaths(), check.get_mysqlServersDataPaths())
|
||||
#base.print_info('Check Build Tools')
|
||||
#installMySQLServer(check.check_mysqlServersBitness(check.get_mysqlServersPaths()), check.get_mysqlServersVersions(), check.get_mysqlServersPaths(), check.get_mysqlServersDataPaths())
|
||||
checkResults = check.check_all()
|
||||
if (len(checkResults['Install']) > 0):
|
||||
if is_admin():
|
||||
for i in range(len(checkResults['Uninstall'])):
|
||||
deleteProgram(checkResults['Uninstall'][i])
|
||||
for i in range(len(checkResults['Paths'])):
|
||||
shutil.rmtree(checkResults['Paths'][i])
|
||||
for i in range(len(checkResults['Install'])):
|
||||
if (checkResults['Install'][i] == 'MySQLDatabase' or checkResults['Install'][i] == 'MySQLEncrypt'):
|
||||
installingProgram(checkResults['Install'][i], checkResults['MySQLServer'])
|
||||
elif (checkResults['Install'][i] == 'MySQLServer'):
|
||||
installMySQLServer()
|
||||
else:
|
||||
installingProgram(checkResults['Install'][i])
|
||||
else:
|
||||
ctypes.windll.shell32.ShellExecuteW(None, unicode("runas"), unicode(sys.executable), unicode(''.join(sys.argv)), None, 1)
|
||||
sys.exit(0)
|
||||
else:
|
||||
ctypes.windll.shell32.ShellExecuteW(None, unicode("runas"), unicode(sys.executable), unicode(''.join(sys.argv)), None, 1)
|
||||
sys.exit(0)
|
||||
base.print_info('All checks complite')
|
||||
except SystemExit:
|
||||
input("Ignoring SystemExit. Press Enter to continue...")
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user