mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-18 21:27:51 +00:00
Integrate windosu
This commit is contained in:
parent
7949296cec
commit
9069b07d4a
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// http://coffeescript.org/documentation/docs/register.html
|
||||
require('coffee-script/register')
|
||||
require('../lib/app.coffee')
|
||||
require('coffee-script/register');
|
||||
require('../lib/app.coffee');
|
||||
|
16
bin/resin-write
Normal file
16
bin/resin-write
Normal file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// http://coffeescript.org/documentation/docs/register.html
|
||||
require('coffee-script/register');
|
||||
|
||||
var device = require('../lib/actions/device.coffee');
|
||||
var errors = require('../lib/errors/errors');
|
||||
|
||||
device.init.action({
|
||||
image: process.argv[2],
|
||||
device: process.argv[3]
|
||||
}, {
|
||||
yes: true
|
||||
}, function(error) {
|
||||
return errors.handle(error);
|
||||
});
|
@ -1,4 +1,5 @@
|
||||
_ = require('lodash-contrib')
|
||||
path = require('path')
|
||||
async = require('async')
|
||||
resin = require('resin-sdk')
|
||||
os = require('os')
|
||||
@ -165,7 +166,7 @@ exports.init =
|
||||
options: [ commandOptions.yes ]
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
async.waterfall([
|
||||
async.waterfall [
|
||||
|
||||
(callback) ->
|
||||
if options.yes
|
||||
@ -186,5 +187,11 @@ exports.init =
|
||||
progressBar.tick(status.delta)
|
||||
, callback
|
||||
|
||||
], done)
|
||||
], (error) ->
|
||||
return done(error) if os.platform() isnt 'win32'
|
||||
windosu = require('windosu')
|
||||
|
||||
# Need to escape everypath to avoid errors
|
||||
resinWritePath = "\"#{path.join(__dirname, '..', '..', 'bin', 'resin-write')}\""
|
||||
windosu.exec("node #{resinWritePath} \"#{params.image}\" \"#{params.device}\"").then ->
|
||||
console.log 'Done'
|
||||
|
@ -26,6 +26,9 @@
|
||||
],
|
||||
"author": "Juan Cruz Viotti <juanchiviotti@gmail.com>",
|
||||
"license": "MIT",
|
||||
"optionalDependencies": {
|
||||
"windosu": "^0.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "~1.9.2",
|
||||
"gulp": "~3.8.9",
|
||||
|
Loading…
Reference in New Issue
Block a user