diff options
| author | tranch <tranch.xiao@gmail.com> | 2026-08-25 11:41:20 +0800 |
|---|---|---|
| committer | tranch <tranch.xiao@gmail.com> | 2026-08-26 11:38:45 +0800 |
| commit | c42b55f8accfea46263890323f2aedd2142fd515 (patch) | |
| tree | 1ec5ce64d7af5c1b4ce4535305350c2bda1ca165 | |
| parent | ed4bd0d089d41c5d95fe74937acc2a779c6de6d4 (diff) | |
| download | AeroCore-OS-fix/f44-payload-branding.tar.gz AeroCore-OS-fix/f44-payload-branding.zip | |
fix(installer): validate payload on build hostfix/f44-payload-branding
Move payload inspection out of the nested Podman build so local ISO
builds do not require /dev/fuse. Normalize local registry references.
| -rw-r--r-- | installer/Containerfile | 2 | ||||
| -rwxr-xr-x | installer/build.sh | 27 | ||||
| -rwxr-xr-x | just_scripts/build-installer-iso.sh | 29 |
3 files changed, 29 insertions, 29 deletions
diff --git a/installer/Containerfile b/installer/Containerfile index 32b327e..a7f1d3b 100644 --- a/installer/Containerfile +++ b/installer/Containerfile @@ -2,7 +2,7 @@ # The image installed to disk is supplied separately as INSTALL_IMAGE_PAYLOAD. ARG BASE_IMAGE=ghcr.io/ublue-os/bazzite:stable -ARG IMAGE_VENDOR=AeroCore-IO +ARG IMAGE_VENDOR=aerocore-io ARG IMAGE_NAME=aerocore-os ARG INSTALL_IMAGE_PAYLOAD=ghcr.io/${IMAGE_VENDOR}/${IMAGE_NAME}:stable ARG INSTALL_IMAGE_PAYLOAD_ARCHIVE=/install-payload.oci diff --git a/installer/build.sh b/installer/build.sh index dd7b7f5..dda0706 100755 --- a/installer/build.sh +++ b/installer/build.sh @@ -115,33 +115,6 @@ else podman pull "${INSTALL_IMAGE_PAYLOAD}" fi -# Refuse to build an ISO with a payload that still carries Bazzite release -# bytes. bootupd derives its EFI label from system-release during installation; -# a trailing NUL there makes efibootmgr fail before Anaconda can run %post. -podman run --rm --entrypoint /usr/bin/bash "${INSTALL_IMAGE_PAYLOAD}" -ceu ' - system_release=/etc/system-release - system_release_target=$(readlink -f "$system_release") - - if od -An -v -tx1 "$system_release_target" | awk '\''{ for (i = 1; i <= NF; i++) if ($i == "00") found = 1 } END { exit(found ? 0 : 1) }'\''; then - echo "Install payload has a NUL byte in ${system_release_target}" >&2 - od -An -v -tx1 "$system_release_target" >&2 - exit 1 - fi - - expected_prefix="AeroCore OS release $(rpm -E %fedora) (" - system_release_value=$(<"$system_release_target") - case "$system_release_value" in - "$expected_prefix"*) ;; - *) - echo "Install payload has an unexpected system-release: ${system_release_value@Q}" >&2 - exit 1 - ;; - esac - - jq -e '\''.["image-name"] == "aerocore-os" and .["image-vendor"] == "aerocore-io"'\'' \ - /usr/share/ublue-os/image-info.json >/dev/null -' - # Tell Anaconda to install the bootc container that was loaded above. mkdir -p /var/lib/rpm-state cat >> /usr/share/anaconda/interactive-defaults.ks <<EOF diff --git a/just_scripts/build-installer-iso.sh b/just_scripts/build-installer-iso.sh index fb1f6c0..5d40a05 100755 --- a/just_scripts/build-installer-iso.sh +++ b/just_scripts/build-installer-iso.sh @@ -16,7 +16,10 @@ source_image="${image_name}:${image_tag}" # origin instead of persisting the temporary localhost name. OSTREE_IMAGE_REF # is intentionally tagless, matching the image-info contract. image_basename="${image_name##*/}" -ostree_image_ref="${OSTREE_IMAGE_REF:-ostree-image-signed:docker://ghcr.io/${REPO_ORGANIZATION:-AeroCore-IO}/${image_basename}}" +registry_organization="${REPO_ORGANIZATION:-aerocore-io}" +registry_organization="${registry_organization,,}" +ostree_image_ref="${OSTREE_IMAGE_REF:-ostree-image-signed:docker://ghcr.io/${registry_organization}/${image_basename}}" +ostree_image_ref="${ostree_image_ref,,}" install_image_ref="${ostree_image_ref#ostree-image-signed:docker://}" install_image_ref="${install_image_ref#ostree-unverified-registry:docker://}" install_image_ref="${install_image_ref#docker://}" @@ -79,8 +82,32 @@ ensure_rootful_image() { rm -rf "${copy_tmp}" } +validate_install_payload() { + # Run on the build host rather than from installer/Containerfile. Nested + # Podman has no /dev/fuse in the build sandbox, while this check needs to + # mount the payload rootfs to inspect the bootupd label source. + "${podman_cmd[@]}" run --rm --network none --entrypoint /usr/bin/bash \ + "${source_image}" -ceu ' + system_release_target=$(readlink -f /etc/system-release) + if od -An -v -tx1 "$system_release_target" | awk '\''{ for (i = 1; i <= NF; i++) if ($i == "00") found = 1 } END { exit(found ? 0 : 1) }'\''; then + echo "Install payload has a NUL byte in ${system_release_target}" >&2 + exit 1 + fi + case "$(<"$system_release_target")" in + "AeroCore OS release $(rpm -E %fedora) ("*) ;; + *) + echo "Unexpected system-release: $(<"$system_release_target")" >&2 + exit 1 + ;; + esac + jq -e '\''.["image-name"] == "aerocore-os" and .["image-vendor"] == "aerocore-io"'\'' \ + /usr/share/ublue-os/image-info.json >/dev/null + ' +} + mkdir -p "${output_dir}" ensure_rootful_image +validate_install_payload "${podman_cmd[@]}" tag "${source_image}" "${payload}" "${podman_cmd[@]}" save --format oci-archive --output "${payload_archive}" "${payload}" |
