def InstallViaExecutable(service): conf = config.GetConfig() Logger.Info('Installing executable, follow the instructions..', end=' ') if sys.platform == "linux" or sys.platform == "linux2": if not sh.Call('sudo apt-get update'): raise Exception('Unexpected: Could not update apt') if not sh.Call('sudo apt-get install {0}'.format(service)): raise Exception('Unexpected: Could not install service: ' + service) return Logger.Info(service + " package added", 'green', attrs=['bold']) elif sys.platform == "darwin": return elif sys.platform == "win32": installpath = conf["install-root"] + '' + service installer = 'msiexec.exe /i' if service in conf['windows-service']: if conf['windows-service'][service]['strategy'] == 'msi': return sh.Call('{0} "{1}" ^ INSTALLLOCATION="{2}" /qb'.format( installer, conf['windows-service'][service], installpath)) return DownloadAndInstallWindowsService( conf['windows-service'][service], service) else: Logger.Error("Unsupported operating system") return sys.exit()
def InstallMongoDB(): conf = config.GetConfig() installdir = conf["install-root"] + 'mongodb' if not ash.AssertMongoInstalled(): if not sh.AddToPathPrompt(installdir + '/bin'): Logger.Alert("Make sure to add this path to env") return Logger.Success("Mongo is installed in {0}.".format(installdir))
def __init__(self, cml): self.rootFile = None self.commandLine = cml self.cmCursor = 0 self.conf = config.GetConfig() self.rootFileName = self.conf['root-file'] self.repoConfig = {} self.version = self.conf['version'] self.OPTIONS = self.conf['cli-options'] self.ADD_OPTIONS = self.conf['cli-add-options']
def DownloadTo(url, folder="", outName="output.exe"): conf = config.GetConfig() baseDownloadFolder = conf['temp-download-folder'] + folder downloadCommand = 'curl -o {0} "{1}"'.format( baseDownloadFolder + '/' + outName, url) Logger.Info("\nDownloading {0} to {1}".format(outName, baseDownloadFolder), end=' ') sh.Call('mkdir "{0}"'.format(baseDownloadFolder)) return sh.Call(downloadCommand) == 0
def DownloadAndInstallWindowsService(service, serviceName): conf = config.GetConfig() exeName = serviceName + '.exe' exePath = conf['temp-download-folder'] + '/' + serviceName + '/' + exeName if DownloadTo(service['url'], serviceName, exeName): Logger.Success("Download finished") Logger.Info("Installing {}.. Follow the instructions.".format(exeName), end=' ') if InstallExe(exePath): return Logger.Success("Install finished") return Logger.Failed("Unexpected error during installation..") return Logger.Failed("Unexpected error during download..")
from extenders import extenderhelpers as helper from shell import creatorshell as csh from configuration import config from logger import Logger conf = config.GetConfig() def Extend(args): switch = helper.GetSwitchFromArgs(args) csh.InitSimpleExpressApp(switch) conf['features']['app'] = 'express' conf['app-type'] = 'simple-express-app' config.WriteAppiConfig({"app-type": conf['app-type']}) config.WriteAppiConfig({'features': conf['features']}) return