From 45692d4300a8bf68894438b98db231a40d4faac3 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Tue, 12 Mar 2024 13:55:46 +0530 Subject: [PATCH] Add build_name metadata to build.info file for OCI and Base images Presence of this field helps in determining if the image is an unminimized image, which then can be leveraged in the unminimize script to easily determine the image type. --- live-build/auto/build | 11 +++++++++-- live-build/functions | 7 ------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/live-build/auto/build b/live-build/auto/build index 9911708f..6704327e 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -430,9 +430,16 @@ serial: $BUILDSTAMP EOF fi - if [ "$PROJECT" = "ubuntu-oci" ]; then + if [ "${PROJECT}" = ubuntu-base ] || [ "${PROJECT}" = "ubuntu-oci" ]; then if [ -n "$BUILDSTAMP" ]; then - configure_oci chroot "$BUILDSTAMP" + mkdir -p chroot/etc/cloud + cat > chroot/etc/cloud/build.info << EOF +build_name: $PROJECT:${SUBPROJECT:} +serial: $BUILDSTAMP +EOF + if [ "${PROJECT}" = "ubuntu-oci" ]; then + configure_oci chroot "$BUILDSTAMP" + fi else echo "The \$BUILDSTAMP variable is empty" exit 1 diff --git a/live-build/functions b/live-build/functions index 695344eb..99c4708e 100644 --- a/live-build/functions +++ b/live-build/functions @@ -970,13 +970,6 @@ configure_oci() { Chroot ${chroot} "chmod +x /usr/sbin/policy-rc.d" - # Inject a build stamp into the image - mkdir -p ${chroot}/etc/cloud - cat > ${chroot}/etc/cloud/build.info << EOF -serial: $serial -EOF - - # https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap#L54-L56 Chroot ${chroot} "dpkg-divert --local --rename --add /sbin/initctl" cp -a ${chroot}/usr/sbin/policy-rc.d ${chroot}/sbin/initctl