@@ -13,6 +13,11 @@ FLAVOR=${4:?flavor required}
1313SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:? }
1414export SOURCE_DATE_EPOCH TZ=UTC LC_ALL=C
1515mkdir -p " $OUT /files"
16+ TREE_RUNNER=" $SELF /scripts/run-in-tree.sh"
17+ TOOLS_TREE=${DSTACK_TOOLS_TREE:- $SELF / mkosi.tools}
18+ [[ -x $TOOLS_TREE /usr/bin/mksquashfs ]] || {
19+ echo " mksquashfs missing from pinned mkosi tools tree" >&2 ; exit 1;
20+ }
1621
1722kernel=" $KERNEL_TREE /usr/lib/modules/$KERNEL_VERSION -dstack/vmlinuz"
1823install -m0644 " $kernel " " $OUT /files/bzImage"
@@ -25,13 +30,17 @@ truncate -s 0 "$rootfs"
2530# Privileged mkosi runs can inherit host default ACLs from their workspace.
2631# The guest rootfs does not rely on xattrs, so exclude this host-only metadata.
2732# A single compressor worker also avoids host-CPU-dependent fragment ordering.
28- env -u SOURCE_DATE_EPOCH mksquashfs " $TREE " " $rootfs " -noappend -all-root -no-progress \
33+ env -u SOURCE_DATE_EPOCH " $TREE_RUNNER " " $TOOLS_TREE " /usr/bin/mksquashfs \
34+ " $TREE " " $rootfs " -noappend -all-root -no-progress \
2935 -no-xattrs -processors 1 -comp zstd -mkfs-time " $SOURCE_DATE_EPOCH " \
3036 -all-time " $SOURCE_DATE_EPOCH " > /dev/null
3137data_size=$( stat -c %s " $rootfs " )
3238data_size=$(( (data_size + 4095 ) / 4096 * 4096 ))
3339truncate -s " $data_size " " $rootfs "
34- verity_output=$( veritysetup format " $rootfs " " $rootfs " \
40+ verity_program=$( find " $TREE " -type f \( -path ' */sbin/veritysetup' -o \
41+ -path ' */bin/veritysetup' \) -printf ' /%P\n' | head -1)
42+ [[ -n $verity_program ]] || { echo ' veritysetup missing from mkosi tree' >&2 ; exit 1; }
43+ verity_output=$( " $TREE_RUNNER " " $TREE " " $verity_program " format " $rootfs " " $rootfs " \
3544 --hash-offset=" $data_size " --data-block-size=4096 --hash-block-size=4096 \
3645 --uuid=00000000-0000-0000-0000-000000000000 \
3746 --salt=" $( printf ' %064x' 0) " )
0 commit comments