File tree Expand file tree Collapse file tree 6 files changed +23
-27
lines changed Expand file tree Collapse file tree 6 files changed +23
-27
lines changed Original file line number Diff line number Diff line change @@ -51,11 +51,6 @@ podman build \
51
51
BASE_ID=" $( sed s/sha256:// tmp/base.iid) "
52
52
${CFSCTL} oci pull containers-storage:${BASE_ID}
53
53
BASE_IMAGE_FSVERITY=" $( ${CFSCTL} oci compute-id --bootable " ${BASE_ID} " ) "
54
-
55
- mkdir -p " tmp/sysroot/state/${BASE_IMAGE_FSVERITY} /etc/work"
56
- mkdir -p " tmp/sysroot/state/${BASE_IMAGE_FSVERITY} /etc/upper"
57
- mkdir -p " tmp/sysroot/state/${BASE_IMAGE_FSVERITY} /var"
58
-
59
54
${CFSCTL} oci prepare-boot " ${BASE_ID} " --bootdir tmp/efi
60
55
61
56
OPTIONS=" console=ttyS0,115200 composefs=${BASE_IMAGE_FSVERITY} rw"
Original file line number Diff line number Diff line change @@ -58,11 +58,6 @@ FINAL_IMAGE_FSVERITY="$(${CFSCTL} oci compute-id --bootable "${FINAL_ID}")"
58
58
59
59
# # IMPORTANT: the filesystems of the base and final images are identical
60
60
test " ${BASE_IMAGE_FSVERITY} " = " ${FINAL_IMAGE_FSVERITY} "
61
-
62
- mkdir -p " tmp/sysroot/state/${BASE_IMAGE_FSVERITY} /etc/work"
63
- mkdir -p " tmp/sysroot/state/${BASE_IMAGE_FSVERITY} /etc/upper"
64
- mkdir -p " tmp/sysroot/state/${BASE_IMAGE_FSVERITY} /var"
65
-
66
61
${CFSCTL} oci prepare-boot " ${FINAL_ID} " --bootdir tmp/efi
67
62
68
63
../common/install-systemd-boot
Original file line number Diff line number Diff line change @@ -48,12 +48,6 @@ podman build \
48
48
49
49
IMAGE_ID=" $( sed s/sha256:// tmp/iid) "
50
50
${CFSCTL} oci pull containers-storage:" ${IMAGE_ID} "
51
- IMAGE_FSVERITY=" $( ${CFSCTL} oci compute-id --bootable " ${IMAGE_ID} " ) "
52
-
53
- mkdir -p " tmp/sysroot/state/${IMAGE_FSVERITY} /etc/work"
54
- mkdir -p " tmp/sysroot/state/${IMAGE_FSVERITY} /etc/upper"
55
- mkdir -p " tmp/sysroot/state/${IMAGE_FSVERITY} /var"
56
-
57
51
${CFSCTL} oci prepare-boot " ${IMAGE_ID} " --bootdir tmp/efi
58
52
59
53
# install a signed copy of systemd-boot
Original file line number Diff line number Diff line change @@ -30,12 +30,6 @@ podman build \
30
30
31
31
IMAGE_ID=" $( sed s/sha256:// tmp/iid) "
32
32
${CFSCTL} oci pull containers-storage:" ${IMAGE_ID} "
33
- IMAGE_FSVERITY=" $( ${CFSCTL} oci compute-id --bootable " ${IMAGE_ID} " ) "
34
-
35
- mkdir -p " tmp/sysroot/state/${IMAGE_FSVERITY} /etc/work"
36
- mkdir -p " tmp/sysroot/state/${IMAGE_FSVERITY} /etc/upper"
37
- mkdir -p " tmp/sysroot/state/${IMAGE_FSVERITY} /var"
38
-
39
33
${CFSCTL} oci prepare-boot " ${IMAGE_ID} " --bootdir tmp/efi
40
34
41
35
../common/install-systemd-boot
Original file line number Diff line number Diff line change 1
- use std:: { path:: PathBuf , sync:: Arc } ;
1
+ use std:: {
2
+ fs:: create_dir_all,
3
+ path:: { Path , PathBuf } ,
4
+ sync:: Arc ,
5
+ } ;
2
6
3
7
use anyhow:: Result ;
4
8
use clap:: { Parser , Subcommand } ;
@@ -249,7 +253,19 @@ async fn main() -> Result<()> {
249
253
ref bootdir,
250
254
} => {
251
255
let verity = verity_opt ( config_verity) ?;
252
- oci:: prepare_boot ( & repo, config_name, verity. as_ref ( ) , bootdir) ?;
256
+ let id = oci:: prepare_boot ( & repo, config_name, verity. as_ref ( ) , bootdir) ?;
257
+
258
+ let state = args
259
+ . repo
260
+ . as_ref ( )
261
+ . map ( |p : & PathBuf | p. parent ( ) . unwrap ( ) )
262
+ . unwrap_or ( Path :: new ( "/sysroot" ) )
263
+ . join ( "state" )
264
+ . join ( id. to_hex ( ) ) ;
265
+
266
+ create_dir_all ( state. join ( "var" ) ) ?;
267
+ create_dir_all ( state. join ( "etc/upper" ) ) ?;
268
+ create_dir_all ( state. join ( "etc/work" ) ) ?;
253
269
}
254
270
} ,
255
271
Command :: ComputeId {
Original file line number Diff line number Diff line change @@ -370,13 +370,13 @@ pub fn prepare_boot<ObjectID: FsVerityHashValue>(
370
370
name : & str ,
371
371
verity : Option < & ObjectID > ,
372
372
output_dir : & Path ,
373
- ) -> Result < ( ) > {
373
+ ) -> Result < ObjectID > {
374
374
let ( config, refs) = open_config ( repo, name, verity) ?;
375
375
376
376
/* TODO: check created image ID against composefs label on container, if set */
377
377
/* TODO: check created image ID against composefs= .cmdline in UKI or loader entry */
378
378
let mut fs = crate :: oci:: image:: create_filesystem ( repo, name, verity) ?;
379
- fs. commit_image ( repo, None ) ?;
379
+ let id = fs. commit_image ( repo, None ) ?;
380
380
381
381
/*
382
382
let layer_digest = config
@@ -403,7 +403,9 @@ pub fn prepare_boot<ObjectID: FsVerityHashValue>(
403
403
. root
404
404
. get_directory ( "composefs-meta/boot" . as_ref ( ) ) ?;
405
405
406
- write_to_path ( repo, boot, output_dir)
406
+ write_to_path ( repo, boot, output_dir) ?;
407
+
408
+ Ok ( id)
407
409
}
408
410
409
411
#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments