| // WScript.Echo('-val=' + WScript.Arguments.Named(argEnumerator.item()) + '=val-') // Value | // WScript.Echo('-val=' + WScript.Arguments.Named(argEnumerator.item()) + '=val-') // Value | ||||
| // } | // } | ||||
| // cscript elxr/i.win.js /all:true | |||||
| var all = WScript.Arguments.Named('all'); | var all = WScript.Arguments.Named('all'); | ||||
| console = { | console = { | ||||
| var downloadtasks = []; | var downloadtasks = []; | ||||
| var installtasks = []; | var installtasks = []; | ||||
| prerequisites.forEach(function(preq) { | prerequisites.forEach(function(preq) { | ||||
| WScript.Echo(all) | |||||
| if(!all && preq.optional) return | if(!all && preq.optional) return | ||||
| var p = preq.exists().then(function(exists) { | var p = preq.exists().then(function(exists) { | ||||
| if (exists) console.log( preq.shellcmd + ' exists'); | if (exists) console.log( preq.shellcmd + ' exists'); | ||||
| , installcmd: ['MSIEXEC.exe', ['/i' | , installcmd: ['MSIEXEC.exe', ['/i' | ||||
| , path.normalize(downloadsdir + '/' + 'python-2.7.18.amd64.msi') | , path.normalize(downloadsdir + '/' + 'python-2.7.18.amd64.msi') | ||||
| , 'ACCEPT=YES', '/passive']] | , 'ACCEPT=YES', '/passive']] | ||||
| // , preinstallsteps : function() { return Promise.resolve(true) } | |||||
| , preinstallsteps: function() { | |||||
| var self = this; | |||||
| console.log(self.shellcmd + ' preinstall steps') | |||||
| console.log(selectedinstance.root + '/.elxr/run-' + runtimestamp + '/download.bat' + ' ' + self.url + ' ' + downloadsdir + '/' + self.installer) | |||||
| var steps = []; | |||||
| steps.push( | |||||
| function(){ | |||||
| if (!existsSync(downloadsdir + '/' + self.installer)) { | |||||
| console.log(selectedinstance.root + '/.elxr/run-' + runtimestamp + '/download.bat', [self.url, downloadsdir + '/' + self.installer]) | |||||
| return nodeShellExec(selectedinstance.root + '/.elxr/run-' + runtimestamp + '/download.bat', [self.url, downloadsdir + '/' + self.installer] | |||||
| , { waitmsg : 'downloading ' + self.shellcmd + ' please wait' }) | |||||
| } | |||||
| else { | |||||
| console.log(self.installer + ' Already exits Download skipped.') | |||||
| return Promise.resolve(true) | |||||
| } | |||||
| } | |||||
| ) | |||||
| return any(steps) | |||||
| // return any([any(steps), any(prompts)]) | |||||
| } | |||||
| , preinstallsteps : function() { return Promise.resolve(true) } | |||||
| , install : function() { | , install : function() { | ||||
| var self = this; | var self = this; | ||||
| var ifns = [self.installcmd] | var ifns = [self.installcmd] | ||||
| , '/VERYSILENT' | , '/VERYSILENT' | ||||
| // , '/MERGETASKS=!runcode' // This is required only for vscode... | // , '/MERGETASKS=!runcode' // This is required only for vscode... | ||||
| ]] | ]] | ||||
| // , preinstallsteps : function() { return Promise.resolve(true) } | |||||
| , preinstallsteps : function() { return Promise.resolve(true) } | |||||
| , install : function() { | |||||
| var self = this; | |||||
| var ifns = [self.installcmd] | |||||
| if(!ifns.map) ifns.map = map; | |||||
| console.log('Installing') | |||||
| return any(ifns.map(callsheltask))['catch'](function(e){ | |||||
| if(e.code === 1602) { | |||||
| console.warn("Installation was probably cancelled.") | |||||
| } | |||||
| else throw e | |||||
| }).then(function(){ | |||||
| return self.postinstallsteps() | |||||
| }) | |||||
| } | |||||
| , postinstallsteps : function() { return sysAddPathVar('%USERPROFILE%\\AppData/Local\\Microsoft\\WindowsApps') } | |||||
| , exists : exists | |||||
| } | |||||
| , { | |||||
| shellcmd: 'mysql', | |||||
| url: 'https://dev.mysql.com/get/Downloads/MySQLInstaller/mysql-installer-community-8.0.29.0.msi' | |||||
| , installer: 'mysql-installer-community-8.0.29.0.msi' | |||||
| , installcmd: ['MSIEXEC.exe', ['/i' | |||||
| , path.normalize(downloadsdir + '/' + 'mysql-installer-community-8.0.29.0.msi') | |||||
| , 'ACCEPT=YES', '/passive']] | |||||
| , install : function() { | |||||
| var self = this; | |||||
| var ifns = [self.installcmd] | |||||
| if(!ifns.map) ifns.map = map; | |||||
| return any(ifns.map(callsheltask))['catch'](function(e){ | |||||
| if(e.code === 1602) { | |||||
| console.warn("Installation was probably cancelled.") | |||||
| } | |||||
| else throw e | |||||
| }) | |||||
| } | |||||
| , exists : exists | |||||
| , preinstallsteps: function() { | , preinstallsteps: function() { | ||||
| var self = this; | var self = this; | ||||
| console.log(self.shellcmd + ' preinstall steps') | |||||
| console.log(selectedinstance.root + '/.elxr/run-' + runtimestamp + '/download.bat' + ' ' + self.url + ' ' + downloadsdir + '/' + self.installer) | |||||
| console.log('mysql preinstall steps') | |||||
| var steps = []; | var steps = []; | ||||
| steps.push( | steps.push( | ||||
| function(){ | function(){ | ||||
| if (!existsSync(downloadsdir + '/' + self.installer)) { | if (!existsSync(downloadsdir + '/' + self.installer)) { | ||||
| console.log(selectedinstance.root + '/.elxr/run-' + runtimestamp + '/download.bat', [self.url, downloadsdir + '/' + self.installer]) | |||||
| return nodeShellExec(selectedinstance.root + '/.elxr/run-' + runtimestamp + '/download.bat', [self.url, downloadsdir + '/' + self.installer] | return nodeShellExec(selectedinstance.root + '/.elxr/run-' + runtimestamp + '/download.bat', [self.url, downloadsdir + '/' + self.installer] | ||||
| , { waitmsg : 'downloading ' + self.shellcmd + ' please wait' }) | |||||
| , { waitmsg : 'downloading mysql please wait' }) | |||||
| } | } | ||||
| else { | else { | ||||
| console.log(self.installer + ' Already exits Download skipped.') | console.log(self.installer + ' Already exits Download skipped.') | ||||
| return any(steps) | return any(steps) | ||||
| // return any([any(steps), any(prompts)]) | // return any([any(steps), any(prompts)]) | ||||
| } | } | ||||
| , install : function() { | |||||
| var self = this; | |||||
| var ifns = [self.installcmd] | |||||
| if(!ifns.map) ifns.map = map; | |||||
| console.log('Installing') | |||||
| return any(ifns.map(callsheltask))['catch'](function(e){ | |||||
| if(e.code === 1602) { | |||||
| console.warn("Installation was probably cancelled.") | |||||
| } | |||||
| else throw e | |||||
| }).then(function(){ | |||||
| return self.postinstallsteps() | |||||
| }) | |||||
| } | |||||
| , postinstallsteps : function() { return sysAddPathVar('%USERPROFILE%\\AppData/Local\\Microsoft\\WindowsApps') } | |||||
| , exists : exists | |||||
| } | } | ||||
| , { | , { | ||||
| shellcmd: 'elxr' | shellcmd: 'elxr' |