diff --git a/build/utils/helpers.js b/build/utils/helpers.js index a8adad61..b970e8bd 100644 --- a/build/utils/helpers.js +++ b/build/utils/helpers.js @@ -74,7 +74,7 @@ exports.getManifest = function(image, deviceType) { }; exports.osProgressHandler = function(step) { - var bar, rindle, visuals; + var progressBars, rindle, visuals; rindle = require('rindle'); visuals = require('resin-cli-visuals'); step.on('stdout', process.stdout.write.bind(process.stdout)); @@ -85,7 +85,12 @@ exports.osProgressHandler = function(step) { } return console.log(exports.stateToString(state)); }); - bar = new visuals.Progress('Writing Device OS'); - step.on('burn', bar.update.bind(bar)); + progressBars = { + write: new visuals.Progress('Writing Device OS'), + check: new visuals.Progress('Validating Device OS') + }; + step.on('burn', function(state) { + return progressBars[state.type].update(state); + }); return rindle.wait(step); }; diff --git a/lib/actions/local/flash.coffee b/lib/actions/local/flash.coffee index 8814cb30..5714405a 100644 --- a/lib/actions/local/flash.coffee +++ b/lib/actions/local/flash.coffee @@ -79,6 +79,8 @@ module.exports = # otherwise the question will not be asked because # `false` is a defined value. yes: options.yes || undefined + + # TODO: dedupe with the resin-device-operations .then (answers) -> if answers.yes isnt true console.log(chalk.red.bold('Aborted image flash')) diff --git a/lib/actions/os.coffee b/lib/actions/os.coffee index ac427326..963238b6 100644 --- a/lib/actions/os.coffee +++ b/lib/actions/os.coffee @@ -245,6 +245,22 @@ exports.initialize = ]) .then (answers) -> return if not answers.drive? + + # TODO: resin local makes use of ejectAsync, see below + # DO we need this / should we do that here? + + # getDrive = (drive) -> + # driveListAsync().then (drives) -> + # selectedDrive = _.find(drives, device: drive) + + # if not selectedDrive? + # throw new Error("Drive not found: #{drive}") + + # return selectedDrive + # if (os.platform() is 'win32') and selectedDrive.mountpoint? + # ejectAsync = Promise.promisify(require('removedrive').eject) + # return ejectAsync(selectedDrive.mountpoint) + umountAsync(answers.drive).tap -> console.info("You can safely remove #{answers.drive} now") .nodeify(done) diff --git a/lib/utils/helpers.coffee b/lib/utils/helpers.coffee index 5cfd5390..7ec2c737 100644 --- a/lib/utils/helpers.coffee +++ b/lib/utils/helpers.coffee @@ -83,8 +83,11 @@ exports.osProgressHandler = (step) -> return if state.operation.command is 'burn' console.log(exports.stateToString(state)) - bar = new visuals.Progress('Writing Device OS') + progressBars = + write: new visuals.Progress('Writing Device OS') + check: new visuals.Progress('Validating Device OS') - step.on('burn', bar.update.bind(bar)) + step.on 'burn', (state) -> + progressBars[state.type].update(state) return rindle.wait(step) diff --git a/package.json b/package.json index 73b1cccc..8d8c8b10 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "resin-cli-visuals": "^1.3.0", "resin-config-json": "^1.0.0", "resin-device-config": "^3.0.0", - "resin-device-init": "^2.1.0", + "resin-device-init": "^2.2.0", "resin-image-fs": "^2.1.2", "resin-image-manager": "^4.1.0", "resin-sdk-preconfigured": "^0.1.1", @@ -75,5 +75,8 @@ "unzip2": "^0.2.5", "update-notifier": "^0.6.1", "valid-email": "^0.0.2" + }, + "optionalDependencies": { + "removedrive": "^1.0.0" } }