|
| 1 | +# Features |
| 2 | + |
| 3 | +Each feature must at least contain an `info.yaml` file |
| 4 | + |
| 5 | +The `info.yaml` file has the following structure fields: |
| 6 | + |
| 7 | +- `description`: (*optional*) a string explaining what this feature does / what it is used for. |
| 8 | +- `type`: can be any of `platform`, `element`, or `flag`. The builder does not make any technical distinction between each type of feature, however it is strongly encouraged that each image uses exactly one platform and flags should only perform minor changes and not include any other features. |
| 9 | +- `features`: (*optional*) sub-structure containing related features |
| 10 | + - `include`: (*optional*) list of features that will automatically be included as well if this feature gets included |
| 11 | + - `exclude`: (*optional*) list of features that are incompatible with this feature. If any of these features were included implicitly from another they will be removed from the feature set. If they were explicitly provided as part of the target the build will fail. |
| 12 | + |
| 13 | +An example `info.yaml` looks as follows: |
| 14 | + |
| 15 | +```yaml |
| 16 | +description: example platform feature |
| 17 | +type: platform |
| 18 | +features: |
| 19 | + include: |
| 20 | + - A |
| 21 | + - B |
| 22 | + exclude: |
| 23 | + - C |
| 24 | +``` |
| 25 | +
|
| 26 | +Additionally a feature may contain any of the following: |
| 27 | +
|
| 28 | +## `pkg.include` |
| 29 | + |
| 30 | +A list of packages to be installed into the image. |
| 31 | + |
| 32 | +## `pkg.exclude` |
| 33 | + |
| 34 | +A list of packages to be ignored if provided by another features `pkg.include` |
| 35 | + |
| 36 | +## `file.include` |
| 37 | + |
| 38 | +A directory containing files to copy into the target rootfs. |
| 39 | +This directory is copied recursively into the root directory. |
| 40 | +By default only the executable bit of the files permission will be preserved when copying. |
| 41 | +The other permissions will be set to read write for owner and read for group and other. |
| 42 | +The owner of all copied files will be root by default. |
| 43 | + |
| 44 | +To overwrite these defaults see `file.stat` below |
| 45 | + |
| 46 | +## `file.stat` |
| 47 | + |
| 48 | +A file to assign owner and permissions to files copied by `file.include`. |
| 49 | +Each line should contain an entry of the form: |
| 50 | + |
| 51 | +``` |
| 52 | +user group permissions file |
| 53 | +``` |
| 54 | + |
| 55 | +## `file.exclude` |
| 56 | + |
| 57 | +A list of files / directories to remove from the rootfs at the end of the configure stage. |
| 58 | +Wildcard in file paths are allowed. |
| 59 | + |
| 60 | +## `exec.config` `exec.early` `exec.late` `exec.post` |
| 61 | + |
| 62 | +Scripts to be executed to configure the image. |
| 63 | +All scripts except `exec.post` are executed inside the rootfs of the system being build without any parameters. |
| 64 | +`exec.post` is executed inside the builder container with the path of the rootfs provided as `argv[1]`. |
| 65 | + |
| 66 | +The order of exectution is as follows: |
| 67 | + |
| 68 | +- bootstrap (outside chroot) |
| 69 | +- `exec.early` |
| 70 | +- package install (from `pkg.include`) |
| 71 | +- copy files from `file.include` and set permissions according to `file.stat` |
| 72 | +- `exec.config` |
| 73 | +- `exec.late` |
| 74 | +- remove files according to `file.exclude` |
| 75 | +- `exec.post` (outside chroot) |
| 76 | + |
| 77 | +When building with multiple features the execution steps of each feature are interleaved; so for example the `exec.config` step will run for all features before any features `exec.late` runs. |
0 commit comments