From 1981b97506f6e594291a920ac2a117670f2e37a1 Mon Sep 17 00:00:00 2001 From: RJ Trujillo Date: Fri, 22 Sep 2023 20:07:03 -0600 Subject: [PATCH] feat: Generate image info Provides a useful reference for the state of the current installed image that can be utilized via ublue update for auto-signing or in scripts to determine what changes to make and exclude Also ships jq for parsing generated image information For example... `jq '."image-flavor"' /usr/share/ublue-os/image-info.json` ... would print the flavor of the image (I.E. nvidia) --- Containerfile | 5 ++++- image-info.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100755 image-info.sh diff --git a/Containerfile b/Containerfile index 2c27f2b..0c249f4 100644 --- a/Containerfile +++ b/Containerfile @@ -5,6 +5,8 @@ ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-38}" FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS nvidia ARG IMAGE_NAME="${IMAGE_NAME:-silverblue}" +ARG IMAGE_VENDOR="ublue-os" +ARG IMAGE_FLAVOR="${IMAGE_FLAVOR:-nvidia}" ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-38}" ARG NVIDIA_MAJOR_VERSION="${NVIDIA_MAJOR_VERSION:-535}" @@ -13,7 +15,8 @@ COPY post-install.sh /tmp/post-install.sh COPY --from=ghcr.io/ublue-os/akmods-nvidia:${FEDORA_MAJOR_VERSION}-${NVIDIA_MAJOR_VERSION} /rpms /tmp/akmods-rpms -RUN /tmp/install.sh && \ +RUN /tmp/image-info.sh && \ + /tmp/install.sh && \ /tmp/post-install.sh && \ rm -rf /tmp/* /var/* diff --git a/image-info.sh b/image-info.sh new file mode 100755 index 0000000..b7682b6 --- /dev/null +++ b/image-info.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -oue pipefail + +IMAGE_INFO="/usr/share/ublue-os/image-info.json" +IMAGE_REF="docker://ghcr.io/$IMAGE_VENDOR/$IMAGE_NAME" + +case $FEDORA_MAJOR_VERSION in + 38) + IMAGE_TAG="latest" + ;; + *) + IMAGE_TAG="$FEDORA_MAJOR_VERSION" + ;; +esac + +touch $IMAGE_INFO +cat > $IMAGE_INFO <