DEPRECATED in favor of https://github.com/resin-io/resin-image-fs
Resin.io config.json injection.
Install resin-config-inject by running:
$ npm install --save resin-config-injectWrite 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:
inject.write 'path/to/rpi.img', hello: 'world', 3, (error) ->
throw error if error?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:
inject.read 'path/to/rpi.img', '4:1', (error, config) ->
throw error if error?
console.log(config)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:
inject.writePartition 'path/to/rpi.img', hello: 'world', '4:1', (error, stream) ->
throw error if error?
stream.pipe(anotherStream)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:
4is the primary partition number four.3:1is the first logical partition of the third primary extended partition.
Resin Config Inject exposes a simple CLI tool to interact with the image configuration, mainly for debugging purposes.
Install resin-config-inject globally to access it:
$ npm install -g resin-config-injectThat will add an inject script in your path.
Read and parse the configuration from an image.
Example:
$ inject read path/to/image.img "4:1"Example:
$ cat config.json | inject write path/to/image.img "4:1"Run the test suite by doing:
$ gulp test- 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 lintIf you're having any problem, please raise an issue on GitHub.
- Perform injection in a FAT partition instead of serialising the JSON directly.
- Handle partition definition instead of byte offsets in the public interface.
- Fix incompatibility issues with Node v0.11.
The project is licensed under the MIT license.
