mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-03-22 12:05:20 +00:00
Merge pull request #38 from resin-io/feature/os-install-umount
Handle device unmounting in os install command
This commit is contained in:
commit
f8380ec8e6
@ -1,5 +1,5 @@
|
||||
(function() {
|
||||
var _, async, commandOptions, elevate, mkdirp, npm, os, packageJSON, path, resin, updateActions, visuals;
|
||||
var _, async, commandOptions, elevate, mkdirp, npm, os, packageJSON, path, resin, umount, updateActions, visuals;
|
||||
|
||||
_ = require('lodash-contrib');
|
||||
|
||||
@ -15,6 +15,8 @@
|
||||
|
||||
visuals = require('resin-cli-visuals');
|
||||
|
||||
umount = require('umount').umount;
|
||||
|
||||
commandOptions = require('./command-options');
|
||||
|
||||
npm = require('../npm');
|
||||
@ -97,7 +99,7 @@
|
||||
exports.install = {
|
||||
signature: 'os install <image> [device]',
|
||||
description: 'write an operating system image to a device',
|
||||
help: 'Use this command to write an operating system image to a device.\n\nNote that this command requires admin privileges.\n\nIf `device` is omitted, you will be prompted to select a device interactively.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nYou can quiet the progress bar by passing the `--quiet` boolean option.\n\nYou may have to unmount the device before attempting this operation.\n\nSee the `drives` command to get a list of all connected devices to your machine and their respective ids.\n\nIn Mac OS X:\n\n $ sudo diskutil unmountDisk /dev/xxx\n\nIn GNU/Linux:\n\n $ sudo umount /dev/xxx\n\nExamples:\n\n $ resin os install rpi.iso /dev/disk2',
|
||||
help: 'Use this command to write an operating system image to a device.\n\nNote that this command requires admin privileges.\n\nIf `device` is omitted, you will be prompted to select a device interactively.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nYou can quiet the progress bar by passing the `--quiet` boolean option.\n\nExamples:\n\n $ resin os install rpi.iso /dev/disk2',
|
||||
options: [commandOptions.yes],
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
@ -131,10 +133,12 @@
|
||||
message = "This will completely erase " + params.device + ". Are you sure you want to continue?";
|
||||
return visuals.patterns.confirm(options.yes, message, callback);
|
||||
}, function(confirmed, callback) {
|
||||
var bar;
|
||||
if (!confirmed) {
|
||||
return done();
|
||||
}
|
||||
return umount(params.device, _.unary(callback));
|
||||
}, function(callback) {
|
||||
var bar;
|
||||
bar = new visuals.widgets.Progress('Writing Device OS');
|
||||
params.progress = _.bind(bar.update, bar);
|
||||
return bundle.write(params, callback);
|
||||
|
@ -675,18 +675,6 @@ You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
You can quiet the progress bar by passing the `--quiet` boolean option.
|
||||
|
||||
You may have to unmount the device before attempting this operation.
|
||||
|
||||
See the `drives` command to get a list of all connected devices to your machine and their respective ids.
|
||||
|
||||
In Mac OS X:
|
||||
|
||||
$ sudo diskutil unmountDisk /dev/xxx
|
||||
|
||||
In GNU/Linux:
|
||||
|
||||
$ sudo umount /dev/xxx
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin os install rpi.iso /dev/disk2
|
||||
|
@ -5,6 +5,7 @@ path = require('path')
|
||||
mkdirp = require('mkdirp')
|
||||
resin = require('resin-sdk')
|
||||
visuals = require('resin-cli-visuals')
|
||||
umount = require('umount').umount
|
||||
commandOptions = require('./command-options')
|
||||
npm = require('../npm')
|
||||
packageJSON = require('../../package.json')
|
||||
@ -108,18 +109,6 @@ exports.install =
|
||||
|
||||
You can quiet the progress bar by passing the `--quiet` boolean option.
|
||||
|
||||
You may have to unmount the device before attempting this operation.
|
||||
|
||||
See the `drives` command to get a list of all connected devices to your machine and their respective ids.
|
||||
|
||||
In Mac OS X:
|
||||
|
||||
$ sudo diskutil unmountDisk /dev/xxx
|
||||
|
||||
In GNU/Linux:
|
||||
|
||||
$ sudo umount /dev/xxx
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin os install rpi.iso /dev/disk2
|
||||
@ -168,7 +157,9 @@ exports.install =
|
||||
|
||||
(confirmed, callback) ->
|
||||
return done() if not confirmed
|
||||
umount(params.device, _.unary(callback))
|
||||
|
||||
(callback) ->
|
||||
bar = new visuals.widgets.Progress('Writing Device OS')
|
||||
params.progress = _.bind(bar.update, bar)
|
||||
bundle.write(params, callback)
|
||||
|
@ -67,6 +67,7 @@
|
||||
"resin-settings-client": "^1.0.0",
|
||||
"resin-vcs": "^1.2.0",
|
||||
"tmp": "^0.0.25",
|
||||
"umount": "^1.0.0",
|
||||
"underscore.string": "~2.4.0",
|
||||
"update-notifier": "^0.3.1"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user