Configure and initialize devices using device specs.
The intention of this module is to provide low level access to how Resin.io configures and initialises devices using device specs.
THIS MODULE IS LOW LEVEL AND IS NOT MEANT TO BE USED BY END USERS DIRECTLY.
Install resin-device-init by running:
$ npm install --save resin-device-init- init
- .configure(image, uuid, options) ⇒
Promise.<EventEmitter> - .initialize(image, deviceType, options) ⇒
Promise.<EventEmitter>
- .configure(image, uuid, options) ⇒
This function injects config.json into the device.
Kind: static method of init
Summary: Configure an image with an application
Returns: Promise.<EventEmitter> - configuration event emitter
Access: public
| Param | Type | Description |
|---|---|---|
| image | String |
path to image |
| uuid | String |
device uuid |
| options | Object |
configuration options |
Example
init.configure('my/rpi.img', '7cf02a62a3a84440b1bb5579a3d57469148943278630b17e7fc6c4f7b465c9', network: 'ethernet').then (configuration) ->
configuration.on('stdout', process.stdout.write)
configuration.on('stderr', process.stderr.write)
configuration.on 'state', (state) ->
console.log(state.operation.command)
console.log(state.percentage)
configuration.on 'error', (error) ->
throw error
configuration.on 'end', ->
console.log('Configuration finished')Kind: static method of init
Summary: Initialize an image
Returns: Promise.<EventEmitter> - initialization event emitter
Access: public
| Param | Type | Description |
|---|---|---|
| image | String |
path to image |
| deviceType | String |
device type slug |
| options | Object |
configuration options |
Example
init.initialize('my/rpi.img', 'raspberry-pi', network: 'ethernet').then (configuration) ->
configuration.on('stdout', process.stdout.write)
configuration.on('stderr', process.stderr.write)
configuration.on 'state', (state) ->
console.log(state.operation.command)
console.log(state.percentage)
configuration.on 'burn', (state) ->
console.log(state)
configuration.on 'error', (error) ->
throw error
configuration.on 'end', ->
console.log('Configuration finished')If you're having any problem, please raise an issue on GitHub and the Resin.io team will be happy to help.
Run the test suite by doing:
$ npm test- Issue Tracker: github.com/resin-io/resin-device-init/issues
- Source Code: github.com/resin-io/resin-device-init
Before submitting a PR, please make sure that you include tests, and that coffeelint runs without any warning:
$ gulp lintThe project is licensed under the MIT license.
