Skip to content

Commit

Permalink
call generate_sbom in mkosi.finalize scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
cschneemann committed May 21, 2024
1 parent 86c4c66 commit b0de77c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions build-recipe-mkosi
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,25 @@ recipe_build_mkosi() {
if [ -n "$RELEASE" ]; then
image_version="--image-version=${RELEASE}"
fi
for format in $(queryconfig --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH" buildflags+ sbom | sort -u) ; do
cat << EOF >> $BUILD_ROOT/$TOPDIR/SOURCES/mkosi.finalize
#!/bin/bash
# script generated by build-receipe-mkosi for sbom buildflags
echo "Generating $format sbom file"
imgname="image.${RELEASE}"
/.build/generate_sbom \
--dist "$BUILD_DIST" \
--configdir "$CONFIG_DIR" \
--archpath "$BUILD_ARCH" \
--format "$format" \
--dir \$BUILDROOT > "$TOPDIR/OTHER/\${imgname}${buildnum}.${format/cyclonedx/cdx}.json"
pushd $TOPDIR/OTHER >/dev/null
/usr/bin/sha256sum "\${imgname}${buildnum}.${format/cyclonedx/cdx}.json" > "\${imgname}${buildnum}.${format/cyclonedx/cdx}.json".sh256
popd >/dev/null
EOF
chmod +x $BUILD_ROOT/$TOPDIR/SOURCES/mkosi.finalize
done

set -- mkosi \
--directory "$TOPDIR/SOURCES" \
--default \
Expand Down

0 comments on commit b0de77c

Please sign in to comment.