mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-07 11:26:41 +00:00
Merge pull request #229 from resin-io/jviotti/feature/os-initialize-type-option
Take device type as an option in os initialize
This commit is contained in:
commit
b6ebd0631a
@ -154,7 +154,7 @@
|
||||
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("os configure " + temporalPath + " " + device.uuid).then(function() {
|
||||
return helpers.sudo(['os', 'initialize', temporalPath, application.device_type]);
|
||||
return helpers.sudo(['os', 'initialize', temporalPath, '--type', application.device_type]);
|
||||
});
|
||||
});
|
||||
}).then(function(device) {
|
||||
|
@ -100,12 +100,18 @@
|
||||
};
|
||||
|
||||
exports.initialize = {
|
||||
signature: 'os initialize <image> <type>',
|
||||
signature: 'os initialize <image>',
|
||||
description: 'initialize an os image',
|
||||
help: 'Use this command to initialize a previously configured operating system image.\n\nExamples:\n\n $ resin os initialize ../path/rpi.img \'raspberry-pi\'',
|
||||
help: 'Use this command to initialize a previously configured operating system image.\n\nExamples:\n\n $ resin os initialize ../path/rpi.img --type \'raspberry-pi\'',
|
||||
permission: 'user',
|
||||
options: [
|
||||
commandOptions.yes, {
|
||||
signature: 'type',
|
||||
description: 'device type',
|
||||
parameter: 'type',
|
||||
alias: 't',
|
||||
required: 'You have to specify a device type'
|
||||
}, {
|
||||
signature: 'drive',
|
||||
description: 'drive',
|
||||
parameter: 'drive',
|
||||
@ -115,7 +121,7 @@
|
||||
root: true,
|
||||
action: function(params, options, done) {
|
||||
console.info('Initializing device');
|
||||
return resin.models.device.getManifestBySlug(params.type).then(function(manifest) {
|
||||
return resin.models.device.getManifestBySlug(options.type).then(function(manifest) {
|
||||
var ref;
|
||||
return (ref = manifest.initialization) != null ? ref.options : void 0;
|
||||
}).then(function(questions) {
|
||||
@ -132,7 +138,7 @@
|
||||
message = "This will erase " + answers.drive + ". Are you sure?";
|
||||
return patterns.confirm(options.yes, message)["return"](answers.drive).then(umount.umountAsync);
|
||||
}).tap(function(answers) {
|
||||
return init.initialize(params.image, params.type, answers).then(stepHandler);
|
||||
return init.initialize(params.image, options.type, answers).then(stepHandler);
|
||||
}).then(function(answers) {
|
||||
if (answers.drive == null) {
|
||||
return;
|
||||
|
@ -74,7 +74,7 @@ Now you have access to all the commands referenced below.
|
||||
|
||||
- [os download <type>](#os-download-60-type-62-)
|
||||
- [os configure <image> <uuid>](#os-configure-60-image-62-60-uuid-62-)
|
||||
- [os initialize <image> <type>](#os-initialize-60-image-62-60-type-62-)
|
||||
- [os initialize <image>](#os-initialize-60-image-62-)
|
||||
|
||||
- Wizard
|
||||
|
||||
@ -426,6 +426,12 @@ Examples:
|
||||
$ resin help apps
|
||||
$ resin help os download
|
||||
|
||||
### Options
|
||||
|
||||
#### --verbose, -v
|
||||
|
||||
show additional commands
|
||||
|
||||
# Information
|
||||
|
||||
## version
|
||||
@ -550,13 +556,23 @@ Examples:
|
||||
|
||||
$ resin os configure ../path/rpi.img 7cf02a62a3a84440b1bb5579a3d57469148943278630b17e7fc6c4f7b465c9
|
||||
|
||||
## os initialize <image> <type>
|
||||
## os initialize <image>
|
||||
|
||||
Use this command to initialize a previously configured operating system image.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin os initialize ../path/rpi.img 'raspberry-pi'
|
||||
$ resin os initialize ../path/rpi.img --type 'raspberry-pi'
|
||||
|
||||
### Options
|
||||
|
||||
#### --yes, -y
|
||||
|
||||
confirm non interactively
|
||||
|
||||
#### --type, -t <type>
|
||||
|
||||
device type
|
||||
|
||||
# Wizard
|
||||
|
||||
|
@ -211,7 +211,7 @@ exports.init =
|
||||
.then(resin.models.device.get)
|
||||
.tap (device) ->
|
||||
capitano.runAsync("os configure #{temporalPath} #{device.uuid}").then ->
|
||||
helpers.sudo([ 'os', 'initialize', temporalPath, application.device_type ])
|
||||
helpers.sudo([ 'os', 'initialize', temporalPath, '--type', application.device_type ])
|
||||
.then (device) ->
|
||||
console.log('Done')
|
||||
return device.uuid
|
||||
|
@ -96,18 +96,25 @@ exports.configure =
|
||||
.nodeify(done)
|
||||
|
||||
exports.initialize =
|
||||
signature: 'os initialize <image> <type>'
|
||||
signature: 'os initialize <image>'
|
||||
description: 'initialize an os image'
|
||||
help: '''
|
||||
Use this command to initialize a previously configured operating system image.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin os initialize ../path/rpi.img 'raspberry-pi'
|
||||
$ resin os initialize ../path/rpi.img --type 'raspberry-pi'
|
||||
'''
|
||||
permission: 'user'
|
||||
options: [
|
||||
commandOptions.yes
|
||||
{
|
||||
signature: 'type'
|
||||
description: 'device type'
|
||||
parameter: 'type'
|
||||
alias: 't'
|
||||
required: 'You have to specify a device type'
|
||||
}
|
||||
{
|
||||
signature: 'drive'
|
||||
description: 'drive'
|
||||
@ -118,7 +125,7 @@ exports.initialize =
|
||||
root: true
|
||||
action: (params, options, done) ->
|
||||
console.info('Initializing device')
|
||||
resin.models.device.getManifestBySlug(params.type)
|
||||
resin.models.device.getManifestBySlug(options.type)
|
||||
.then (manifest) ->
|
||||
return manifest.initialization?.options
|
||||
.then (questions) ->
|
||||
@ -132,7 +139,7 @@ exports.initialize =
|
||||
.return(answers.drive)
|
||||
.then(umount.umountAsync)
|
||||
.tap (answers) ->
|
||||
return init.initialize(params.image, params.type, answers).then(stepHandler)
|
||||
return init.initialize(params.image, options.type, answers).then(stepHandler)
|
||||
.then (answers) ->
|
||||
return if not answers.drive?
|
||||
umount.umountAsync(answers.drive).tap ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user