From abc8399260813e455c45668e1f33ebab7089c940 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti <jviottidc@gmail.com> Date: Wed, 2 Dec 2015 11:15:20 -0400 Subject: [PATCH] Explain why we need the computer password on device init --- build/actions/device.js | 4 +++- build/utils/helpers.js | 3 ++- lib/actions/device.coffee | 7 ++++++- lib/utils/helpers.coffee | 3 ++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/build/actions/device.js b/build/actions/device.js index e112937b..46df8976 100644 --- a/build/actions/device.js +++ b/build/actions/device.js @@ -195,7 +195,9 @@ configure += ' --advanced'; } return capitano.runAsync(configure).then(function() { - return helpers.sudo(['os', 'initialize', temporalPath, '--type', application.device_type]); + var message; + message = 'Initializing a device requires administration permissions\ngiven that we need to access raw devices directly.\n'; + return helpers.sudo(['os', 'initialize', temporalPath, '--type', application.device_type], message); }); }); }).then(function(device) { diff --git a/build/utils/helpers.js b/build/utils/helpers.js index f4714adb..5b8f5c5c 100644 --- a/build/utils/helpers.js +++ b/build/utils/helpers.js @@ -37,8 +37,9 @@ } }; - exports.sudo = function(command) { + exports.sudo = function(command, message) { command = _.union(_.take(process.argv, 2), command); + console.log(message); if (os.platform() !== 'win32') { console.log('Type your computer password to continue'); } diff --git a/lib/actions/device.coffee b/lib/actions/device.coffee index de21e2aa..e864c14f 100644 --- a/lib/actions/device.coffee +++ b/lib/actions/device.coffee @@ -253,8 +253,13 @@ exports.init = configure = "os configure #{temporalPath} #{device.uuid}" configure += ' --advanced' if options.advanced capitano.runAsync(configure).then -> + message = ''' + Initializing a device requires administration permissions + given that we need to access raw devices directly. - helpers.sudo([ 'os', 'initialize', temporalPath, '--type', application.device_type ]) + ''' + + helpers.sudo([ 'os', 'initialize', temporalPath, '--type', application.device_type ], message) .then (device) -> console.log('Done') return device.uuid diff --git a/lib/utils/helpers.coffee b/lib/utils/helpers.coffee index 6496a192..e7f48526 100644 --- a/lib/utils/helpers.coffee +++ b/lib/utils/helpers.coffee @@ -28,8 +28,9 @@ exports.stateToString = (state) -> else throw new Error("Unsupported operation: #{state.operation.type}") -exports.sudo = (command) -> +exports.sudo = (command, message) -> command = _.union(_.take(process.argv, 2), command) + console.log(message) if os.platform() isnt 'win32' console.log('Type your computer password to continue')