mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-20 22:23:07 +00:00
Allow advanced option in device init
This option is inherited to `os configure`.
This commit is contained in:
parent
ff81c1e514
commit
f2507daa09
@ -143,7 +143,14 @@
|
|||||||
signature: 'device init',
|
signature: 'device init',
|
||||||
description: 'initialise a device with resin os',
|
description: 'initialise a device with resin os',
|
||||||
help: 'Use this command to download the OS image of a certain application and write it to an SD Card.\n\nNotice this command may ask for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n\n $ resin device init\n $ resin device init --application MyApp',
|
help: 'Use this command to download the OS image of a certain application and write it to an SD Card.\n\nNotice this command may ask for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n\n $ resin device init\n $ resin device init --application MyApp',
|
||||||
options: [commandOptions.optionalApplication, commandOptions.yes],
|
options: [
|
||||||
|
commandOptions.optionalApplication, commandOptions.yes, {
|
||||||
|
signature: 'advanced',
|
||||||
|
description: 'enable advanced configuration',
|
||||||
|
boolean: true,
|
||||||
|
alias: 'v'
|
||||||
|
}
|
||||||
|
],
|
||||||
permission: 'user',
|
permission: 'user',
|
||||||
primary: true,
|
primary: true,
|
||||||
action: function(params, options, done) {
|
action: function(params, options, done) {
|
||||||
@ -163,7 +170,12 @@
|
|||||||
};
|
};
|
||||||
return Promise.using(download(), function(temporalPath) {
|
return Promise.using(download(), function(temporalPath) {
|
||||||
return capitano.runAsync("device register " + application.app_name).then(resin.models.device.get).tap(function(device) {
|
return capitano.runAsync("device register " + application.app_name).then(resin.models.device.get).tap(function(device) {
|
||||||
return capitano.runAsync("os configure " + temporalPath + " " + device.uuid).then(function() {
|
var configure;
|
||||||
|
configure = "os configure " + temporalPath + " " + device.uuid;
|
||||||
|
if (options.advanced) {
|
||||||
|
configure += ' --advanced';
|
||||||
|
}
|
||||||
|
return capitano.runAsync(configure).then(function() {
|
||||||
return helpers.sudo(['os', 'initialize', temporalPath, '--type', application.device_type]);
|
return helpers.sudo(['os', 'initialize', temporalPath, '--type', application.device_type]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -317,6 +317,10 @@ application name
|
|||||||
|
|
||||||
confirm non interactively
|
confirm non interactively
|
||||||
|
|
||||||
|
#### --advanced, -v
|
||||||
|
|
||||||
|
enable advanced configuration
|
||||||
|
|
||||||
# Environment Variables
|
# Environment Variables
|
||||||
|
|
||||||
## envs
|
## envs
|
||||||
|
@ -198,6 +198,12 @@ exports.init =
|
|||||||
options: [
|
options: [
|
||||||
commandOptions.optionalApplication
|
commandOptions.optionalApplication
|
||||||
commandOptions.yes
|
commandOptions.yes
|
||||||
|
{
|
||||||
|
signature: 'advanced'
|
||||||
|
description: 'enable advanced configuration'
|
||||||
|
boolean: true
|
||||||
|
alias: 'v'
|
||||||
|
}
|
||||||
]
|
]
|
||||||
permission: 'user'
|
permission: 'user'
|
||||||
primary: true
|
primary: true
|
||||||
@ -218,7 +224,10 @@ exports.init =
|
|||||||
capitano.runAsync("device register #{application.app_name}")
|
capitano.runAsync("device register #{application.app_name}")
|
||||||
.then(resin.models.device.get)
|
.then(resin.models.device.get)
|
||||||
.tap (device) ->
|
.tap (device) ->
|
||||||
capitano.runAsync("os configure #{temporalPath} #{device.uuid}").then ->
|
configure = "os configure #{temporalPath} #{device.uuid}"
|
||||||
|
configure += ' --advanced' if options.advanced
|
||||||
|
capitano.runAsync(configure).then ->
|
||||||
|
|
||||||
helpers.sudo([ 'os', 'initialize', temporalPath, '--type', application.device_type ])
|
helpers.sudo([ 'os', 'initialize', temporalPath, '--type', application.device_type ])
|
||||||
.then (device) ->
|
.then (device) ->
|
||||||
console.log('Done')
|
console.log('Done')
|
||||||
|
Loading…
Reference in New Issue
Block a user