Bläddra i källkod

Updated Elevated shell ops culled out by OS

production
pb 2 år sedan
förälder
incheckning
f86b4c5e61
2 ändrade filer med 44 tillägg och 18 borttagningar
  1. 42
    16
      index.js
  2. 2
    2
      win_verse.js

+ 42
- 16
index.js Visa fil

@@ -49,6 +49,8 @@ function sysAddPathVar(addpath){
etask.statuslog = statuslog
etask.selectedinstance = selectedinstance
etask.processedArgs = processedArgs
etask.runtimestamp = runtimestamp
etask.ENV = ENV
return shell_verse.runElevated(etask)
@@ -355,9 +357,11 @@ var getPullCmd = (repo, branch) => {
return pullCmd
}

var performPull = (repo, branch, repoowner, errHandler) => {
// PB : TODO -- Use queueing with async tasks..
var performPull = (repodef, branch, repoowner, errHandler) => {
// PB : TODO -- Handle no branch passed in case.
// if(!branch) { throw 'No branch specified' }
var repo = repodef.repo;
try{
var exists = existsSync(instanceroot + '/' + repo)
}
@@ -378,7 +382,12 @@ var performPull = (repo, branch, repoowner, errHandler) => {
task.info = { repo }
task.errHandler = errHandler
task.statuslog = statuslog
return shell_verse.runTask( task )
task.processedArgs = processedArgs
task.selectedinstance = selectedinstance
task.runtimestamp = runtimestamp
task.ENV = ENV
if(repodef.requiresElevation) return shell_verse.runElevated( task )
else return shell_verse.runTask( task )
}
else {
console.log('cloning ' + repo)
@@ -405,15 +414,24 @@ var performPull = (repo, branch, repoowner, errHandler) => {
task.info = { repo }
task.errHandler = errHandler
task.statuslog = statuslog
return shell_verse.runTask( task )
task.processedArgs = processedArgs
task.selectedinstance = selectedinstance
task.runtimestamp = runtimestamp
task.ENV = ENV
if(repodef.requiresElevation) return shell_verse.runElevated( task )
else return shell_verse.runTask( task )
})
}
task.info = { repo }
task.errHandler = errHandler
task.statuslog = statuslog
return shell_verse.runTask( task )
task.processedArgs = processedArgs
task.selectedinstance = selectedinstance
task.runtimestamp = runtimestamp
task.ENV = ENV
if(repodef.requiresElevation) return shell_verse.runElevated( task )
else return shell_verse.runTask( task )
}
}

@@ -1014,9 +1032,9 @@ var op = {
// console.dir(env)
console.log('Running exlr pull : ' + path.dirname(__dirname))

if (!processedArgs.runas) gitRepos.map((def) => performPull(def.repo, def.branch || 'master'))
if (!processedArgs.runas) gitRepos.map((def) => performPull(def, def.branch || 'master'))
var etask = ()=>{
return any(elevatedRunasRepos.map((def) => performPull(def.repo, def.branch || 'master'))).then(() => {
return any(elevatedRunasRepos.map((def) => performPull(def, def.branch || 'master'))).then(() => {
fs.writeFileSync('run.done', 'success')
}).catch(() => {
fs.writeFileSync('run.done', 'error')
@@ -1025,6 +1043,8 @@ var op = {
etask.statuslog = statuslog
etask.selectedinstance = selectedinstance
etask.processedArgs = processedArgs
etask.runtimestamp = runtimestamp
etask.ENV = ENV
return shell_verse.runElevated(etask)
}

@@ -1525,6 +1545,8 @@ var op = {
etask.statuslog = statuslog
etask.selectedinstance = selectedinstance
etask.processedArgs = processedArgs
etask.runtimestamp = runtimestamp
etask.ENV = ENV
return shell_verse.runElevated(etask)
}

@@ -2087,6 +2109,8 @@ var cmds = {
etask.statuslog = statuslog
etask.selectedinstance = selectedinstance
etask.processedArgs = processedArgs
etask.runtimestamp = runtimestamp
etask.ENV = ENV
return shell_verse.runElevated(etask)
}
, noprerequisites : true
@@ -2263,8 +2287,9 @@ var elxr = {
if(def.repo) {
// Single repo case.
if(def.repo.requiresElevation) {
getElevatedTask
var t1 = function() {
return performPull(def.repo).then(() => {
return performPull(def).then(() => {
return true;
}).catch((e) => {
console.error(e)
@@ -2277,7 +2302,7 @@ var elxr = {
}
else {
var t2 = function(){
return performPull(def.repo).then(() => {
return performPull(def).then(() => {
return true;
}).catch((e) => {
console.error(e)
@@ -2311,7 +2336,8 @@ var elxr = {
var regularpulltasks = function(){ return Promise.resolve(true) }
if(def.elevated){
elevatedpulltasks = function() {
return any(def.elevated.map((def) => performPull(def.repo))).then(() => {
// shell_verse.getElevatedTask( t1 )
return any(def.elevated.map((def) => performPull(def))).then(() => {
return true;
}).catch((e) => {
console.error(e)
@@ -2322,7 +2348,7 @@ var elxr = {
if(def.repos) {
var regularpulltasks = function(){
var pendingpulls = [];
def.repos.forEach((def) => { pendingpulls.push(performPull(def.repo)) })
def.repos.forEach((def) => { pendingpulls.push(performPull(def)) })
return Promise.all(pendingpulls).finally(Traq.finally)
}
regularpulltasks.statuslog = statuslog
@@ -2576,7 +2602,7 @@ function resetgitconfig(){
// git config --edit --system
// git config --global credential.helper "store --file ~/gitcredentials"
// git credential fill
// git credential-store --file ~/git.store store
// git credential-store --file ~/git.store store
// Find system git config
// git config --global --edit
@@ -2721,7 +2747,7 @@ var __acquireConfig = function (selected, owner, clusternodename, configrepo, er
ENV.NODE_ENV = selectedinstance.node_env;
}

return performPull(configrepo, null, owner, errHandler || errorHandler || ((e)=>{ throw e })).then( successHandler )
return performPull({repo : configrepo}, null, owner, errHandler || errorHandler || ((e)=>{ throw e })).then( successHandler )
.catch( (e)=>{
// if(e){
if(Promise.resolve(e) === e) return e;
@@ -2791,7 +2817,7 @@ var __acquireData = function (selected, owner, clusternodename, datarepo, errHan

}

return performPull(datarepo, null, owner, errHandler || errorHandler || ((e)=>{ throw e })).then( successHandler )
return performPull({ repo : datarepo }, null, owner, errHandler || errorHandler || ((e)=>{ throw e })).then( successHandler )
.catch( (e)=>{
// if(e){
if(Promise.resolve(e) === e) return e;
@@ -2934,8 +2960,8 @@ var __default = ((name, options)=>{
, { repo : 'ember-sw-client-route' }
, { repo : 'global-this' }
]
, elevated : [ { repo : 'chess-server-lib' } ]
// Requires elevation only in windows
, elevated : [ { repo : 'chess-server-lib', requiresElevation : true } ]
, exludeMergeRepos : { }
}


+ 2
- 2
win_verse.js Visa fil

@@ -138,7 +138,7 @@ var shell_verse = {
console.log('result : ' + JSON.stringify(r))
Object.keys(processedArgs).forEach((v) => { v != '_' ? namedArgs.push('--' + v + '=' + processedArgs[v]) : null; })
// PB : TODO -- Convert all the cli args back to string.
var args = [`${selectedinstance.root}/.elxr/run-${runtimestamp}/windowselevate.hta`].concat(processedArgs._)
var args = [`${selectedinstance.root}/.elxr/run-${taskToRun.runtimestamp}/windowselevate.hta`].concat(processedArgs._)
namedArgs.length > 0 ? args = args.concat(namedArgs.join(' ')) : null;
args.push('--runas=self');
// args.push('--nodepath=' + r.messages[r.messages.length - 1])
@@ -153,7 +153,7 @@ var shell_verse = {
, {
inherit: true
, shell: true
, env: ENV
, env: taskToRun.ENV
, runas: 'self'
, title: `runas`
}

Laddar…
Avbryt
Spara