From fd212937253247ef10d69fc2cec335156d611a44 Mon Sep 17 00:00:00 2001 From: nocode Date: Wed, 8 Jul 2026 23:56:17 +0200 Subject: [PATCH] feat(anaconda): add secure boot setup and windows deployment support Add support for Secure Boot preparation and Windows dual-boot deployment during Anaconda installation. - Implement Secure Boot chain preparation using sbctl when Windows gaming dual-boot is selected - Add Windows deployment phase via fws-windows-deploy in nochroot post-installation hook - Include safety checks: literal file inspection to prevent code injection, fail-closed guards - Deployment is non-blocking: failures don't prevent FWS from booting - Add comprehensive comments explaining the Windows spoke integration and deployment flow --- .../share/anaconda/interactive-defaults.ks | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/configs/releng/airootfs/usr/share/anaconda/interactive-defaults.ks b/configs/releng/airootfs/usr/share/anaconda/interactive-defaults.ks index f327cfb..2c695cc 100644 --- a/configs/releng/airootfs/usr/share/anaconda/interactive-defaults.ks +++ b/configs/releng/airootfs/usr/share/anaconda/interactive-defaults.ks @@ -139,6 +139,12 @@ if [ -f /tmp/fws-desktop ]; then cp -f /tmp/fws-desktop "$SYSROOT/tmp/fws-desktop" 2>/dev/null || true fi +# Choix « Dual-boot Windows gaming » (spoke fws_windows) → relu par le %post +# chrooté (Secure Boot) ET par fws-windows-deploy (%post --nochroot, plus bas). +if [ -f /tmp/fws-windows ]; then + cp -f /tmp/fws-windows "$SYSROOT/tmp/fws-windows" 2>/dev/null || true +fi + # --- Noyau : archiso RETIRE /boot/vmlinuz-linux du squashfs ------------------ # mkarchiso boote le noyau depuis l'ISO et l'EXCLUT de l'airootfs squashfs (gain # de place). Conséquence : le payload LiveOS recopie un rootfs SANS noyau → @@ -610,6 +616,37 @@ ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf systemctl enable systemd-resolved.service 2>/dev/null || true install -d /etc/NetworkManager/conf.d printf '[main]\ndns=systemd-resolved\n' > /etc/NetworkManager/conf.d/dns.conf + +# --- 7) Secure Boot (uniquement si « Dual-boot Windows gaming » demandé) ------ +# Vanguard exige Secure Boot. On PRÉPARE la chaîne pendant l'install : sbctl +# create-keys + signature des 3 chemins réels (\EFI\FWS, \EFI\BOOT\BOOTX64, noyaux). +# L'enrôlement des clés + l'activation de SB au firmware restent MANUELS (Setup +# Mode requis, non automatisable) — instructions au 1er boot. Idempotent. +# On NE source PAS /tmp/fws-windows (un chemin d'ISO piégé pourrait injecter du +# code) : simple test littéral de la ligne « enabled=1 ». +if grep -qx 'enabled=1' /tmp/fws-windows 2>/dev/null \ + && [ -x /usr/local/bin/fws-secureboot-setup ]; then + /usr/local/bin/fws-secureboot-setup \ + || echo "[FWS] Secure Boot : préparation partielle (à finaliser au 1er boot)." +fi +%end + + +# ============================================================================ +# %post --nochroot — DÉPLOIEMENT WINDOWS (option A) si « Dual-boot Windows » +# demandé. Tourne dans le LIVE (cible sous /mnt/sysroot). NON bloquant : un +# échec de déploiement N'EMPÊCHE PAS FWS de booter (garde-fous fail-closed + +# statut DEPLOY_FAILED, aucune entrée UEFI Windows piégeuse). Le carve du disque +# Windows vit ICI (le %pre tourne avant le GUI → ne voit pas /tmp/fws-windows). +# Voir fws-windows-deploy + docs/windows-spoke-plan.md. +# ============================================================================ +%post --nochroot --log=/tmp/fws-windows-deploy.log +SYSROOT=/mnt/sysroot +[ -d "$SYSROOT" ] || SYSROOT=/mnt/sysimage +if [ -f /tmp/fws-windows ] && [ -x /usr/local/bin/fws-windows-deploy ]; then + /usr/local/bin/fws-windows-deploy --state /tmp/fws-windows --sysroot "$SYSROOT" \ + || echo "[FWS] Déploiement Windows échoué (voir le log) — FWS reste bootable." +fi %end