You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/dotetch/readme.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,23 +6,24 @@ Entry is `index.ts`
6
6
7
7
You're responsible for managing the lifecycle :
8
8
9
-
1. call `prepareEtchStream` passing a writable stream (i.e. response to an http query), it will return a "PackStream" [which is a `pack` from tar-stream](https://github.com/mafintosh/tar-stream) and a manifest.
10
-
2. call `startEtchStream` with those mandatory parameters :
9
+
1. call `prepareEtchStream` with a manifest, it will return a "PackStream" [which is a `pack` from tar-stream](https://github.com/mafintosh/tar-stream).
10
+
2. pipe the stream from 1. to an output `packStream.pipe(outputStream)` (output stream can be a file, a http response, ...)
11
+
3. call `startEtchStream` with those mandatory parameters :
11
12
-`packStream` (from previous step)
12
13
-`baseImageStream` readable stream for the baseimage (either .img or a .img in a zip),
13
14
-`baseImageSize` size of the baseImage in bytes,
14
15
-`baseImageName` name of the baseImage file
15
16
16
-
3. wait for 2 to finish streaming the baseImage
17
-
4. stream any number of file you want to inject using `PackStream` from step 1. Those files will be injected on top of the base image's by etcher at flash. You need to place them at the right place in the stream which is :
17
+
4. wait for 2 to finish streaming the baseImage
18
+
5. stream any number of file you want to inject using `PackStream` from step 1. Those files will be injected on top of the base image's by etcher at flash. You need to place them at the right place in the stream which is :
18
19
`/inject/**partitionNumber**/path/to/file`. At flash time, `/inject/` will be dropped and `**partitionNumber**` will determine in which partition your files will be written `/path/to/file` is relative to the root of that partition. You can use any function availble on a `tar-stream pack` (writing files, symlinks, hardlinks, folders, setting permissions, etc. ). Note that you don't need to spcecifically create folders before putting files in it, they will be created if they don't exist.
19
20
20
21
Note that there's a few helper function in the lib:
21
22
-`promisePacker` which wraps `tar-stream.pack` in a promise so you can `await` it
22
23
-`streamFiles` which lets you easily inject arbitrary files
23
24
-`streamDockerAssets` which takes a list of docker images (and credentials) and stream them (cf section about docker)
24
25
25
-
5. call `closeEtchStream` to properly close the tar stream.
26
+
6. call `closeEtchStream` to properly close the tar stream.
26
27
27
28
## Usage with Docker / Balena
28
29
This whole .etch feature has been developed by [balena](https://www.balena.io) in order to permet automatic preloading of balenaOS images with a user application (made of multiple docker images).
0 commit comments