cp "/usr/src/packages/SOURCES/$(basename "${SIG%roothash.sig}osrelease")" mkosi.repart/usr/lib/os-release
ARGS+=(--root="$PWD"/mkosi.repart)
fi
+
+ if jq -r '.SplitArtifacts[]' "$MKOSI_CONFIG" | grep -q partitions; then
+ # Need to recreate the split artifact and compress it if needed
+ ARGS+=(--split=yes)
+ split=1
+ fi
systemd-repart "${ARGS[@]}"
rm -rf mkosi.repart
if ((recompress)); then
zstd --force "$OUTPUTDIR/$(basename "${SIG%roothash.sig}")"raw*
rm -f "$OUTPUTDIR/$(basename "${SIG%roothash.sig}raw")" "$OUTPUTDIR/$(basename "${SIG%roothash.sig}raw.img")"
+ if ((split)); then
+ zstd --force "$OUTPUTDIR/$(basename "${SIG%roothash.sig}")"*-verity-sig.*.raw
+ # sd-repart will split out all partitions again
+ rm -f "$OUTPUTDIR/$(basename "${SIG%roothash.sig}")"usr-*.raw \
+ "$OUTPUTDIR/$(basename "${SIG%roothash.sig}")"root-*.raw \
+ "$OUTPUTDIR/$(basename "${SIG%roothash.sig}")"esp.raw
+ fi
fi
# Do not publish the roothash here, as importctl and friends will mistake it as the roothash of the .raw image
if (( ${#AUTHVARS[@]} > 0 )); then
for ddi in "$OUTPUTDIR"/*.raw*; do
test -f "$ddi" || continue
+ # Skip over split artifacts, if any
+ [[ "$ddi" =~ \.usr- ]] && continue
+ [[ "$ddi" =~ \.root- ]] && continue
+ [[ "$ddi" =~ -verity ]] && continue
if [[ $ddi == *.zst ]]; then
unzstd "${ddi}"
# Handle bootloaders separately from UKIs
for ddi in "${DDIS[@]}"; do
test -f "$ddi" || continue
+ # Skip over split artifacts, if any
+ [[ "$ddi" =~ \.usr- ]] && continue
+ [[ "$ddi" =~ \.root- ]] && continue
+ [[ "$ddi" =~ -verity ]] && continue
+
if [[ $ddi == *.zst ]]; then
unzstd "${ddi}"
fi
cpio -t <"$OUTPUTDIR/hashes.cpio.rsasign"
# The second stage will not do a full rebuild, but only attach signatures to the existing UKI
+# Remember whether we need to split out the verity signature partition, as it's generated later
+if jq -r '.SplitArtifacts[]' "$MKOSI_CONFIG" | grep -q partitions; then
+ split="SplitArtifacts=partitions"
+fi
cat >"$OUTPUTDIR/mkosi.conf" <<EOF
[Distribution]
Distribution=custom
[Output]
Format=none
ImageId=$IMAGE_ID
+${split:-}
[Include]
Include=mkosi-obs
[Build]