mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-18 18:56:25 +00:00
Prevent writing accidentally to system drives
This commit is contained in:
parent
7c53b35cbd
commit
9c98adb712
@ -1,3 +1,5 @@
|
||||
_ = require('lodash')
|
||||
async = require('async')
|
||||
visuals = require('resin-cli-visuals')
|
||||
drivelist = require('drivelist')
|
||||
|
||||
@ -15,7 +17,12 @@ exports.list =
|
||||
drivelist.list (error, drives) ->
|
||||
return done(error) if error?
|
||||
|
||||
console.log visuals.widgets.table.horizontal drives, [
|
||||
async.reject drives, drivelist.isSystem, (removableDrives) ->
|
||||
|
||||
if _.isEmpty(removableDrives)
|
||||
return done(new Error('No removable devices available'))
|
||||
|
||||
console.log visuals.widgets.table.horizontal removableDrives, [
|
||||
'device'
|
||||
'description'
|
||||
'size'
|
||||
|
@ -109,7 +109,15 @@ exports.install =
|
||||
|
||||
(callback) ->
|
||||
return callback(null, params.device) if params.device?
|
||||
visuals.patterns.selectDrive(callback)
|
||||
|
||||
# TODO: See if we can reuse the drives action somehow here
|
||||
visuals.patterns.selectDrive (error, device) ->
|
||||
return callback(error) if error?
|
||||
|
||||
if not device?
|
||||
return callback(new Error('No removable devices available'))
|
||||
|
||||
return callback(null, device)
|
||||
|
||||
(device, callback) ->
|
||||
params.device = device
|
||||
|
@ -52,7 +52,7 @@
|
||||
"coffee-script": "~1.8.0",
|
||||
"conf.js": "^0.1.1",
|
||||
"diskio": "^1.0.0",
|
||||
"drivelist": "^1.1.1",
|
||||
"drivelist": "^1.2.0",
|
||||
"git-cli": "~0.8.2",
|
||||
"lodash": "~2.4.1",
|
||||
"lodash-contrib": "~241.4.14",
|
||||
|
Loading…
Reference in New Issue
Block a user