Skip to content

Commit

Permalink
feat: Generate image info for auto-signing via ublue-update
Browse files Browse the repository at this point in the history
Generates information specific to the image being built. This is used
for auto-signing via ublue-update but also has other practical purposes
such as distuingishing which flavor or base may be in use
  • Loading branch information
EyeCantCU committed Sep 22, 2023
1 parent 079ad21 commit 3a8f3a9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ ARG TARGET_BASE="${TARGET_BASE:-bluefin}"
## bluefin image section
FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS bluefin

ARG IMAGE_NAME="${IMAGE_NAME}"
ARG IMAGE_VENDOR="ublue-os"
ARG BASE_IMAGE_NAME="${BASE_IMAGE_NAME}"
ARG IMAGE_FLAVOR="${IMAGE_FLAVOR}"
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION}"
ARG PACKAGE_LIST="bluefin"

COPY usr /usr
COPY etc/yum.repos.d/ /etc/yum.repos.d/
COPY packages.json /tmp/packages.json
COPY build.sh /tmp/build.sh
COPY image-info.sh /tmp/image-info.sh

# Exclude gnome-vrr from F39
RUN if grep -qv "39" <<< "${FEDORA_MAJOR_VERSION}"; then \
Expand All @@ -35,6 +40,7 @@ RUN curl -Lo /tmp/starship.tar.gz "https://github.com/starship/starship/releases
echo 'eval "$(starship init bash)"' >> /etc/bashrc

RUN /tmp/build.sh && \
/tmp/image-info.sh && \
pip install --prefix=/usr yafti && \
systemctl enable rpm-ostree-countme.service && \
systemctl enable tailscaled.service && \
Expand All @@ -56,6 +62,10 @@ RUN /tmp/build.sh && \
## bluefin-dx developer edition image section
FROM bluefin AS bluefin-dx

ARG IMAGE_NAME="${IMAGE_NAME}"
ARG IMAGE_VENDOR="ublue-os"
ARG BASE_IMAGE_NAME="${BASE_IMAGE_NAME}"
ARG IMAGE_FLAVOR="${IMAGE_FLAVOR}"
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION}"
ARG PACKAGE_LIST="bluefin-dx"

Expand All @@ -65,6 +75,7 @@ COPY dx/etc/yum.repos.d/ /etc/yum.repos.d/
COPY workarounds.sh /tmp/workarounds.sh
COPY packages.json /tmp/packages.json
COPY build.sh /tmp/build.sh
COPY image-info.sh /tmp/image-info.sh

# Apply IP Forwarding before installing Docker to prevent messing with LXC networking
RUN sysctl -p
Expand All @@ -74,6 +85,7 @@ RUN wget https://copr.fedorainfracloud.org/coprs/bobslept/nerd-fonts/repo/fedora

# Handle packages via packages.json
RUN /tmp/build.sh
RUN /tmp/image-info.sh

RUN wget https://github.com/docker/compose/releases/latest/download/docker-compose-linux-x86_64 -O /tmp/docker-compose && \
install -c -m 0755 /tmp/docker-compose /usr/bin
Expand Down
26 changes: 26 additions & 0 deletions image-info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

set -oue pipefail

IMAGE_REF="docker://ghcr.io/$IMAGE_VENDOR/$IMAGE_NAME"

case $FEDORA_MAJOR_VERSION in
38)
IMAGE_TAG="latest"
;;
*)
IMAGE_TAG="$FEDORA_MAJOR_VERSION"
;;
esac

{
echo "{"
echo '"image-name": "'"$IMAGE_NAME"'",'
echo '"image-flavor": "'"$IMAGE_FLAVOR"'",'
echo '"image-vendor": "'"$IMAGE_VENDOR"'",'
echo '"image-ref": "'"$IMAGE_REF"'",'
echo '"image-tag":"'"$IMAGE_TAG"'",'
echo '"base-image-name": "'"$BASE_IMAGE_NAME"'",'
echo '"fedora-version": "'"$FEDORA_MAJOR_VERSION"'"'
echo "}"
} > "/usr/share/ublue-os/image-info.json"

0 comments on commit 3a8f3a9

Please sign in to comment.