constellation/image/base/mkosi.postinst
Malte Poll 1a141c3972
image: add rpm database as build output (#2442)
For reproducibility reasons, the final OS image does not ship the rpm database in sqlite format.
For supply chain security and license compliance reasons, we want to keep the rpm database of os images as a detached build artifact.
We now ship a reproducible, human readable manifest of installed rpms in the image under "/usr/share/constellation/packagemanifest" and upload the full rpm database as a build artifact (rpmdb.tar).
2023-10-17 14:04:41 +02:00

18 lines
731 B
Bash
Executable File

#!/usr/bin/env bash
set -euxo pipefail
# create mountpoints in /etc
mkdir -p "${BUILDROOT}"/etc/{cni,kubernetes}
# move issue files away from /etc
# to allow /run/issue and /run/issue.d to take precedence
mv "${BUILDROOT}/etc/issue.d" "${BUILDROOT}/usr/lib/issue.d" || true
# generate reproducible package manifest
mkdir -p "${BUILDROOT}/usr/share/constellation"
rpm -qa --qf '%{name};%{version};%{license}\n' --dbpath "${BUILDROOT}/var/lib/rpm/" | LC_ALL=C sort | tee "${BUILDROOT}/usr/share/constellation/packagemanifest"
cp "${BUILDROOT}/usr/share/constellation/packagemanifest" "${OUTPUTDIR}/"
# copy rpmdb to outputs
cp "${BUILDROOT}"/var/lib/rpm/{rpmdb.sqlite-wal,rpmdb.sqlite-shm,rpmdb.sqlite,.rpm.lock} "${OUTPUTDIR}/"