Skip to content

Commit 5717bd9

Browse files
authored
feat: Generate image info (#154)
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)
1 parent 1588c7f commit 5717bd9

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

Containerfile

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@ ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-38}"
55
FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS nvidia
66

77
ARG IMAGE_NAME="${IMAGE_NAME:-silverblue}"
8+
ARG IMAGE_VENDOR="ublue-os"
9+
ARG IMAGE_FLAVOR="${IMAGE_FLAVOR:-nvidia}"
810
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-38}"
911
ARG NVIDIA_MAJOR_VERSION="${NVIDIA_MAJOR_VERSION:-535}"
1012

13+
COPY image-info.sh /tmp/image-info.sh
1114
COPY install.sh /tmp/install.sh
1215
COPY post-install.sh /tmp/post-install.sh
1316

1417
COPY --from=ghcr.io/ublue-os/akmods-nvidia:${FEDORA_MAJOR_VERSION}-${NVIDIA_MAJOR_VERSION} /rpms /tmp/akmods-rpms
1518

16-
RUN /tmp/install.sh && \
19+
RUN /tmp/image-info.sh && \
20+
/tmp/install.sh && \
1721
/tmp/post-install.sh && \
1822
rm -rf /tmp/* /var/*
1923

image-info.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
set -oue pipefail
4+
5+
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
6+
IMAGE_REF="docker://ghcr.io/$IMAGE_VENDOR/$IMAGE_NAME"
7+
8+
case $FEDORA_MAJOR_VERSION in
9+
38)
10+
IMAGE_TAG="latest"
11+
;;
12+
*)
13+
IMAGE_TAG="$FEDORA_MAJOR_VERSION"
14+
;;
15+
esac
16+
17+
touch $IMAGE_INFO
18+
cat > $IMAGE_INFO <<EOF
19+
{
20+
"image-name": "$IMAGE_NAME",
21+
"image-flavor": "$IMAGE_FLAVOR",
22+
"image-vendor": "$IMAGE_VENDOR",
23+
"image-ref": "$IMAGE_REF",
24+
"image-tag": "$IMAGE_TAG",
25+
"fedora-version": "$FEDORA_MAJOR_VERSION"
26+
}
27+
EOF

0 commit comments

Comments
 (0)