-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
254 lines (203 loc) · 9.88 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
## mkswu
Helper to generate swupdate image.
Options can be set with swdesc_option.
Multiple options can be passed in same command as separate arguments.
swdesc_option PUBKEY=<path>
path to certificate for signing, if multiple are given the later
are added to device's /etc/swupdate.pem if UPDATE_CERTS is set.
swdesc_option UPDATE_CERTS=<value>
whether to update swupdate.pem on device with certificates defined in
PUBKEY. Unset is no.
swdesc_option PRIVKEY=<path>
path to key for signing
swdesc_option PRIVKEY_PASS=<value>
passphrase for private key, see openssl(1) "Pass Phrase Options" for
examples (e.g. file:pathname)
swdesc_option ENCRYPT_KEYFILE=<path>
encrypt input files if set, generated if does not exist on first use
swdesc_option DESCRIPTION=<value>
arbitrary description string. Displayed in verbose swupdate run.
swdesc_option BOOT_SIZE=<size>
pad boot image with zeros up to this size (clear env)
set to blank to keep original file size.
swdesc_option POST_ACTION=<value>
control behaviour post install. <value> must be one of:
- empty or reboot (default): reboot into new system after updating
- poweroff: shut system down after install (useful for provisioning)
- container: if the update has no system component, restart only
containers without rebooting the system.
If system files were updated reboot normally.
- wait: wait forever after update for an external reboot signal.
Note further updates will not be installed in this mode:
the system MUST reboot before installing the next update.
swdesc_option NOTIFY_STARTING_CMD=<cmd>
swdesc_option NOTIFY_FAIL_CMD=<cmd>
swdesc_option NOTIFY_SUCCESS_CMD=<cmd>
Commands to run when the update starts installing something,
finished on an error, or installed successfully (success is
mostly useful for POST_ACTION=wait)
Note none of these commands run if the signature was not verified
successfully (arbitrary execution of untrusted file is bad), nor
if the update is considered already installed or somehow fails before
the version check.
swdesc_option FORCE_VERSION
allow building image with no explicit version set.
(components with no versions will always be installed)
Note that to avoid install loops with USB drive install,
updates with FORCE_VERSION set will be renamed to
<original_name>.swu.installed after successful install
unless POST_ACTION=poweroff
swdesc_option CONTAINER_CLEAR
if set, swupdate will kill running containers and
remove any running containers from appfs and
/etc/atmark/containers/*.conf before continuing install.
/!\ if install fails this will leave your system
with no application, usage is discouraged /!\
swdesc_option NO_PRESERVE_FILES
if set, swupdate will not copy files listed in
/etc/swupdate_preserve_files when base_os is updated
This option is deprecated until a proper way of running
'first boot'-style scripts is available.
swdesc_option ROOTFS_FSTYPE={ext4,btrfs}
filesystem to use for /
By default the same as current fs is reused.
swdesc_option SKIP_APP_SUBVOL_SYNC
(for test only) skip btrfs subvolume sync command that
slows down tests
swdesc_option ALLOW_EMPTY_LOGIN
(for test only) allow update to install if user passwords have not been set
swdesc_option ALLOW_PUBLIC_CERT
(for test only) allow update to install if no user certificate has been
installed, in which case public cert is left enabled
swdesc_option BUILD_SBOM=<mode>
- no (default): do not create sbom
- auto: create sbom if make_sbom.sh command is present
- yes: create sbom
swdesc_option sbom_config_yaml=<path>
Specify config.yaml to use for create sbom. Default use /usr/share/make-sbom/config/config.yaml.
Common options for all helpers:
--version <component> <version>
We define arbitrary components for swupdate to only install update
if required.
- Updates are installed only if version is higher than what is on
the system, or if not present on the system, except for "boot"
which is installed if different
- Components can be defined freely for updates referring to
containers (container image or files within volumes);
if an update writes to rootfs then it must be named "base_os"
(in which case OS is wiped first) or extra_os* (in which case
the OS is copied over first)
- In most case component/version can be skipped, then "$component"
and "$version" variables will be used. component defaults to the
desc file's basename (e.g. 'foo.desc' would be 'foo'), but version
has no default and must explicitly be set unless FORCE_VERSION
is set in which case file will always be reinstalled.
--extra-os
prefix component with 'extra_os.' to get root filesystem mounted
read-write. This is not required if version is set explicitly,
and has no effect if set before version.
--base-os
set component to 'base_os'. This is intended for OS updates only.
--install-if <mode>
mode can be one of higher or different.
Can also set the "install_if" environment variable.
This can be used to override the behaviour described above and
force either mode, in particular hawkbit only supports different
mode so one might want to enable this globally.
--version-ignore
Explicitly do not set any version for this command. It will be installed
every time if and only if the swu would be installed.
See the FORCE_VERSION global option or --version-force if you would like
to install the SWU again every time.
--version-force
This is the same as --version-ignore, except that it also enforce the
SWU installation like `swdesc_option FORCE_VERSION` would.
--main-version
Tag this component's name/version as image's main version.
Only used for image managements (e.g. around hawkbit) which will
normally only consider the first one to be set
--description
Alternate text that will be printed when swu is installing this step
Additionally, these options can be used on "command-running commands"
(e.g. swdesc_command, swdesc_script and swdesc_exec):
--stdout-info
Redirect command stdout to info fd if available; this allows displaying
command outputs more easily
--container
Run the command in given container image instead of install target chroot.
In this case the install target is mounted as /target
Images are then built progressively by calling the following helpers:
swdesc_boot <bootfile>
Include boot file, version is automatically set from file if not set
swdesc_tar <tar file> [--dest <dest>] [--preserve-attributes]
Extract <tar file> at <path> within new system.
Destination path must be within /var/app/(rollback/)?volumes
unless rootfs is targeted (see <component> in Glossary), and defaults
to / for os versions and /var/app/rollback/volumes otherwise
(relative paths for non-os versions are assumed relative to
/var/app/rollback/volumes)
Owner and mode are lost (except execute) unless --preserve-attributes
is set
swdesc_files [--basedir <basedir>] [--dest <dest>] <file> [<more files>]
Copy files into <dest> (same defaults as swdesc_tar), as they
are relative to <basedir>
basedir defaults to the first argument if it is a directory (assumes
single argument: all the directory content will be extracted to <dest>),
or the first argument's parent otherwise.
swdesc_command "<cmd>"
Run command inside new root
swdesc_script <script>
Run script inside new root
swdesc_exec <file> <command>
Run command with <file> available as $1 inside the new root
Note that this is run in the order swdesc is built, so adding
a swdesc_exec before e.g. base_os will run before the target
OS is setup and likely not work
In doubt use swdesc_script unless you need to send data this way.
swdesc_command_nochroot, swdesc_script_nochroot, swdesc_exec_nochroot
Same as the above but from the currently running os point of view.
You probably do not need this.
swdesc_embed_container <image archive>
Include image and load it into storage
swdesc_usb_container <image archive>
Sign image archive and will look for it on USB drive to
install with USB update. The image and .sig must be copied
to the root of the USB drive together with the swu
Note that podman cannot handle compressed image without storing
an extra uncompressed copy, so it is best to keep that image
uncompressed (not a problem for embedding as swupdate does
the decompressing step)
swdesc_pull_container <image url>
Pull container from network into storage
swdesc_sbom_source_file <path>
Specify source file to add to sbom.
## podman_partial_image
Generate image file from tags or image ids.
If a base image/tag is given, remove objects from image file that
were used in base image.
## genkey.sh
Generate a private/public key pair to use for rsa pss signing of files.
generated files:
- swupdate.key is the private signing key that should be kept private.
- swupdate.pem should be installed to /etc/swupdate.pem and is used
for verification of sw-description and container images if side-loaded.
Note that encryption does not use this key.
Only here for compatibility, please use mkswu --genkey instead
## docs
Extra documentation files e.g. common error patterns
## examples
Sample config files, try from git root:
./mkswu -o foo.swu examples/foo.conf
read each .conf file for their requirements (files to pre-create)
all examples expect keys to have been generated before (./genkey.sh),
in default path, and public key must be installed on device to use.
## bash completion
Bash completion is available for some commands, if you use bash
just source it or copy to /etc/bash_completion.d:
. bash_completion.sh
sudo cp bash_completion.sh /etc/bash_completion.d/swupdate-mkimage
## tests
conf files in the test directory will use internal variables to
disable part or all the scripts, allowing to test specific components
of the system.
Please do not rely on these and ask for supporting features you need!