feat(installer): show the real sub-steps of GRUB, initramfs, desktop and drivers

The progress screen only knew twelve coarse phases: "Installing GRUB" then
nothing until "Keyboard and language", and a bar stuck for minutes while
pacman pulled a whole desktop. Nobody could tell a slow mirror from a hang,
and a failure (no ESP, no initramfs) only existed in the log.

Every real action now publishes a line: kernel copy, mkinitcpio and its
result, each GRUB step (ESP found and mounted or missing, UEFI entry with
the VMD no-NVRAM note, EFI/BOOT fallback, BIOS MBR, menu generation,
first-boot check), desktop activation. For pacman, fws-install-step gains a
--pacman filter that reads the transaction output and turns it into
"download i/N — package", "install i/N — package", hooks, download size and
errors, moving the bar per package. fws-setup-hardware uses the same filter
when the kickstart hands it a FWS_PROGRESS range, and stays silent when run
from fws-drivers or a terminal.

The duplicated Wi-Fi profile copy left by the Main merge is folded into one.
This commit is contained in:
nocode committed 2026-11-03 21:07:18 +01:00
1 parent d720d56f8e
commit dadd46fe3c
5 files changed
+177 -30

No files matched your search

@@ -156,6 +156,7 @@ SYSROOT=/mnt/sysroot
# le stub ne contient que 127.0.0.53 (utilisable ici car le chroot partage la
# pile réseau du live, mais moins robuste). L'étape 6 du %post chrooté remet
# ensuite le lien systemd-resolved pour le système installé.
fws-install-step 1 "Préparation : DNS et nom de machine"
_DNSSRC=/etc/resolv.conf
[ -s /run/systemd/resolve/resolv.conf ] && _DNSSRC=/run/systemd/resolve/resolv.conf
rm -f "$SYSROOT/etc/resolv.conf"
@@ -188,6 +189,7 @@ fi
# l'installateur, 4) montage ro de chaque volume étiqueté pour retrouver le
# média, 5) rattrapage pacman -S linux dans le chroot. Chaque étape est tracée
# dans fws-post.log, et l'absence finale de noyau est un CRITIQUE explicite.
fws-install-step 2 "Copie du noyau Linux vers le disque"
install -d "$SYSROOT/boot"
SRC_KERN=""
for _d in /run/archiso/bootmnt /run/archiso \
@@ -207,6 +209,7 @@ fi
if [ -n "$SRC_KERN" ]; then
if cp -f "$SRC_KERN" "$SYSROOT/boot/vmlinuz-linux"; then
echo "[FWS] noyau copié depuis $SRC_KERN"
fws-install-step 4 "Noyau copié depuis le support d'installation"
else
echo "[FWS] CRITIQUE : copie du noyau impossible depuis $SRC_KERN"
fi
@@ -215,6 +218,7 @@ fi
if [ ! -r "$SYSROOT/boot/vmlinuz-linux" ]; then
echo "[FWS] CRITIQUE : aucun noyau dans la cible — mkinitcpio échouera et"
echo "[FWS] le disque NE BOOTERA PAS. Rattrapage attendu côté %post chrooté."
fws-install-step 4 "Noyau INTROUVABLE sur le support — rattrapage réseau à suivre"
fi
# --- Wi-Fi choisi sur l'écran « Connexion Internet » → système installé -----
@@ -226,26 +230,13 @@ fi
# fonctionnera au 1er démarrage du système installé SANS ressaisie du mot de
# passe (et le %post chrooté, qui tourne sur la pile réseau du live, a déjà pu
# installer le bureau).
fws-install-step 5 "Profils Wi-Fi recopiés sur le système installé"
if [ -f /tmp/fws-keep-wifi ]; then
install -d -m 700 "$SYSROOT/etc/NetworkManager/system-connections"
cp -a /etc/NetworkManager/system-connections/. \
"$SYSROOT/etc/NetworkManager/system-connections/" 2>/dev/null || true
fi
# --- Wi-Fi choisi sur l'écran « Connexion Internet » → système installé -----
# La connexion est faite par NetworkManager sur le LIVE (spoke fws_network) :
# son profil vit dans /etc/NetworkManager/system-connections du live — un
# overlay TEMPORAIRE que le payload LiveOS (copie du squashfs) ne recopie PAS.
# Si l'utilisateur s'est connecté à un Wi-Fi (marqueur /tmp/fws-keep-wifi posé
# par le spoke), on copie donc les profils NM du live vers la cible : le Wi-Fi
# fonctionnera au 1er démarrage du système installé SANS ressaisie du mot de
# passe (et le %post chrooté, qui tourne sur la pile réseau du live, a déjà pu
# installer le bureau).
if [ -f /tmp/fws-keep-wifi ]; then
install -d -m 700 "$SYSROOT/etc/NetworkManager/system-connections"
cp -a /etc/NetworkManager/system-connections/. \
"$SYSROOT/etc/NetworkManager/system-connections/" 2>/dev/null || true
fi
fws-install-step 6 "Système de base préparé — configuration"
%end
@@ -353,23 +344,29 @@ fws-install-step 14 "Construction de l'initramfs"
# dans le %post --nochroot), on tente de l'installer par pacman (réseau du
# live) AVANT d'abandonner — sinon l'initramfs n'est jamais généré et le
# disque est incappable de booter (vu en réel sur bare metal).
fws-install-step 14 "initramfs : vérification du noyau /boot/vmlinuz-linux"
if [ ! -r /boot/vmlinuz-linux ]; then
echo "[FWS] /boot/vmlinuz-linux absent — rattrapage : pacman -S linux…"
fws-install-step 15 "initramfs : noyau absent — téléchargement du paquet linux"
pacman-key --init &>/dev/null || true
pacman-key --populate archlinux &>/dev/null || true
pacman -Sy --noconfirm linux || echo "[FWS] rattrapage pacman échoué (réseau ?)"
fi
if [ -r /boot/vmlinuz-linux ]; then
fws-install-step 16 "initramfs : mkinitcpio -P (image par défaut + image de secours)"
mkinitcpio -P || echo "[FWS] AVERTISSEMENT : mkinitcpio a échoué"
# Vérification finale explicite : l'initramfs doit exister, sinon le
# disque NE BOOTERA PAS — on le dit en CRITIQUE (jamais en silence).
if [ -s /boot/initramfs-linux.img ]; then
echo "[FWS] initramfs généré : $(ls -l /boot/initramfs-linux.img | awk '{print $5}') octets"
fws-install-step 21 "initramfs : généré ($(du -h /boot/initramfs-linux.img | cut -f1))"
else
echo "[FWS] CRITIQUE : /boot/initramfs-linux.img ABSENT — le disque NE BOOTERA PAS."
fws-install-step 21 "initramfs : ÉCHEC — le disque ne démarrera pas (voir le journal)"
fi
else
echo "[FWS] CRITIQUE : toujours aucun noyau — initramfs NON généré, le disque NE BOOTERA PAS."
fws-install-step 21 "initramfs : AUCUN NOYAU — le disque ne démarrera pas (voir le journal)"
fi
fws-install-step 22 "Installation de GRUB"
@@ -379,6 +376,7 @@ install_grub() {
if [ -d /sys/firmware/efi ]; then
# UEFI. efibootmgr crée l'entrée NVRAM « FWS », mais il peut MANQUER de
# l'airootfs et son install dépend du réseau → on ne BLOQUE pas dessus.
fws-install-step 22 "GRUB : mode UEFI — préparation (efibootmgr)"
pacman -Q efibootmgr &>/dev/null || pacman -Sy --noconfirm efibootmgr || true
# L'ESP doit être montée sur /boot/efi DANS le chroot pour que
# grub-install écrive dessus. Anaconda (bootloader --disabled) ne la
@@ -389,6 +387,7 @@ install_grub() {
# monte. Échec ⇒ non bloquant : fws-grub-finalize (3ter) finalisera au
# 1er démarrage, quand efivars et tous les disques seront accessibles.
if ! mountpoint -q /boot/efi 2>/dev/null; then
fws-install-step 23 "GRUB : recherche de la partition EFI"
# RECHERCHE DE L'ESP — ne JAMAIS repasser par PARTTYPENAME.
# L'ancienne version faisait :
# lsblk -nro PATH,PARTTYPENAME,FSTYPE | awk '$2=="EFI System" …'
@@ -430,7 +429,9 @@ install_grub() {
mkdir -p /boot/efi
mount "$esp" /boot/efi 2>/dev/null \
&& echo "[FWS] ESP '$esp' montée sur /boot/efi (chroot)" || true
fws-install-step 23 "GRUB : partition EFI $esp montée sur /boot/efi"
else
fws-install-step 23 "GRUB : AUCUNE partition EFI sur les disques internes"
echo "[FWS] CRITIQUE : aucune partition EFI sur ${_rootdisk:-le disque cible} ni sur un disque interne."
echo "[FWS] Le partitionnement n'a pas créé d'ESP (patch anaconda absent ?) — sans elle,"
echo "[FWS] GRUB UEFI n'a nulle part où s'installer et le disque NE DÉMARRERA PAS seul."
@@ -438,6 +439,7 @@ install_grub() {
fi
if ! mountpoint -q /boot/efi 2>/dev/null && [ ! -d /boot/efi/EFI ]; then
echo "[FWS] aucune ESP accessible dans le chroot — le 1er démarrage finalisera GRUB"
fws-install-step 25 "GRUB : pas d'ESP accessible — finalisation reportée au 1er démarrage"
return 1
fi
# (a) Entrée NVRAM dédiée (best effort, si efibootmgr dispo) — SAUF sur
@@ -451,8 +453,10 @@ install_grub() {
/usr/local/bin/fws-intel-rst --detect >/dev/null 2>&1
case $? in 10|11|12) _nvram="--no-nvram" ;; esac
fi
fws-install-step 24 "GRUB : installation UEFI (entrée « FWS »${_nvram:+, sans écriture NVRAM : Intel VMD})"
grub-install --target=x86_64-efi --efi-directory=/boot/efi \
--bootloader-id=FWS $_nvram --recheck || true
fws-install-step 25 "GRUB : chemin de secours EFI/BOOT/BOOTX64.EFI"
# (b) Chemin de SECOURS EFI/BOOT/BOOTX64.EFI (--removable) : boote SANS
# aucune entrée NVRAM. INDISPENSABLE en VM / sans réseau / firmware
# qui « oublie » l'entrée — c'est lui qui garantit le 1er boot UEFI.
@@ -470,7 +474,8 @@ install_grub() {
rootsrc="$(findmnt -no SOURCE / 2>/dev/null)"
disk="$(lsblk -spno NAME,TYPE "$rootsrc" 2>/dev/null \
| awk '$2=="disk"{print $1; exit}' | grep -oE '/dev/[a-z0-9]+')"
[ -n "$disk" ] || { echo "[FWS] Disque BIOS introuvable pour '$rootsrc'"; return 1; }
[ -n "$disk" ] || { echo "[FWS] Disque BIOS introuvable pour '$rootsrc'"; fws-install-step 24 "GRUB : mode BIOS — disque de « / » introuvable"; return 1; }
fws-install-step 24 "GRUB : mode BIOS — installation dans le MBR de $disk"
grub-install --target=i386-pc --recheck "$disk"
fi
}
@@ -479,9 +484,13 @@ install_grub() {
# quoi qu'il arrive — fws-grub-finalize n'aura plus qu'à poser les binaires.
mkdir -p /boot/grub
if install_grub; then
grub-mkconfig -o /boot/grub/grub.cfg || echo "[FWS] grub-mkconfig a échoué"
fws-install-step 26 "GRUB : installé — génération du menu (grub-mkconfig)"
grub-mkconfig -o /boot/grub/grub.cfg \
&& fws-install-step 27 "GRUB : menu généré" \
|| { echo "[FWS] grub-mkconfig a échoué"; fws-install-step 27 "GRUB : génération du menu ÉCHOUÉE (voir le journal)"; }
else
echo "[FWS] AVERTISSEMENT : grub-install a échoué — le 1er démarrage finalisera GRUB"
fws-install-step 26 "GRUB : NON installé — sera finalisé au 1er démarrage ; génération du menu"
grub-mkconfig -o /boot/grub/grub.cfg || echo "[FWS] grub-mkconfig a échoué"
fi
@@ -500,7 +509,9 @@ fi
# bare-metal — désormais automatique. Marqueur de succès posé par le script ;
# le service ne tourne qu'une fois. Il reste INActif sur le live (le symlink
# d'activation n'est créé qu'ici, dans le système installé).
systemctl enable fws-grub-finalize.service || true
systemctl enable fws-grub-finalize.service \
&& fws-install-step 27 "GRUB : vérification au 1er démarrage programmée (fws-grub-finalize)" \
|| true
fws-install-step 28 "Clavier et langue du système"
@@ -581,7 +592,13 @@ esac
# bureau (règle fontconfig : etc/fonts/conf.d/99-fws-emoji.conf) — sans elle,
# les emoji des notifications/menus s'affichent en carrés vides.
[ -n "$PKGS" ] && PKGS="$PKGS firefox python-gobject pacman-contrib noto-fonts-emoji"
# Nom lisible du bureau pour l'écran de progression.
case "$DESK" in
kde) _DESK_LABEL="KDE Plasma" ;; gnome) _DESK_LABEL="GNOME" ;; xfce) _DESK_LABEL="XFCE" ;;
hyprland) _DESK_LABEL="Hyprland" ;; i3) _DESK_LABEL="i3" ;; *) _DESK_LABEL="ligne de commande" ;;
esac
if [ -n "$PKGS" ]; then
fws-install-step 32 "Bureau $_DESK_LABEL : préparation des clés pacman"
pacman-key --init &>/dev/null || true
pacman-key --populate archlinux &>/dev/null || true
@@ -670,7 +687,9 @@ FINEOF
# Synchro unique + filtre : un paquet renommé/absent ne doit pas faire
# échouer TOUT le bureau (même approche que fws-setup-hardware), puis on
# tente pacman jusqu'à 3 fois (miroir capricieux ≠ échec définitif).
fws-install-step 33 "Bureau $_DESK_LABEL : synchronisation des dépôts (réseau)"
pacman -Sy --noconfirm || echo "[FWS] synchro pacman initiale échouée (réseau ?)"
fws-install-step 34 "Bureau $_DESK_LABEL : vérification des paquets disponibles"
_FILTERED=""
for _p in $PKGS; do
pacman -Si "$_p" >/dev/null 2>&1 && _FILTERED="$_FILTERED $_p"
@@ -678,11 +697,18 @@ FINEOF
[ -n "$_FILTERED" ] && PKGS="${_FILTERED# }"
_DE_OK=""
for _try in 1 2 3; do
pacman -S --noconfirm --needed $PKGS && { _DE_OK=1; break; }
# La sortie de pacman passe par le filtre de progression (téléchargement
# i/N, installation i/N, hooks) ; son code retour vient de PIPESTATUS,
# celui du filtre étant toujours 0.
pacman -S --noconfirm --needed $PKGS 2>&1 \
| fws-install-step --pacman 35 60 "Bureau $_DESK_LABEL (essai $_try/3)"
[ "${PIPESTATUS[0]}" -eq 0 ] && { _DE_OK=1; break; }
echo "[FWS] installation du bureau : tentative $_try échouée — nouvel essai dans 15 s…"
fws-install-step 35 "Bureau $_DESK_LABEL : tentative $_try/3 échouée (réseau ?) — nouvel essai dans 15 s"
sleep 15
done
if [ -n "$_DE_OK" ]; then
fws-install-step 61 "Bureau $_DESK_LABEL : installé — activation de l'écran de connexion${DM:+ ($DM)}"
# Activation graphique : DM + graphical.target. Si l'une des deux
# échoue (improbable), on laisse quand même le marqueur → le service
# fws-desktop-finalize réparera automatiquement au 1er démarrage.
@@ -790,6 +816,7 @@ HYEOF
fi
else
echo "[FWS] Bureau '$DESK' NON installé pendant le %post (réseau/miroirs ?)."
fws-install-step 61 "Bureau $_DESK_LABEL : NON installé (réseau) — rattrapage automatique au 1er démarrage"
echo "[FWS] Rattrapage AUTOMATIQUE au prochain démarrage (fws-desktop-finalize.service)."
echo "[FWS] Manuellement : sudo fws-desktop-retry"
mkdir -p /var/lib/fws
@@ -821,7 +848,7 @@ if [ -x /usr/local/bin/fws-setup-hardware ]; then
# sans quoi la machine ne marche pas. Les codecs, Steam/Wine et la VR
# attendent un clic dans « Pilotes et matériel », qui s'ouvre au
# premier démarrage : on n'impose pas des gigaoctets à qui n'en veut pas.
/usr/local/bin/fws-setup-hardware --unattended "$DESK" || true
FWS_PROGRESS="62 75" /usr/local/bin/fws-setup-hardware --unattended "$DESK" || true
fi
fws-install-step 76 "Configuration du bureau (raccourcis, barres, thème)"