diff --git a/README.md b/README.md index 5c39c2b..de4fd91 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Run `./bin/omarchy-iso-boot [release/omarchy.iso]`. ## Signing the ISO -Run `./bin/omarchy-iso-sign [gpg-user] [release/omarchy.iso]`. +Run `./bin/omarchy-iso-sign [release/omarchy.iso]`. The signing key is retrieved from the shared Omarchy vault with the 1Password CLI. ## Uploading the ISO diff --git a/bin/omarchy-iso-boot b/bin/omarchy-iso-boot index eb2bbca..e410e42 100755 --- a/bin/omarchy-iso-boot +++ b/bin/omarchy-iso-boot @@ -114,6 +114,23 @@ fi omarchy-pkg-add qemu-full edk2-ovmf +if [[ -z ${WAYLAND_DISPLAY:-} && -z ${DISPLAY:-} ]]; then + while IFS='=' read -r name value; do + case "$name" in + WAYLAND_DISPLAY|DISPLAY|XAUTHORITY|XDG_SESSION_TYPE) + export "$name=$value" + ;; + esac + done < <(systemctl --user show-environment 2>/dev/null || true) +fi + +if [[ -z ${WAYLAND_DISPLAY:-} && -z ${DISPLAY:-} ]]; then + echo "Unable to find a graphical session for QEMU." >&2 + echo "Run omarchy-iso-boot from the Omarchy desktop session." >&2 + exit 1 +fi + +DISK="/tmp/omarchy-iso-boot.qcow2" if [[ ! -f $DISK || $REUSE != "reuse" ]]; then qemu-img create -f qcow2 "$DISK" 40G cp /usr/share/edk2/x64/OVMF_VARS.4m.fd "$OVMF_VARS" @@ -144,8 +161,8 @@ qemu-system-x86_64 \ -device virtio-blk-pci,drive=drive0,bootindex=1 \ -drive file="$ISO",media=cdrom,if=none,format=raw,id=cdrom0 \ -device ide-cd,drive=cdrom0,bootindex=2 \ - -device virtio-vga-gl \ - -display gtk,gl=on \ + -device virtio-vga \ + -display gtk \ -usb -device usb-tablet \ "${NET_ARGS[@]}" \ -boot menu=on \ diff --git a/bin/omarchy-iso-make b/bin/omarchy-iso-make index 7e1e7a6..9886b07 100755 --- a/bin/omarchy-iso-make +++ b/bin/omarchy-iso-make @@ -40,6 +40,11 @@ while [[ $# -gt 0 ]]; do OMARCHY_MIRROR=edge shift ;; + --quattro) + OMARCHY_INSTALLER_REF=quattro + OMARCHY_MIRROR=edge + shift + ;; --rc) OMARCHY_ISO_REF=rc OMARCHY_MIRROR=rc @@ -132,7 +137,9 @@ if [[ -d /var/cache/pacman/pkg ]]; then DOCKER_ARGS+=(-v "/var/cache/pacman/pkg:/var/cache/pacman/pkg") fi -if [[ -z $NO_CACHE ]]; then +# Mount the build cache directory where packages are downloaded. Channels use +# different package snapshots and must never share an offline mirror cache. +if [[ -z "$NO_CACHE" ]]; then OFFLINE_REPO_BUILD_CACHE_DIR="$HOME/.cache/omarchy/iso_${OMARCHY_MIRROR}/airootfs/var/cache/omarchy" mkdir -p "$OFFLINE_REPO_BUILD_CACHE_DIR" DOCKER_ARGS+=(-v "$OFFLINE_REPO_BUILD_CACHE_DIR:/var/cache/airootfs/var/cache/omarchy") diff --git a/bin/omarchy-iso-sign b/bin/omarchy-iso-sign index f852cbf..9d8865d 100755 --- a/bin/omarchy-iso-sign +++ b/bin/omarchy-iso-sign @@ -1,14 +1,48 @@ #!/bin/bash -if [ $# -eq 0 ]; then +set -euo pipefail + +if [[ $# -ne 1 ]]; then echo "usage: omarchy-iso-sign [release/omarchy.iso]" exit 1 fi -if ! pacman -Q gnupg >/dev/null; then - sudo pacman -S --noconfirm --needed --quiet gnupg - echo "You'll need to import key with: gpg --import path/to/signing-key.asc" +iso="$1" +key_ref="op://Shared/Omarchy GPG Private Key/omarchy-private.asc" + +if [[ ! -f $iso ]]; then + echo "ISO not found: $iso" >&2 + exit 1 fi -gnupg_user_key=$(gpg --list-secret-keys --keyid-format=long | awk '/^[[:space:]]/{print $1; exit}') -gpg --local-user "$gnupg_user_key" --output $1.sig --detach-sig $1 +if ! command -v op >/dev/null; then + echo "1Password CLI is required to retrieve the signing key." >&2 + exit 1 +fi + +if ! pacman -Q gnupg >/dev/null 2>&1; then + sudo pacman -S --noconfirm --needed --quiet gnupg +fi + +gnupg_home="$(mktemp -d)" +chmod 700 "$gnupg_home" +trap 'rm -rf "$gnupg_home"' EXIT + +op read "$key_ref" --account Omarchy | + gpg --batch --homedir "$gnupg_home" --import >/dev/null + +signing_key="$( + gpg --batch --homedir "$gnupg_home" --with-colons --list-secret-keys | + awk -F: '$1 == "fpr" { print $10; exit }' +)" + +if [[ -z $signing_key ]]; then + echo "No private signing key found in $key_ref" >&2 + exit 1 +fi + +gpg --batch --yes \ + --homedir "$gnupg_home" \ + --local-user "$signing_key" \ + --output "$iso.sig" \ + --detach-sig "$iso"