From 9e62cedff0c04492dd58e160fca74563a6f9d5dd Mon Sep 17 00:00:00 2001 From: nocode Date: Mon, 6 Jul 2026 18:40:37 +0200 Subject: [PATCH] feat(anaconda): add desktop installation retry mechanism for network failures Implement a robust desktop installation retry system that handles transient network issues during the Arch installation process. Changes: - Create fws-desktop-retry script in /usr/local/bin for manual recovery after installation - Add DNS resolution wait loop (up to 10 attempts with 3-second intervals) - Implement pacman retry logic with up to 3 attempts (15-second delay between retries) - Generate /var/lib/fws/desktop-failed marker file on installation failure - Create informative MOTD message guiding users to retry desktop installation - Preserve FWS-specific MOTD when it contains retry instructions This allows users to recover from network/mirror failures without reinstalling the entire system. --- .../share/anaconda/interactive-defaults.ks | 56 +++++++++++++++++-- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/configs/releng/airootfs/usr/share/anaconda/interactive-defaults.ks b/configs/releng/airootfs/usr/share/anaconda/interactive-defaults.ks index a065cd5..5956cf4 100644 --- a/configs/releng/airootfs/usr/share/anaconda/interactive-defaults.ks +++ b/configs/releng/airootfs/usr/share/anaconda/interactive-defaults.ks @@ -295,7 +295,39 @@ esac if [ -n "$PKGS" ]; then pacman-key --init &>/dev/null || true pacman-key --populate archlinux &>/dev/null || true - if pacman -Sy --noconfirm $PKGS; then + + # Script de RATTRAPAGE généré avec les valeurs de CE choix : si l'install + # du bureau échoue (réseau/miroirs), l'utilisateur la rejoue en une + # commande depuis le système installé. --needed → inoffensif si déjà fait. + cat > /usr/local/bin/fws-desktop-retry < Installation du bureau $DESK…" +pacman -Syy --noconfirm --needed $PKGS || { echo "Échec (réseau ?) — réessayez."; exit 1; } +[ -n "$DM" ] && systemctl enable "$DM" +systemctl set-default graphical.target +rm -f /var/lib/fws/desktop-failed +[ -f /etc/motd ] && grep -q fws-desktop-retry /etc/motd && rm -f /etc/motd +echo "==> Bureau installé ✔ — redémarrez (reboot) pour arriver sur l'écran de connexion." +RETRYEOF + chmod 755 /usr/local/bin/fws-desktop-retry + + # Le réseau peut mettre quelques secondes à monter dans l'environnement + # d'installation : on attend la résolution DNS avant le premier essai, + # puis on tente pacman jusqu'à 3 fois (miroir capricieux ≠ échec définitif). + for _i in 1 2 3 4 5 6 7 8 9 10; do + getent hosts geo.mirror.pkgbuild.com >/dev/null 2>&1 && break + sleep 3 + done + _DE_OK="" + for _try in 1 2 3; do + pacman -Sy --noconfirm --needed $PKGS && { _DE_OK=1; break; } + echo "[FWS] installation du bureau : tentative $_try échouée — nouvel essai dans 15 s…" + sleep 15 + done + if [ -n "$_DE_OK" ]; then [ -n "$DM" ] && systemctl enable "$DM" || true systemctl set-default graphical.target || true # SDDM (KDE / XFCE / Hyprland) : pavé numérique + écran de connexion FWS. @@ -393,7 +425,21 @@ HYEOF gtk-update-icon-cache -f /usr/share/icons/hicolor 2>/dev/null || true fi else - echo "[FWS] Bureau '$DESK' non installé (réseau ?) — à refaire après le 1er boot." + echo "[FWS] Bureau '$DESK' NON installé après 3 tentatives (réseau/miroirs ?)." + echo "[FWS] Rattrapage sur le système installé : sudo fws-desktop-retry" + mkdir -p /var/lib/fws + echo "$DESK" > /var/lib/fws/desktop-failed + # Le premier login (console) explique quoi faire — le motd est retiré + # par fws-desktop-retry une fois le bureau posé. + cat > /etc/motd <<'MOTD' + + ⚠ FWS : l'installation du bureau a échoué (réseau indisponible pendant + l'installation). Le système fonctionne, mais en console. + + Une fois le réseau branché, lancez : sudo fws-desktop-retry + puis redémarrez : le bureau choisi sera installé et activé. + +MOTD fi fi @@ -495,8 +541,10 @@ else echo 'GRUB_DISTRIBUTOR="FWS"' >> /etc/default/grub fi grub-mkconfig -o /boot/grub/grub.cfg 2>/dev/null || true -# motd « live » (texte inadapté + codes ANSI bruts affichés crus par GDM). -rm -f /etc/motd +# motd « live » (texte inadapté + codes ANSI bruts affichés crus par GDM) — +# SAUF si c'est notre message « fws-desktop-retry » (échec d'install du +# bureau), qui doit survivre jusqu'au rattrapage. +grep -q fws-desktop-retry /etc/motd 2>/dev/null || rm -f /etc/motd # --- 4quinquies) Pare-feu par défaut ------------------------------------------- # firewalld est dans l'IMAGE (packages.x86_64) → recopié par le payload,