From 4dd41315acaa07112864a3833dfb7775d9b44274 Mon Sep 17 00:00:00 2001 From: tranch Date: Fri, 24 Jul 2026 17:29:04 +0800 Subject: Rename live installer to installer ISO Use installer ISO terminology across Just, workflows, scripts, docs, and image payloads while preserving compatibility aliases for existing commands. --- .github/workflows/build-installer-iso.yml | 180 ++++++++++++++++++++++++++ .github/workflows/build-live-installer.yml | 180 -------------------------- .github/workflows/validate-installer-iso.yml | 40 ++++++ .github/workflows/validate-live-installer.yml | 40 ------ Justfile | 21 +-- README.md | 8 +- installer/Containerfile | 2 +- installer/iso.yaml | 6 +- just_scripts/build-installer-iso.sh | 122 +++++++++++++++++ just_scripts/build-live-installer.sh | 122 ----------------- just_scripts/run-installer-iso.sh | 23 ++++ just_scripts/run-live-installer.sh | 23 ---- 12 files changed, 386 insertions(+), 381 deletions(-) create mode 100644 .github/workflows/build-installer-iso.yml delete mode 100644 .github/workflows/build-live-installer.yml create mode 100644 .github/workflows/validate-installer-iso.yml delete mode 100644 .github/workflows/validate-live-installer.yml create mode 100755 just_scripts/build-installer-iso.sh delete mode 100755 just_scripts/build-live-installer.sh create mode 100755 just_scripts/run-installer-iso.sh delete mode 100755 just_scripts/run-live-installer.sh diff --git a/.github/workflows/build-installer-iso.yml b/.github/workflows/build-installer-iso.yml new file mode 100644 index 0000000..cfa7b80 --- /dev/null +++ b/.github/workflows/build-installer-iso.yml @@ -0,0 +1,180 @@ +name: Build installer ISO + +on: + workflow_dispatch: + inputs: + image_tag: + description: "AeroCore image tag to install" + required: false + default: latest + type: string + workflow_call: + workflow_run: + workflows: + - Build container image + types: + - completed + branches: + - main + +permissions: {} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + build-installer-iso: + name: Build KDE installer ISO + if: github.event_name != 'workflow_run' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push') + runs-on: ubuntu-24.04 + permissions: + contents: read + packages: read + + env: + IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} + IMAGE_TAG: ${{ inputs.image_tag || 'latest' }} + ISO_FILE_TAG: ${{ github.ref_name == 'testing' && 'testing' || (inputs.image_tag || 'latest') }} + # Keep these aligned with the Fedora major used by the target bazzite-deck base image. + LIVE_BASE_IMAGE: quay.io/fedora/fedora-kinoite:43 + FEDORA_VERSION: "43" + + steps: + - name: Maximize build space + uses: ublue-os/remove-unwanted-software@cc0becac701cf642c8f0a6613bbdaf5dc36b259e # v9 + with: + remove-codeql: true + + - name: Mount container storage BTRFS loopback + run: | + sudo truncate -s 70G /mnt/podman-storage.img + sudo mkfs.btrfs -f /mnt/podman-storage.img + sudo podman system reset --force + sudo systemctl stop podman.service + sudo mount -o compress-force=zstd:2 /mnt/podman-storage.img /var/lib/containers/storage + sudo systemctl start podman.service + + - name: Checkout + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 + + - name: Install just + uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4 + + - name: Prepare image references + run: | + image_name="$(just image_name)" + image_registry="${IMAGE_REGISTRY,,}" + echo "IMAGE_NAME=${image_name,,}" >> "$GITHUB_ENV" + echo "IMAGE_REGISTRY=${image_registry}" >> "$GITHUB_ENV" + + - name: Login to GHCR + run: | + echo '${{ secrets.GITHUB_TOKEN }}' | sudo podman login ghcr.io \ + --username '${{ github.actor }}' --password-stdin + + - name: Pull AeroCore install image + run: | + sudo podman pull "${IMAGE_REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}" + + - name: Build installer ISO payload + run: | + mkdir -p output + sudo podman tag \ + "${IMAGE_REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}" \ + localhost/aerocore-installer-payload:latest + sudo podman save \ + --format oci-archive \ + --output output/install-payload.oci \ + localhost/aerocore-installer-payload:latest + + sudo podman build \ + --cap-add sys_admin \ + --security-opt label=disable \ + --build-arg "BASE_IMAGE=${LIVE_BASE_IMAGE}" \ + --build-arg "INSTALL_IMAGE_PAYLOAD=localhost/aerocore-installer-payload:latest" \ + --build-arg "INSTALL_IMAGE_PAYLOAD_ARCHIVE=/install-payload.oci" \ + --tag localhost/aerocore-installer-payload:latest \ + --file installer/Containerfile \ + . + + - name: Build ISO + id: build + uses: Zeglius/titanoboa@7737f4748458252ac827dca14b3d6dd09298472a # revamp-pr + with: + image-ref: localhost/aerocore-installer-payload:latest + iso-dest: ${{ github.workspace }}/output/aerocore-os-${{ env.ISO_FILE_TAG }}-amd64.iso + + - name: Normalize ISO output path + shell: bash + env: + GENERATED_ISO: ${{ steps.build.outputs.iso-dest }} + EXPECTED_ISO: ${{ github.workspace }}/output/aerocore-os-${{ env.ISO_FILE_TAG }}-amd64.iso + run: | + if [[ ! -f "${GENERATED_ISO}" ]]; then + echo "::error::Generated ISO does not exist at ${GENERATED_ISO}" + exit 1 + fi + if [[ "${GENERATED_ISO}" != "${EXPECTED_ISO}" ]]; then + mkdir -p "$(dirname "${EXPECTED_ISO}")" + mv "${GENERATED_ISO}" "${EXPECTED_ISO}" + fi + + - name: Display checksum + shell: bash + run: | + set -o pipefail + iso_path="output/aerocore-os-${ISO_FILE_TAG}-amd64.iso" + checksum_path="${iso_path}-CHECKSUM" + sha256sum "${iso_path}" | tee "${checksum_path}" + { + echo "# ISO Checksum (SHA256)" + echo + echo "ISO: $(basename "${iso_path}")" + echo + echo '```' + cat "${checksum_path}" + echo '```' + } >> "$GITHUB_STEP_SUMMARY" + + - name: Move ISO to upload directory + id: upload-directory + shell: bash + run: | + iso_upload_dir="${{ github.workspace }}/output/upload" + iso_path="${{ github.workspace }}/output/aerocore-os-${ISO_FILE_TAG}-amd64.iso" + iso_name="$(basename "${iso_path}")" + + mkdir -p "${iso_upload_dir}" + mv "${iso_path}" "${iso_upload_dir}/" + ( + cd "${iso_upload_dir}" + sha256sum "${iso_name}" | tee "${iso_name}-CHECKSUM" + ) + echo "iso-upload-dir=${iso_upload_dir}" >> "$GITHUB_OUTPUT" + + - name: Upload ISO checksum to Job Artifacts + if: github.ref_name == 'testing' + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 + with: + name: aerocore-os-installer-iso-${{ env.ISO_FILE_TAG }}-checksum + path: ${{ steps.upload-directory.outputs.iso-upload-dir }}/*-CHECKSUM + if-no-files-found: error + retention-days: 1 + compression-level: 0 + + - name: Upload ISO and checksum to R2 + if: github.event_name == 'workflow_dispatch' && github.ref_name == 'main' + shell: bash + env: + RCLONE_CONFIG_R2_TYPE: s3 + RCLONE_CONFIG_R2_PROVIDER: Cloudflare + RCLONE_CONFIG_R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} + RCLONE_CONFIG_R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} + RCLONE_CONFIG_R2_REGION: auto + RCLONE_CONFIG_R2_ENDPOINT: ${{ secrets.R2_ENDPOINT }} + SOURCE_DIR: ${{ steps.upload-directory.outputs.iso-upload-dir }} + run: | + sudo apt-get update + sudo apt-get install -y rclone + rclone copy "$SOURCE_DIR" R2:bazzite diff --git a/.github/workflows/build-live-installer.yml b/.github/workflows/build-live-installer.yml deleted file mode 100644 index 0965c33..0000000 --- a/.github/workflows/build-live-installer.yml +++ /dev/null @@ -1,180 +0,0 @@ -name: Build live installer - -on: - workflow_dispatch: - inputs: - image_tag: - description: "AeroCore image tag to install" - required: false - default: latest - type: string - workflow_call: - workflow_run: - workflows: - - Build container image - types: - - completed - branches: - - main - -permissions: {} - -concurrency: - group: ${{ github.workflow }}-${{ github.ref || github.run_id }} - cancel-in-progress: true - -jobs: - build-live-installer: - name: Build KDE live installer - if: github.event_name != 'workflow_run' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push') - runs-on: ubuntu-24.04 - permissions: - contents: read - packages: read - - env: - IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} - IMAGE_TAG: ${{ inputs.image_tag || 'latest' }} - ISO_FILE_TAG: ${{ github.ref_name == 'testing' && 'testing' || (inputs.image_tag || 'latest') }} - # Keep these aligned with the Fedora major used by the target bazzite-deck base image. - LIVE_BASE_IMAGE: quay.io/fedora/fedora-kinoite:43 - FEDORA_VERSION: "43" - - steps: - - name: Maximize build space - uses: ublue-os/remove-unwanted-software@cc0becac701cf642c8f0a6613bbdaf5dc36b259e # v9 - with: - remove-codeql: true - - - name: Mount container storage BTRFS loopback - run: | - sudo truncate -s 70G /mnt/podman-storage.img - sudo mkfs.btrfs -f /mnt/podman-storage.img - sudo podman system reset --force - sudo systemctl stop podman.service - sudo mount -o compress-force=zstd:2 /mnt/podman-storage.img /var/lib/containers/storage - sudo systemctl start podman.service - - - name: Checkout - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 - - - name: Install just - uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4 - - - name: Prepare image references - run: | - image_name="$(just image_name)" - image_registry="${IMAGE_REGISTRY,,}" - echo "IMAGE_NAME=${image_name,,}" >> "$GITHUB_ENV" - echo "IMAGE_REGISTRY=${image_registry}" >> "$GITHUB_ENV" - - - name: Login to GHCR - run: | - echo '${{ secrets.GITHUB_TOKEN }}' | sudo podman login ghcr.io \ - --username '${{ github.actor }}' --password-stdin - - - name: Pull AeroCore install image - run: | - sudo podman pull "${IMAGE_REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}" - - - name: Build live installer payload - run: | - mkdir -p output - sudo podman tag \ - "${IMAGE_REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}" \ - localhost/aerocore-live-payload:latest - sudo podman save \ - --format oci-archive \ - --output output/install-payload.oci \ - localhost/aerocore-live-payload:latest - - sudo podman build \ - --cap-add sys_admin \ - --security-opt label=disable \ - --build-arg "BASE_IMAGE=${LIVE_BASE_IMAGE}" \ - --build-arg "INSTALL_IMAGE_PAYLOAD=localhost/aerocore-live-payload:latest" \ - --build-arg "INSTALL_IMAGE_PAYLOAD_ARCHIVE=/install-payload.oci" \ - --tag localhost/aerocore-live-payload:latest \ - --file installer/Containerfile \ - . - - - name: Build ISO - id: build - uses: Zeglius/titanoboa@7737f4748458252ac827dca14b3d6dd09298472a # revamp-pr - with: - image-ref: localhost/aerocore-live-payload:latest - iso-dest: ${{ github.workspace }}/output/aerocore-os-${{ env.ISO_FILE_TAG }}-amd64.iso - - - name: Normalize ISO output path - shell: bash - env: - GENERATED_ISO: ${{ steps.build.outputs.iso-dest }} - EXPECTED_ISO: ${{ github.workspace }}/output/aerocore-os-${{ env.ISO_FILE_TAG }}-amd64.iso - run: | - if [[ ! -f "${GENERATED_ISO}" ]]; then - echo "::error::Generated ISO does not exist at ${GENERATED_ISO}" - exit 1 - fi - if [[ "${GENERATED_ISO}" != "${EXPECTED_ISO}" ]]; then - mkdir -p "$(dirname "${EXPECTED_ISO}")" - mv "${GENERATED_ISO}" "${EXPECTED_ISO}" - fi - - - name: Display checksum - shell: bash - run: | - set -o pipefail - iso_path="output/aerocore-os-${ISO_FILE_TAG}-amd64.iso" - checksum_path="${iso_path}-CHECKSUM" - sha256sum "${iso_path}" | tee "${checksum_path}" - { - echo "# ISO Checksum (SHA256)" - echo - echo "ISO: $(basename "${iso_path}")" - echo - echo '```' - cat "${checksum_path}" - echo '```' - } >> "$GITHUB_STEP_SUMMARY" - - - name: Move ISO to upload directory - id: upload-directory - shell: bash - run: | - iso_upload_dir="${{ github.workspace }}/output/upload" - iso_path="${{ github.workspace }}/output/aerocore-os-${ISO_FILE_TAG}-amd64.iso" - iso_name="$(basename "${iso_path}")" - - mkdir -p "${iso_upload_dir}" - mv "${iso_path}" "${iso_upload_dir}/" - ( - cd "${iso_upload_dir}" - sha256sum "${iso_name}" | tee "${iso_name}-CHECKSUM" - ) - echo "iso-upload-dir=${iso_upload_dir}" >> "$GITHUB_OUTPUT" - - - name: Upload ISO checksum to Job Artifacts - if: github.ref_name == 'testing' - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 - with: - name: aerocore-os-live-installer-${{ env.ISO_FILE_TAG }}-checksum - path: ${{ steps.upload-directory.outputs.iso-upload-dir }}/*-CHECKSUM - if-no-files-found: error - retention-days: 1 - compression-level: 0 - - - name: Upload ISO and checksum to R2 - if: github.event_name == 'workflow_dispatch' && github.ref_name == 'main' - shell: bash - env: - RCLONE_CONFIG_R2_TYPE: s3 - RCLONE_CONFIG_R2_PROVIDER: Cloudflare - RCLONE_CONFIG_R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} - RCLONE_CONFIG_R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} - RCLONE_CONFIG_R2_REGION: auto - RCLONE_CONFIG_R2_ENDPOINT: ${{ secrets.R2_ENDPOINT }} - SOURCE_DIR: ${{ steps.upload-directory.outputs.iso-upload-dir }} - run: | - sudo apt-get update - sudo apt-get install -y rclone - rclone copy "$SOURCE_DIR" R2:bazzite diff --git a/.github/workflows/validate-installer-iso.yml b/.github/workflows/validate-installer-iso.yml new file mode 100644 index 0000000..37f5496 --- /dev/null +++ b/.github/workflows/validate-installer-iso.yml @@ -0,0 +1,40 @@ +name: Validate installer ISO + +on: + pull_request: + paths: + - "Justfile" + - "installer/**" + - "just_scripts/build-installer-iso.sh" + - ".github/workflows/build-installer-iso.yml" + - ".github/workflows/validate-installer-iso.yml" + +permissions: + contents: read + +jobs: + validate-installer-iso: + name: Validate installer ISO inputs + runs-on: ubuntu-24.04 + + steps: + - name: Checkout + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 + + - name: Install just + uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4 + + - name: Validate workflow YAML + run: | + ruby -e 'require "yaml"; Dir[".github/workflows/*.yml"].each { |file| YAML.load_file(file) }' + + - name: Validate Justfile formatting + run: | + just --unstable --fmt --check -f Justfile + + - name: Validate build scripts + run: | + for script in build_files/*.sh installer/*.sh just_scripts/*.sh; do + bash -n "$script" + done + bash -n system_files/usr/libexec/aerocore-instruments-setup diff --git a/.github/workflows/validate-live-installer.yml b/.github/workflows/validate-live-installer.yml deleted file mode 100644 index 3d35a5d..0000000 --- a/.github/workflows/validate-live-installer.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Validate live installer - -on: - pull_request: - paths: - - "Justfile" - - "installer/**" - - "just_scripts/build-live-installer.sh" - - ".github/workflows/build-live-installer.yml" - - ".github/workflows/validate-live-installer.yml" - -permissions: - contents: read - -jobs: - validate-live-installer: - name: Validate live installer inputs - runs-on: ubuntu-24.04 - - steps: - - name: Checkout - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 - - - name: Install just - uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4 - - - name: Validate workflow YAML - run: | - ruby -e 'require "yaml"; Dir[".github/workflows/*.yml"].each { |file| YAML.load_file(file) }' - - - name: Validate Justfile formatting - run: | - just --unstable --fmt --check -f Justfile - - - name: Validate build scripts - run: | - for script in build_files/*.sh installer/*.sh just_scripts/*.sh; do - bash -n "$script" - done - bash -n system_files/usr/libexec/aerocore-instruments-setup diff --git a/Justfile b/Justfile index b65d2c9..f77828b 100644 --- a/Justfile +++ b/Justfile @@ -22,20 +22,25 @@ export INSTRUMENTS_RELEASE_API_BASE := env_var_or_default("INSTRUMENTS_RELEASE_A alias build-vm := build-qcow2 alias rebuild-vm := rebuild-qcow2 alias run-vm := run-vm-qcow2 -alias build-live-iso := build-live-installer -alias run-live-iso := run-live-installer +alias build-installer := build-installer-iso +alias run-installer := run-installer-iso +# Backward-compatible aliases; these refer to the installer ISO, not a Live OS. +alias build-live-iso := build-installer-iso +alias run-live-iso := run-installer-iso +alias build-live-installer := build-installer-iso +alias run-live-installer := run-installer-iso [private] default: @just --list -# Build a Bazzite-style live installer ISO -build-live-installer $target_image=("localhost/" + image_name) $tag=default_tag: - @IMAGE_NAME="{{ target_image }}" IMAGE_TAG="{{ tag }}" ./just_scripts/build-live-installer.sh +# Build a Bazzite-style installer ISO +build-installer-iso $target_image=("localhost/" + image_name) $tag=default_tag: + @IMAGE_NAME="{{ target_image }}" IMAGE_TAG="{{ tag }}" ./just_scripts/build-installer-iso.sh -# Boot the live installer ISO with QEMU -run-live-installer: - @./just_scripts/run-live-installer.sh +# Boot the installer ISO with QEMU +run-installer-iso: + @./just_scripts/run-installer-iso.sh # Check Just Syntax [group('Just')] diff --git a/README.md b/README.md index 3fc11c5..de33959 100644 --- a/README.md +++ b/README.md @@ -55,15 +55,15 @@ BASE_IMAGE=ghcr.io/ublue-os/bazzite-deck:testing just build ``` -To build the Bazzite-style live installer locally, first build the AeroCore +To build the Bazzite-style installer ISO locally, first build the AeroCore image and then run: ```bash sudo just build -just build-live-installer -just run-live-installer +just build-installer-iso +just run-installer-iso ``` This requires privileged Podman, a rootful Podman API socket, and roughly -70 GiB of free space. The live installer workflow consumes the published +70 GiB of free space. The installer ISO workflow consumes the published `latest` AeroCore image and uploads the ISO as a GitHub Actions artifact. diff --git a/installer/Containerfile b/installer/Containerfile index 50579e6..34c5e28 100644 --- a/installer/Containerfile +++ b/installer/Containerfile @@ -1,4 +1,4 @@ -# Build the live installer payload from a desktop Bazzite runtime. +# Build the installer ISO payload from a desktop Bazzite runtime. # The image installed to disk is supplied separately as INSTALL_IMAGE_PAYLOAD. ARG BASE_IMAGE=ghcr.io/ublue-os/bazzite:stable diff --git a/installer/iso.yaml b/installer/iso.yaml index 8e6bd73..4b9fd2c 100644 --- a/installer/iso.yaml +++ b/installer/iso.yaml @@ -1,10 +1,10 @@ -label: "AeroCore-Live" +label: "AeroCore-Installer" grub2: timeout: 3 entries: - name: "Launch AeroCore Installer" - linux: "/images/pxeboot/vmlinuz quiet rhgb root=live:CDLABEL=AeroCore-Live enforcing=0 rd.live.image" + linux: "/images/pxeboot/vmlinuz quiet rhgb root=live:CDLABEL=AeroCore-Installer enforcing=0 rd.live.image" initrd: "/images/pxeboot/initrd.img" - name: "Launch AeroCore Installer (Basic Graphics Mode)" - linux: "/images/pxeboot/vmlinuz quiet rhgb root=live:CDLABEL=AeroCore-Live enforcing=0 rd.live.image nomodeset" + linux: "/images/pxeboot/vmlinuz quiet rhgb root=live:CDLABEL=AeroCore-Installer enforcing=0 rd.live.image nomodeset" initrd: "/images/pxeboot/initrd.img" diff --git a/just_scripts/build-installer-iso.sh b/just_scripts/build-installer-iso.sh new file mode 100755 index 0000000..22d14a0 --- /dev/null +++ b/just_scripts/build-installer-iso.sh @@ -0,0 +1,122 @@ +#!/usr/bin/env bash + +set -euo pipefail + +project_root="$(git rev-parse --show-toplevel)" +cd "${project_root}" + +image_name="${IMAGE_NAME:-localhost/$(just image_name)}" +image_tag="${IMAGE_TAG:-$(just generate-default-tag)}" +live_base_image="${LIVE_BASE_IMAGE:-quay.io/fedora/fedora-kinoite:43}" +installer_builder_image="${INSTALLER_BUILDER_IMAGE:-ghcr.io/jasonn3/build-container-installer:v1.5.0}" +source_image="${image_name}:${image_tag}" +payload="localhost/aerocore-installer-payload:latest" +output_dir="${project_root}/output" +payload_archive="${output_dir}/install-payload.oci" +iso="${output_dir}/aerocore-os-${image_tag}-amd64.iso" +checksum="${iso}-CHECKSUM" +api_socket="${PODMAN_SOCKET:-/run/podman/podman.sock}" +if [[ "${EUID}" -eq 0 ]]; then + podman_cmd=(podman) + socket_test=(test -S "${api_socket}") +else + podman_cmd=(sudo podman) + socket_test=(sudo test -S "${api_socket}") +fi + +if ! "${socket_test[@]}"; then + echo "Podman API socket not found: ${api_socket}" >&2 + echo "Set PODMAN_SOCKET to the rootful Podman socket and retry." >&2 + exit 1 +fi + +ensure_rootful_image() { + local root_image_id user_image_id user_name user_uid copy_tmp + + root_image_id="$("${podman_cmd[@]}" images \ + --filter "reference=${source_image}" \ + --format "{{.ID}}" | head -n1)" + + if [[ -n "${root_image_id}" ]]; then + return 0 + fi + + if [[ "${EUID}" -ne 0 ]]; then + just _rootful_load_image "${image_name}" "${image_tag}" + return + fi + + if [[ -z "${SUDO_USER:-}" ]]; then + return + fi + + user_name="${SUDO_USER}" + user_uid="$(id -u "${user_name}")" + user_image_id="$(sudo -u "${user_name}" \ + env XDG_RUNTIME_DIR="/run/user/${user_uid}" \ + podman images \ + --filter "reference=${source_image}" \ + --format "{{.ID}}" | head -n1)" + + if [[ -z "${user_image_id}" ]]; then + return + fi + + copy_tmp="$(mktemp -p "${project_root}" -d -t _build_podman_scp.XXXXXXXXXX)" + TMPDIR="${copy_tmp}" podman image scp \ + "${user_uid}@localhost::${source_image}" \ + "root@localhost::${source_image}" + rm -rf "${copy_tmp}" +} + +mkdir -p "${output_dir}" +ensure_rootful_image + +"${podman_cmd[@]}" tag "${source_image}" "${payload}" +"${podman_cmd[@]}" save --format oci-archive --output "${payload_archive}" "${payload}" + +"${podman_cmd[@]}" build \ + --cap-add sys_admin \ + --security-opt label=disable \ + --build-arg "BASE_IMAGE=${live_base_image}" \ + --build-arg "INSTALL_IMAGE_PAYLOAD=${payload}" \ + --build-arg "INSTALL_IMAGE_PAYLOAD_ARCHIVE=/install-payload.oci" \ + --tag "${payload}" \ + --file installer/Containerfile \ + . + +if [[ "${EUID}" -eq 0 ]]; then + rm -f "${iso}" "${checksum}" +else + sudo rm -f "${iso}" "${checksum}" +fi + +"${podman_cmd[@]}" run --rm --privileged \ + --volume "${api_socket}:/var/run/docker.sock" \ + --volume /var/lib/containers/storage:/var/lib/containers/storage \ + --volume "${project_root}/output:/build-container-installer/build" \ + --volume "${project_root}/installer/lorax_templates:/additional_lorax_templates:ro" \ + "${installer_builder_image}" \ + ADDITIONAL_TEMPLATES="/additional_lorax_templates/remove_root_password_prompt.tmpl /additional_lorax_templates/set_default_user.tmpl" \ + ARCH="x86_64" \ + ENABLE_CACHE_DNF="false" \ + ENABLE_CACHE_SKOPEO="false" \ + ENABLE_FLATPAK_DEPENDENCIES="false" \ + IMAGE_NAME="aerocore-installer-payload" \ + IMAGE_REPO="localhost" \ + IMAGE_SRC="containers-storage:${payload}" \ + IMAGE_TAG="latest" \ + ISO_NAME="build/aerocore-os-${image_tag}-amd64.iso" \ + VARIANT="Kinoite" \ + VERSION="${FEDORA_VERSION:-44}" + +if [[ -f "${iso}" ]]; then + if [[ "${EUID}" -ne 0 ]]; then + sudo chown "$(id -u):$(id -g)" "${iso}" + sudo rm -f "${checksum}" + (cd "${output_dir}" && sha256sum "$(basename "${iso}")") | sudo tee "${checksum}" + sudo chown "$(id -u):$(id -g)" "${checksum}" + else + (cd "${output_dir}" && sha256sum "$(basename "${iso}")") | tee "${checksum}" + fi +fi diff --git a/just_scripts/build-live-installer.sh b/just_scripts/build-live-installer.sh deleted file mode 100755 index 45335cb..0000000 --- a/just_scripts/build-live-installer.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -project_root="$(git rev-parse --show-toplevel)" -cd "${project_root}" - -image_name="${IMAGE_NAME:-localhost/$(just image_name)}" -image_tag="${IMAGE_TAG:-$(just generate-default-tag)}" -live_base_image="${LIVE_BASE_IMAGE:-quay.io/fedora/fedora-kinoite:43}" -installer_builder_image="${INSTALLER_BUILDER_IMAGE:-ghcr.io/jasonn3/build-container-installer:v1.5.0}" -source_image="${image_name}:${image_tag}" -payload="localhost/aerocore-live-payload:latest" -output_dir="${project_root}/output" -payload_archive="${output_dir}/install-payload.oci" -iso="${output_dir}/aerocore-os-${image_tag}-amd64.iso" -checksum="${iso}-CHECKSUM" -api_socket="${PODMAN_SOCKET:-/run/podman/podman.sock}" -if [[ "${EUID}" -eq 0 ]]; then - podman_cmd=(podman) - socket_test=(test -S "${api_socket}") -else - podman_cmd=(sudo podman) - socket_test=(sudo test -S "${api_socket}") -fi - -if ! "${socket_test[@]}"; then - echo "Podman API socket not found: ${api_socket}" >&2 - echo "Set PODMAN_SOCKET to the rootful Podman socket and retry." >&2 - exit 1 -fi - -ensure_rootful_image() { - local root_image_id user_image_id user_name user_uid copy_tmp - - root_image_id="$("${podman_cmd[@]}" images \ - --filter "reference=${source_image}" \ - --format "{{.ID}}" | head -n1)" - - if [[ -n "${root_image_id}" ]]; then - return 0 - fi - - if [[ "${EUID}" -ne 0 ]]; then - just _rootful_load_image "${image_name}" "${image_tag}" - return - fi - - if [[ -z "${SUDO_USER:-}" ]]; then - return - fi - - user_name="${SUDO_USER}" - user_uid="$(id -u "${user_name}")" - user_image_id="$(sudo -u "${user_name}" \ - env XDG_RUNTIME_DIR="/run/user/${user_uid}" \ - podman images \ - --filter "reference=${source_image}" \ - --format "{{.ID}}" | head -n1)" - - if [[ -z "${user_image_id}" ]]; then - return - fi - - copy_tmp="$(mktemp -p "${project_root}" -d -t _build_podman_scp.XXXXXXXXXX)" - TMPDIR="${copy_tmp}" podman image scp \ - "${user_uid}@localhost::${source_image}" \ - "root@localhost::${source_image}" - rm -rf "${copy_tmp}" -} - -mkdir -p "${output_dir}" -ensure_rootful_image - -"${podman_cmd[@]}" tag "${source_image}" "${payload}" -"${podman_cmd[@]}" save --format oci-archive --output "${payload_archive}" "${payload}" - -"${podman_cmd[@]}" build \ - --cap-add sys_admin \ - --security-opt label=disable \ - --build-arg "BASE_IMAGE=${live_base_image}" \ - --build-arg "INSTALL_IMAGE_PAYLOAD=${payload}" \ - --build-arg "INSTALL_IMAGE_PAYLOAD_ARCHIVE=/install-payload.oci" \ - --tag "${payload}" \ - --file installer/Containerfile \ - . - -if [[ "${EUID}" -eq 0 ]]; then - rm -f "${iso}" "${checksum}" -else - sudo rm -f "${iso}" "${checksum}" -fi - -"${podman_cmd[@]}" run --rm --privileged \ - --volume "${api_socket}:/var/run/docker.sock" \ - --volume /var/lib/containers/storage:/var/lib/containers/storage \ - --volume "${project_root}/output:/build-container-installer/build" \ - --volume "${project_root}/installer/lorax_templates:/additional_lorax_templates:ro" \ - "${installer_builder_image}" \ - ADDITIONAL_TEMPLATES="/additional_lorax_templates/remove_root_password_prompt.tmpl /additional_lorax_templates/set_default_user.tmpl" \ - ARCH="x86_64" \ - ENABLE_CACHE_DNF="false" \ - ENABLE_CACHE_SKOPEO="false" \ - ENABLE_FLATPAK_DEPENDENCIES="false" \ - IMAGE_NAME="aerocore-live-payload" \ - IMAGE_REPO="localhost" \ - IMAGE_SRC="containers-storage:${payload}" \ - IMAGE_TAG="latest" \ - ISO_NAME="build/aerocore-os-${image_tag}-amd64.iso" \ - VARIANT="Kinoite" \ - VERSION="${FEDORA_VERSION:-44}" - -if [[ -f "${iso}" ]]; then - if [[ "${EUID}" -ne 0 ]]; then - sudo chown "$(id -u):$(id -g)" "${iso}" - sudo rm -f "${checksum}" - (cd "${output_dir}" && sha256sum "$(basename "${iso}")") | sudo tee "${checksum}" - sudo chown "$(id -u):$(id -g)" "${checksum}" - else - (cd "${output_dir}" && sha256sum "$(basename "${iso}")") | tee "${checksum}" - fi -fi diff --git a/just_scripts/run-installer-iso.sh b/just_scripts/run-installer-iso.sh new file mode 100755 index 0000000..2c49164 --- /dev/null +++ b/just_scripts/run-installer-iso.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -euo pipefail + +project_root="$(git rev-parse --show-toplevel)" +cd "${project_root}" + +image_tag="${IMAGE_TAG:-$(just generate-default-tag)}" +iso="${project_root}/output/aerocore-os-${image_tag}-amd64.iso" + +if [[ ! -f "${iso}" ]]; then + just build-installer-iso +fi + +podman run --rm --cap-add NET_ADMIN \ + --publish 127.0.0.1:8006:8006 \ + --env CPU_CORES=2 \ + --env RAM_SIZE=4G \ + --env DISK_SIZE=64G \ + --env BOOT_MODE=uefi \ + --device /dev/kvm \ + --volume "${iso}:/boot.iso:ro" \ + docker.io/qemux/qemu-docker diff --git a/just_scripts/run-live-installer.sh b/just_scripts/run-live-installer.sh deleted file mode 100755 index 2723aae..0000000 --- a/just_scripts/run-live-installer.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -project_root="$(git rev-parse --show-toplevel)" -cd "${project_root}" - -image_tag="${IMAGE_TAG:-$(just generate-default-tag)}" -iso="${project_root}/output/aerocore-os-${image_tag}-amd64.iso" - -if [[ ! -f "${iso}" ]]; then - just build-live-installer -fi - -podman run --rm --cap-add NET_ADMIN \ - --publish 127.0.0.1:8006:8006 \ - --env CPU_CORES=2 \ - --env RAM_SIZE=4G \ - --env DISK_SIZE=64G \ - --env BOOT_MODE=uefi \ - --device /dev/kvm \ - --volume "${iso}:/boot.iso:ro" \ - docker.io/qemux/qemu-docker -- cgit v1.2.3