Skip to content

Commit

Permalink
feat: Generate image info for auto-signing via ublue-update (#511)
Browse files Browse the repository at this point in the history
Co-authored-by: Jorge O. Castro <jorge.castro@gmail.com>
  • Loading branch information
EyeCantCU and castrojo committed Sep 23, 2023
1 parent 898d654 commit 85d5284
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ 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"

Expand All @@ -16,6 +20,7 @@ COPY just/custom.just /tmp/just/custom.just
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 @@ -36,6 +41,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 @@ -58,6 +64,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 @@ -67,6 +77,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 @@ -76,6 +87,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
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

cat > $IMAGE_INFO <<EOF
{
"image-name": "$IMAGE_NAME",
"image-flavor": "$IMAGE_FLAVOR",
"image-vendor": "$IMAGE_VENDOR",
"image-ref": "$IMAGE_REF",
"image-tag":"$IMAGE_TAG",
"base-image-name": "$BASE_IMAGE_NAME",
"fedora-version": "$FEDORA_MAJOR_VERSION"
}
EOF

0 comments on commit 85d5284

Please sign in to comment.