From 5a681fd335d29f8db001b359aa3676e28f7211e2 Mon Sep 17 00:00:00 2001 From: Justin Kromlinger Date: Thu, 16 Jun 2022 17:04:25 +0200 Subject: [PATCH] Add date and build number as VERSION_ID to /etc/os-release Resolves #68 --- .gitlab-ci.yml | 1 + Dockerfile.template | 3 ++- Makefile | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8ef78a2..b242b79 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -227,6 +227,7 @@ release: sed -i "s|TEMPLATE_ROOTFS_RELEASE_URL|https://gitlab.archlinux.org/archlinux/archlinux-docker/-/releases/v${BUILD_VERSION}|" output/Dockerfile.${group} sed -i "s|TEMPLATE_ROOTFS_DOWNLOAD|ROOTFS=\"\$(curl -sOJL -w \"%{filename_effective}\" \"${package_url}\")\"|" output/Dockerfile.${group} sed -i "s|TEMPLATE_ROOTFS_HASH|$(cat output/${group}.tar.zst.SHA256)|" output/Dockerfile.${group} + sed -i "s|TEMPLATE_ROOTFS_VERSION|${BUILD_VERSION}|" output/Dockerfile.${group} done - > curl -sSf --request POST -o commit-response.json diff --git a/Dockerfile.template b/Dockerfile.template index fa05397..a25e5e6 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -23,7 +23,8 @@ RUN TEMPLATE_ROOTFS_DOWNLOAD && \ FROM scratch AS root COPY --from=verify /rootfs/ / -RUN ldconfig +RUN ldconfig && \ + sed -i '/BUILD_ID/a VERSION_ID=TEMPLATE_VERSION_ID' /etc/os-release ENV LANG=en_US.UTF-8 CMD ["/usr/bin/bash"] diff --git a/Makefile b/Makefile index 222643d..45928bc 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,7 @@ define dockerfile -e "s|TEMPLATE_ROOTFS_RELEASE_URL|Local build|" \ -e "s|TEMPLATE_ROOTFS_DOWNLOAD|ROOTFS=\"$(1).tar.zst\"|" \ -e "s|TEMPLATE_ROOTFS_HASH|$$(cat $(OUTPUTDIR)/$(1).tar.zst.SHA256)|" \ + -e "s|TEMPLATE_VERSION_ID|dev|" \ Dockerfile.template > $(OUTPUTDIR)/Dockerfile.$(1) endef