resin-config-inject
Resin.io config.json injection.
Installation
Install resin-config-inject
by running:
$ npm install --save resin-config-inject
Documentation
inject.write(String image, Object config, Partition partition, Function callback)
Write a config object to an image.
See the Partition Definition section for more information about the partition parameter.
The callback gets passed one argument: (error)
.
Example:
injectwrite 'path/to/rpi.img'hello: 'world'3 throw error if error?
inject.read(String image, Partition partition, Function callback)
Read a config object from an image.
See the Partition Definition section for more information about the partition parameter.
The callback gets passed two arguments: (error, config)
.
Example:
injectread 'path/to/rpi.img''4:1' throw error if error? consolelogconfig
inject.writePartition(String image, Object config, Partition partition, Function callback)
Write a config object to a partition, and return a ReadableStream
of the partition.
The callback gets passed two arguments: (error, stream)
.
The partition is extracted into a temporary file. Once the returned stream emits
the close
event, the temporary file is removed.
Example:
injectwritePartition 'path/to/rpi.img'hello: 'world''4:1' throw error if error? streampipeanotherStream
Partition Definition
A partition definition is a number or string representing the primary partition number, or an extended partition number along with a logical partition number.
Notice that this definition is device dependent. Refer to specific device bundles for this information.
Examples:
4
is the primary partition number four.3:1
is the first logical partition of the third primary extended partition.
Tests
Run the test suite by doing:
$ gulp test
Contribute
- Issue Tracker: github.com/resin-io/resin-config-inject/issues
- Source Code: github.com/resin-io/resin-config-inject
Before submitting a PR, please make sure that you include tests, and that coffeelint runs without any warning:
$ gulp lint
Support
If you're having any problem, please raise an issue on GitHub.
ChangeLog
v3.0.0
- Perform injection in a FAT partition instead of serialising the JSON directly.
v2.0.0
- Handle partition definition instead of byte offsets in the public interface.
v1.0.1
- Fix incompatibility issues with Node v0.11.
License
The project is licensed under the MIT license.