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

@@ -4,6 +4,17 @@
# le transforme en « Script 2/3 · Installation du bureau — 62 % »).
#
# Usage : fws-install-step <pourcentage 0-100> "<ce qui est en cours>"
# <commande pacman> 2>&1 | fws-install-step --pacman <de> <à> "<préfixe>"
#
# Le mode « --pacman » lit la sortie d'une transaction pacman, la REcopie telle
# quelle sur stdout (le journal d'installation ne perd rien) et publie ce qui
# se passe vraiment : « <préfixe> : téléchargement 123/345 — plasma-desktop »,
# puis « installation 200/345 — konsole », puis les hooks. Le pourcentage
# avance de <de> à <à> au fil des paquets. Sans ça, l'installation du bureau
# (plusieurs minutes, des centaines de paquets) restait une barre immobile
# sous un libellé fixe, et l'utilisateur ne pouvait pas distinguer « ça
# télécharge » de « c'est planté ». Le code retour de pacman reste à lire via
# PIPESTATUS côté appelant : ce filtre sort toujours en 0.
#
# Le fichier est toujours écrit dans le rootfs COURANT (/var/log/…) : dans le
# %post chrooté c'est le système installé (que l'installeur lit via
@@ -18,16 +29,86 @@ set -u
FILE=/var/log/fws-install-progress
publish() {
_pct="$1"; shift
case "$_pct" in
''|*[!0-9]*) return 0 ;;
esac
[ "$_pct" -le 100 ] || _pct=100
mkdir -p "${FILE%/*}" 2>/dev/null || return 0
if printf '%s|%s\n' "$_pct" "$*" > "$FILE.tmp" 2>/dev/null; then
mv -f "$FILE.tmp" "$FILE" 2>/dev/null || rm -f "$FILE.tmp" 2>/dev/null
fi
return 0
}
# ── Mode filtre : la sortie de pacman, ligne par ligne ──────────────────────
# pacman sans terminal (c'est le cas dans un %post) n'affiche aucune barre :
# il écrit une ligne par événement, et c'est ce qu'on lit ici.
# Packages (345) foo-1.0-1 bar-2.0-1 … → le total, N
# foo-1.0-1-x86_64 downloading... → téléchargement i/N (moitié de la plage)
# installing foo... → installation i/N (jusqu'à 95 %)
# (3/12) Creating system user accounts... → hooks (les 5 % restants)
# Les totaux sont des bornes : avec « --needed » les paquets déjà présents ne
# sont pas retéléchargés, donc le compteur peut s'arrêter avant N — la barre
# saute alors à l'étape suivante, elle ne recule jamais.
if [ "${1:-}" = "--pacman" ]; then
FROM="${2:-0}"; TO="${3:-100}"; PREFIX="${4:-pacman}"
case "$FROM$TO" in *[!0-9]*) FROM=0; TO=100 ;; esac
[ "$TO" -gt "$FROM" ] || TO=$((FROM + 1))
SPAN=$((TO - FROM))
total=0; dl=0; inst=0
publish "$FROM" "$PREFIX : résolution des dépendances"
while IFS= read -r line; do
printf '%s\n' "$line"
case "$line" in
":: Synchronizing package databases"*)
publish "$FROM" "$PREFIX : synchronisation des dépôts" ;;
"Packages ("*")"*)
total="${line#Packages (}"; total="${total%%)*}"
case "$total" in ''|*[!0-9]*) total=0 ;; esac
dl=0 # les « downloading... » vus jusqu'ici étaient les bases de dépôts
publish "$FROM" "$PREFIX : $total paquets à installer" ;;
"Total Download Size:"*)
size="${line#Total Download Size:}"; size="${size#"${size%%[! ]*}"}"
publish "$FROM" "$PREFIX : $size à télécharger" ;;
*" downloading...")
dl=$((dl + 1)); name="${line# }"; name="${name% downloading...}"
if [ "$total" -gt 0 ]; then
pct=$((FROM + SPAN * dl / (2 * total)))
publish "$pct" "$PREFIX : téléchargement $dl/$total — $name"
else
publish "$FROM" "$PREFIX : téléchargement — $name"
fi ;;
"checking keyring"*) publish $((FROM + SPAN / 2)) "$PREFIX : vérification des signatures" ;;
"checking package integrity"*) publish $((FROM + SPAN / 2)) "$PREFIX : vérification de l'intégrité des paquets" ;;
"loading package files"*) publish $((FROM + SPAN / 2)) "$PREFIX : lecture des paquets" ;;
"checking for file conflicts"*) publish $((FROM + SPAN / 2)) "$PREFIX : recherche de conflits de fichiers" ;;
"checking available disk space"*) publish $((FROM + SPAN / 2)) "$PREFIX : vérification de l'espace disque" ;;
installing\ *...|upgrading\ *...|reinstalling\ *...)
inst=$((inst + 1)); name="${line#* }"; name="${name%...}"
if [ "$total" -gt 0 ]; then
pct=$((FROM + SPAN / 2 + SPAN * 45 * inst / (100 * total)))
publish "$pct" "$PREFIX : installation $inst/$total — $name"
else
publish $((FROM + SPAN / 2)) "$PREFIX : installation — $name"
fi ;;
":: Running post-transaction hooks"*)
publish $((FROM + SPAN * 95 / 100)) "$PREFIX : exécution des hooks" ;;
"("*"/"*") "*)
h="${line#(}"; hi="${h%%/*}"; hn="${h#*/}"; hn="${hn%%)*}"; what="${line#*) }"
case "$hi$hn" in *[!0-9]*) ;; *)
[ "$hn" -gt 0 ] && publish $((FROM + SPAN * 95 / 100 + SPAN * 5 * hi / (100 * hn))) "$PREFIX : hook $hi/$hn — ${what%...}" ;;
esac ;;
"error:"*)
publish "$FROM" "$PREFIX : ERREUR — ${line#error: }" ;;
esac
done
exit 0
fi
[ "$#" -ge 2 ] || exit 0
PERCENT="$1"
shift
case "$PERCENT" in
''|*[!0-9]*) exit 0 ;;
esac
[ "$PERCENT" -le 100 ] || PERCENT=100
mkdir -p "${FILE%/*}" 2>/dev/null || exit 0
if printf '%s|%s\n' "$PERCENT" "$*" > "$FILE.tmp" 2>/dev/null; then
mv -f "$FILE.tmp" "$FILE" 2>/dev/null || rm -f "$FILE.tmp" 2>/dev/null
fi
publish "$PERCENT" "$*"
exit 0
@@ -48,6 +48,20 @@ while [ $# -gt 0 ]; do
done
log() { echo "[FWS-hw] $*"; }
# Écran de progression de l'installateur. Actif SEULEMENT quand le kickstart
# passe FWS_PROGRESS="<de> <à>" (plage de pourcentage réservée à cette phase) :
# depuis fws-drivers ou un terminal il n'y a pas d'écran à nourrir. Best
# effort, jamais bloquant.
P_FROM=""; P_TO=""
case "${FWS_PROGRESS:-}" in
[0-9]*\ [0-9]*) P_FROM="${FWS_PROGRESS%% *}"; P_TO="${FWS_PROGRESS##* }" ;;
esac
progress() {
[ -n "$P_FROM" ] && command -v fws-install-step >/dev/null 2>&1 \
&& fws-install-step "$1" "Pilotes : $2"
return 0
}
ok() { echo " ✔ $*"; }
ko() { echo " ✘ $*"; }
@@ -360,8 +374,11 @@ if [ "${#SELECTED[@]}" -gt 0 ]; then
log "groupe « ${G_LABEL[$id]} »"
WANTED_PKGS="$WANTED_PKGS ${G_PKGS[$id]}"
done
progress "$P_FROM" "détecté — $(for id in "${SELECTED[@]}"; do printf '%s, ' "${G_LABEL[$id]%% —*}"; done | sed 's/, $//')"
progress "$P_FROM" "synchronisation des dépôts (réseau)"
pacman -Sy --noconfirm || log "synchro pacman échouée (réseau ?)"
progress "$P_FROM" "vérification des paquets disponibles"
# Filtre aux paquets RÉELLEMENT existants : un nom manquant ou renommé ne
# doit pas faire échouer toute la transaction. Les absents sont NOMMÉS —
@@ -377,7 +394,17 @@ if [ "${#SELECTED[@]}" -gt 0 ]; then
[ -n "$MISSING" ] && log "AVERTISSEMENT : paquets introuvables dans les dépôts :$MISSING"
if [ -n "$VALID" ]; then
log "installation :$VALID"
if pacman -S --noconfirm --needed $VALID; then
if [ -n "$P_FROM" ]; then
# Sortie filtrée pour l'écran de progression ; le code retour de
# pacman est dans PIPESTATUS, le filtre sort toujours en 0.
pacman -S --noconfirm --needed $VALID 2>&1 \
| fws-install-step --pacman "$P_FROM" "$((P_TO - 1))" "Pilotes"
_PACMAN_RC=${PIPESTATUS[0]}
else
pacman -S --noconfirm --needed $VALID
_PACMAN_RC=$?
fi
if [ "$_PACMAN_RC" -eq 0 ]; then
# polices : le cache fontconfig doit inclure la police emoji qui
# vient d'être installée, sinon les applications déjà lancées ne la
# voient qu'au prochain démarrage de session.
@@ -456,6 +483,7 @@ fi
# idempotent : on peut la relancer autant de fois qu'on veut.
echo
log "vérification des services et des connexions"
progress "$P_TO" "vérification et réparation des services (réseau, son, Bluetooth…)"
# --- Réseau -----------------------------------------------------------------
if systemctl is-enabled NetworkManager.service >/dev/null 2>&1; then