Files
maas-proxmox/scripts/verify-image.sh
ilkermanap 5865198240 Wire up arm64 without claiming it works
Proxmox VE 9.2 made arm64 official — same code base, repositories and release
lifecycle as x86-64 — and the pve-no-subscription repository carries proxmox-ve,
pve-manager, proxmox-default-kernel and pve-qemu-kvm for it. The build was still
hard-wired to amd64 in four places, which is now fixed:

  * firmware is chosen from the target architecture (AAVMF for arm64, OVMF for
    amd64) and padded to 64 MiB as QEMU's arm64 virt machine requires. Upstream
    packer-maas keys this on the host architecture, which only works when host
    and target match.
  * host_is_arm is derived from uname rather than hard-coded false, so KVM is
    used exactly when host and target architectures agree
  * the release body builds its MAAS upload command from MAAS_ARCH, PVE_VERSION
    and IMAGE_NAME instead of repeating amd64
  * install-deps.sh installs qemu-system-arm and AAVMF under WITH_ARM64=1,
    off by default since they are useless on an amd64-only builder

verify-image.sh asserted no kernel matching *-amd64, which would have passed
silently on an arm64 image carrying a Debian arm64 kernel. It now rejects any
/boot/vmlinuz-* not ending in -pve, which holds for both architectures. Checking
that with synthetic file lists caught a first attempt that returned "pass" for an
image containing both a PVE and a Debian kernel, so the expression is now a single
pipeline verified against GNU grep on the build host — the macOS grep this was
first tried on disagrees, and only the Linux behaviour matters here.

No arm64 image has been built and none deployed. The README gains an arm64
section saying so plainly, listing the two real obstacles — TCG emulation on an
x86_64 builder, and having no arm64 hardware to deploy to — and the entry stays
under "Not verified".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 23:16:21 +02:00

106 lines
4.5 KiB
Bash
Executable File

#!/bin/bash
# Copyright (C) 2026 Ilker Manap
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# verify-image.sh - Uretilen MAAS tgz imajinin beklenen icerige sahip oldugunu dogrular.
#
# Kullanim: ./scripts/verify-image.sh build/proxmox-ve-9.tar.gz
#
set -uo pipefail
IMG="${1:-}"
[ -n "$IMG" ] && [ -f "$IMG" ] || { echo "Kullanim: $0 <imaj.tar.gz>" >&2; exit 2; }
TMP="$(mktemp -d)"
trap 'rm -rf "$TMP"' EXIT
echo "==> Imaj: $IMG ($(du -h "$IMG" | cut -f1))"
echo "==> Icerik listesi cikariliyor..."
tar tzf "$IMG" > "$TMP/list" || { echo "HATA: arsiv okunamadi"; exit 1; }
echo " $(wc -l < "$TMP/list") giris"
pass=0; fail=0
have() { grep -qx "\./$1" "$TMP/list" || grep -q "^\./$1$" "$TMP/list"; }
present() { grep -q "^\./$1" "$TMP/list"; }
check() {
local desc="$1" cond="$2"
if eval "$cond"; then
printf ' [ OK ] %s\n' "$desc"; pass=$((pass+1))
else
printf ' [FAIL] %s\n' "$desc"; fail=$((fail+1))
fi
}
echo
echo "==> Dosya varligi kontrolleri"
check "pve-maas-init mevcut" 'present "usr/local/sbin/pve-maas-init"'
check "pve-maas.conf mevcut" 'present "etc/pve-maas/pve-maas.conf"'
check "systemd unit mevcut" 'present "etc/systemd/system/pve-maas-init.service"'
check "unit multi-user.target icin etkin" 'present "etc/systemd/system/multi-user.target.wants/pve-maas-init.service"'
check "Proxmox APT deposu mevcut" 'present "etc/apt/sources.list.d/proxmox.sources"'
check "Proxmox anahtarligi mevcut" 'present "usr/share/keyrings/proxmox-archive-keyring.gpg"'
check "pveproxy ikilisi mevcut" 'present "usr/bin/pveproxy"'
check "pvecm ikilisi mevcut" 'present "usr/bin/pvecm"'
check "pvesh ikilisi mevcut" 'present "usr/bin/pvesh"'
check "ifupdown2 mevcut" 'present "usr/share/ifupdown2"'
check "cloud-init mevcut" 'present "usr/bin/cloud-init"'
check "curtin-hooks mevcut" 'present "curtin/curtin-hooks"'
echo
echo "==> Olmamasi gerekenler"
check "pmxcfs config.db yok (dugum kimligi temiz)" '! present "var/lib/pve-cluster/config.db"'
check "corosync yapilandirmasi yok" '! present "etc/corosync/corosync.conf"'
check "iSCSI initiator adi yok (dugumde uretilir)" '! present "etc/iscsi/initiatorname.iscsi"'
check "SSH host anahtarlari yok" '! grep -qE "^\./etc/ssh/ssh_host_.*_key$" "$TMP/list"'
check "networking.service etkin DEGIL" '! present "etc/systemd/system/multi-user.target.wants/networking.service"'
check "interfaces.new yok (pvenetcommit ezmesin)" '! present "etc/network/interfaces.new"'
# Mimariden bagimsiz: /boot altinda -pve ile bitmeyen hicbir cekirdek olmamali.
# Debian'inki amd64'te *-amd64, arm64'te *-arm64 diye adlandirilir; Proxmox'unki
# her zaman -pve ile biter. Hic cekirdek yoksa da gecer - PVE cekirdeginin
# varligini asagidaki ayri kontrol dogruluyor.
check "Debian cekirdegi yok" '! grep -E "^\./boot/vmlinuz-" "$TMP/list" | grep -qv -- "-pve$"'
echo
echo "==> Proxmox cekirdegi"
if grep -qE '^\./boot/vmlinuz-.*-pve$' "$TMP/list"; then
printf ' [ OK ] PVE cekirdegi: %s\n' "$(grep -oE 'vmlinuz-[^ ]*-pve' "$TMP/list" | head -1)"
pass=$((pass+1))
else
printf ' [FAIL] /boot altinda *-pve cekirdegi bulunamadi\n'; fail=$((fail+1))
fi
echo
echo "==> Ayiklanan dosya icerikleri"
tar xzf "$IMG" -C "$TMP" \
./etc/apt/sources.list.d/proxmox.sources \
./usr/local/sbin/pve-maas-init \
./etc/pve-maas/pve-maas.conf 2>/dev/null
tar xzf "$IMG" -C "$TMP" ./etc/network/interfaces 2>/dev/null
if [ -f "$TMP/etc/network/interfaces" ]; then
echo "--- /etc/network/interfaces ---"
sed 's/^/ /' "$TMP/etc/network/interfaces"
if grep -qE '^\s*(auto|iface)\s+(?!lo)' "$TMP/etc/network/interfaces" 2>/dev/null \
|| grep -qE '^[[:space:]]*iface[[:space:]]+[^l ]' "$TMP/etc/network/interfaces"; then
printf ' [FAIL] interfaces dosyasinda build VM artigi arayuz var\n'; fail=$((fail+1))
else
printf ' [ OK ] interfaces yalnizca loopback iceriyor\n'; pass=$((pass+1))
fi
fi
if [ -f "$TMP/etc/apt/sources.list.d/proxmox.sources" ]; then
echo "--- proxmox.sources ---"
sed 's/^/ /' "$TMP/etc/apt/sources.list.d/proxmox.sources"
fi
if [ -x "$TMP/usr/local/sbin/pve-maas-init" ]; then
printf ' [ OK ] pve-maas-init calistirilabilir\n'; pass=$((pass+1))
else
printf ' [FAIL] pve-maas-init calistirilabilir degil\n'; fail=$((fail+1))
fi
echo
echo "==> Sonuc: ${pass} basarili, ${fail} basarisiz"
[ "$fail" -eq 0 ]