Skip to content

Commit 3e75c59

Browse files
committed
feat(eif): embed os-release into rpm2eif rootfs
Mirror the os-release append that rpm2img performs, so EIF-built rootfs images expose the same identifying fields (VERSION, PRETTY_NAME, VARIANT_ID, VERSION_ID, BUILD_ID, VENDOR_NAME, and the canonical URLs) to userspace. Unlike rpm2img, INSTALL_ROOT already points at the merged sysroot, so the append writes directly to ${INSTALL_ROOT}/usr/lib/os-release without the ${ARCH}-bottlerocket-linux-gnu/sys-root prefix.
1 parent 9323b0a commit 3e75c59

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

twoliter/embedded/rpm2eif

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,28 @@ ENCRYPTED_STORAGE=false
361361
STANDALONE_IMAGE=true
362362
EOF
363363

364+
echo "=== Embedding os-release ==="
365+
# Append Bottlerocket variant, version, and build metadata to
366+
# /usr/lib/os-release, mirroring the corresponding block in rpm2img so that
367+
# EIF-built rootfs images expose the same identifying fields (VARIANT_ID,
368+
# VERSION_ID, BUILD_ID, VENDOR_NAME, ...) to userspace. Unlike rpm2img, EIF
369+
# variants have INSTALL_ROOT already pointing at the merged sysroot, so
370+
# there is no `${ARCH}-bottlerocket-linux-gnu/sys-root` prefix.
371+
VERSION="${VERSION_ID} (${VARIANT})"
372+
# shellcheck disable=SC2154 # PROJECT_VENDOR/PRETTY_NAME come from the build env.
373+
cat <<EOF >>"${INSTALL_ROOT}/usr/lib/os-release"
374+
VERSION="${VERSION}"
375+
PRETTY_NAME="${PRETTY_NAME} ${VERSION}"
376+
VARIANT_ID=${VARIANT}
377+
VERSION_ID=${VERSION_ID}
378+
BUILD_ID=${BUILD_ID}
379+
VENDOR_NAME="${PROJECT_VENDOR}"
380+
HOME_URL="https://github.com/bottlerocket-os/bottlerocket"
381+
SUPPORT_URL="https://github.com/bottlerocket-os/bottlerocket/discussions"
382+
BUG_REPORT_URL="https://github.com/bottlerocket-os/bottlerocket/issues"
383+
DOCUMENTATION_URL="https://bottlerocket.dev"
384+
EOF
385+
364386
echo "=== Creating rootfs.erofs ==="
365387
# Remove only the top-level /boot from rootfs (kernel is shipped separately).
366388
[[ -d "${INSTALL_ROOT}/boot" ]] && rm -rf "${INSTALL_ROOT}/boot"

0 commit comments

Comments
 (0)