Skip to content

Commit

Permalink
feat: Generate image info
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
EyeCantCU committed Sep 23, 2023
1 parent f0314d5 commit a37be04
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ 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

COPY --from=ghcr.io/ublue-os/config:latest /rpms /tmp/rpms

RUN /tmp/nokmods-install.sh && \
RUN /tmp/image-info.sh && \
/tmp/nokmods-install.sh && \
/tmp/nokmods-post-install.sh && \
# temporary fix for https://github.com/containers/podman/issues/19930
rpm-ostree override replace https://bodhi.fedoraproject.org/updates/FEDORA-2023-8d641964bc && \
Expand All @@ -27,6 +31,8 @@ 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 main-install.sh /tmp/main-install.sh
Expand All @@ -35,7 +41,8 @@ COPY --from=ghcr.io/ublue-os/akmods:${FEDORA_MAJOR_VERSION} /rpms /tmp/akmods-rp

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 && \
Expand Down
27 changes: 27 additions & 0 deletions image-info.sh
Original file line number Diff line number Diff line change
@@ -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 <<EOF
{
"image-name": "$IMAGE_NAME",
"image-flavor": "$IMAGE_FLAVOR",
"image-vendor": "$IMAGE_VENDOR",
"image-ref": "$IMAGE_REF",
"image-tag": "$IMAGE_TAG",
"fedora-version": "$FEDORA_MAJOR_VERSION"
}
EOF
1 change: 1 addition & 0 deletions nokmods-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"htop",
"intel-media-driver",
"just",
"jq",
"libheif-tools",
"libratbag-ratbagd",
"libva-intel-driver",
Expand Down

0 comments on commit a37be04

Please sign in to comment.