From 461ec70f0796af15e1468277a1b6f7009e47df95 Mon Sep 17 00:00:00 2001 From: RJ Trujillo Date: Fri, 22 Sep 2023 17:42:58 -0600 Subject: [PATCH 1/2] 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 | 10 +++++++++- image-info.sh | 27 +++++++++++++++++++++++++++ nokmods-packages.json | 1 + 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100755 image-info.sh diff --git a/Containerfile b/Containerfile index 0b3615d7..5e3cff8d 100644 --- a/Containerfile +++ b/Containerfile @@ -6,9 +6,12 @@ ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-38}" FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS nokmods ARG IMAGE_NAME="${IMAGE_NAME:-silverblue}" +ARG IMAGE_VENDOR="ublue-os" +ARG IMAGE_FLAVOR="${IMAGE_FLAVOR:-main}" ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-38}" COPY github-release-install.sh /tmp/github-release-install.sh +COPY image-info.sh /tmp/image-info.sh COPY nokmods-install.sh /tmp/nokmods-install.sh COPY nokmods-post-install.sh /tmp/nokmods-post-install.sh COPY nokmods-packages.json /tmp/nokmods-packages.json @@ -17,6 +20,7 @@ COPY --from=ghcr.io/ublue-os/config:latest /rpms /tmp/rpms RUN wget https://copr.fedorainfracloud.org/coprs/ublue-os/staging/repo/fedora-$(rpm -E %fedora)/ublue-os-staging-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_ublue-os_staging.repo && \ wget https://copr.fedorainfracloud.org/coprs/kylegospo/oversteer/repo/fedora-$(rpm -E %fedora)/kylegospo-oversteer-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_kylegospo_oversteer.repo && \ + /tmp/image-info.sh && \ /tmp/nokmods-install.sh && \ /tmp/nokmods-post-install.sh && \ # temporary fix for https://github.com/containers/podman/issues/19930 @@ -35,15 +39,19 @@ RUN ostree container commit && \ FROM nokmods AS main ARG IMAGE_NAME="${IMAGE_NAME:-silverblue}" +ARG IMAGE_VENDOR="ublue-os" +ARG IMAGE_FLAVOR="${IMAGE_FLAVOR:-main}" ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-38}" +COPY image-info.sh /tmp/image-info.sh COPY main-install.sh /tmp/main-install.sh COPY --from=ghcr.io/ublue-os/akmods:${FEDORA_MAJOR_VERSION} /rpms /tmp/akmods-rpms COPY main-sys_files / -RUN /tmp/main-install.sh && \ +RUN /tmp/image-info.sh && \ + /tmp/main-install.sh && \ rm -rf /tmp/* /var/* RUN ostree container commit && \ diff --git a/image-info.sh b/image-info.sh new file mode 100755 index 00000000..b7682b64 --- /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 < Date: Sun, 24 Sep 2023 06:08:22 +0000 Subject: [PATCH 2/2] fix: use proper image ref --- image-info.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image-info.sh b/image-info.sh index b7682b64..c4c31da7 100755 --- a/image-info.sh +++ b/image-info.sh @@ -3,7 +3,7 @@ set -oue pipefail IMAGE_INFO="/usr/share/ublue-os/image-info.json" -IMAGE_REF="docker://ghcr.io/$IMAGE_VENDOR/$IMAGE_NAME" +IMAGE_REF="ostree-image-signed:docker://ghcr.io/$IMAGE_VENDOR/$IMAGE_NAME" case $FEDORA_MAJOR_VERSION in 38)