feat(anaconda): improve installation process and post-install handling

- Add kernel copy step in %pre to ensure vmlinuz-linux is available for mkinitcpio
- Refactor xinitrc post-install log detection to use /tmp/fws-post-chroot.log copied by kickstart
- Add success detection based on mkinitcpio and grub-install log markers
- Display success screen and poweroff on successful installation, show debug logs on failure
- Add load_policy and setstatus stub scripts to suppress SELinux-related Anaconda warnings
- Force MBR partition table (--disklabel=msdos) for BIOS boot compatibility
- Create standard mkinitcpio preset to replace archiso-specific configuration
- Automatically inject lvm2 hook when root is on LVM
- Fix GRUB installation to properly extract disk path from lsblk output
- Downgrade version to 0.5.3 (development/testing release)
This commit is contained in:
2026-06-22 15:04:41 +02:00
parent 9e3cca8efc
commit 2c9e4e6260
6 changed files with 136 additions and 36 deletions
+47 -28
View File
@@ -29,23 +29,29 @@ if command -v liveinst >/dev/null 2>&1; then
# planté. On ne se fie donc PAS à $rc : en phase debug on regroupe TOUS les
# logs et on les affiche systématiquement (zenity). Le traceback Python d'un
# crash d'import précoce n'est QUE dans $LIVEINST_LOG (stderr capturé).
# Le %post chrooté (grub-install / mkinitcpio = ce qui rend le disque
# BOOTABLE) écrit /var/log/fws-post.log SUR LE DISQUE INSTALLÉ, qu'Anaconda
# a démonté. On réactive le LVM et on remonte (lecture seule) le 1er système
# qui contient ce log : c'est LUI qui dit si le bootloader a bien été posé.
FWS_POST=""
vgchange -ay >/dev/null 2>&1 || true
udevadm settle --timeout=10 >/dev/null 2>&1 || true
mkdir -p /run/fws-installed
for _dev in /dev/mapper/*-root /dev/mapper/* /dev/sd*[0-9] /dev/vd*[0-9] /dev/nvme*n*p*; do
[ -b "$_dev" ] || continue
mount -o ro "$_dev" /run/fws-installed 2>/dev/null || continue
if [ -f /run/fws-installed/var/log/fws-post.log ]; then
FWS_POST=/run/fws-installed/var/log/fws-post.log
break
fi
umount /run/fws-installed 2>/dev/null || true
done
# Log du %post chrooté (grub-install / mkinitcpio) = CE qui rend le disque
# bootable. Le kickstart en copie une version dans le LIVE
# (/tmp/fws-post-chroot.log, via un %post --nochroot final, cible encore
# montée → fiable). SECOURS si absent : on réactive le LVM (pvscan/vgscan
# rescannent les PV qu'Anaconda a désactivés) et on remonte le disque pour
# le lire.
if [ ! -s /tmp/fws-post-chroot.log ]; then
pvscan --cache >/dev/null 2>&1 || true
vgscan --mknodes >/dev/null 2>&1 || true
vgchange -ay >/dev/null 2>&1 || true
udevadm settle --timeout=10 >/dev/null 2>&1 || true
mkdir -p /run/fws-installed
for _dev in /dev/mapper/*-root /dev/mapper/* /dev/sd*[0-9] /dev/vd*[0-9] /dev/nvme*n*p*; do
[ -b "$_dev" ] || continue
mount -o ro "$_dev" /run/fws-installed 2>/dev/null || continue
if [ -f /run/fws-installed/var/log/fws-post.log ]; then
cp -f /run/fws-installed/var/log/fws-post.log /tmp/fws-post-chroot.log 2>/dev/null
umount /run/fws-installed 2>/dev/null || true
break
fi
umount /run/fws-installed 2>/dev/null || true
done
fi
DBG=/tmp/fws-debug.txt
{
@@ -54,13 +60,9 @@ if command -v liveinst >/dev/null 2>&1; then
echo "########## sortie liveinst (stdout+stderr) ##########"
cat "$LIVEINST_LOG" 2>/dev/null
echo
echo "########## %post chrooté = grub-install / mkinitcpio (/var/log/fws-post.log) ##########"
echo "########## %post chrooté = grub-install / mkinitcpio ##########"
echo "########## >>> C'EST CE BLOC QUI DIT SI LE DISQUE VA BOOTER <<< ##########"
if [ -n "$FWS_POST" ]; then
cat "$FWS_POST" 2>/dev/null
else
echo "(log introuvable — disque installé non remonté)"
fi
cat /tmp/fws-post-chroot.log 2>/dev/null || echo "(log introuvable)"
echo
echo "########## %post --nochroot (/tmp/fws-post-nochroot.log) ##########"
cat /tmp/fws-post-nochroot.log 2>/dev/null || echo "(absent)"
@@ -72,12 +74,29 @@ if command -v liveinst >/dev/null 2>&1; then
done
} >"$DBG" 2>&1
if command -v zenity >/dev/null 2>&1; then
zenity --text-info --title="FWS — logs Anaconda (sortie $rc)" \
--filename="$DBG" --width=1100 --height=720 2>/dev/null &
# Succès d'install = les DEUX étapes qui rendent le disque bootable ont
# réussi dans le %post : mkinitcpio (« Initcpio image generation successful »)
# ET grub-install (« Installation finished. No error reported. »). Si oui →
# on montre un écran de RÉUSSITE et on éteint (l'utilisateur retire l'ISO puis
# rallume sur FWS). Sinon → on affiche tous les logs de debug (comportement
# debug). Les lignes cosmétiques (load_policy, warnings GTK…) n'influent PAS
# sur cette détection : on ne regarde que le log du %post.
if grep -q 'Initcpio image generation successful' /tmp/fws-post-chroot.log 2>/dev/null \
&& grep -q 'Installation finished. No error reported.' /tmp/fws-post-chroot.log 2>/dev/null; then
if command -v zenity >/dev/null 2>&1; then
zenity --info --width=480 --title="FWS — installation réussie ✅" \
--text="<b>FWS est installé sur le disque.</b>\n\n1. Clique OK pour <b>éteindre</b> la machine.\n2. <b>Retire l'ISO</b> (lecteur CD/DVD).\n3. Rallume → FWS démarre." \
2>/dev/null
fi
systemctl poweroff
else
# Échec (ou install non terminée) : on montre les logs pour diagnostiquer.
if command -v zenity >/dev/null 2>&1; then
zenity --text-info --title="FWS — logs Anaconda (sortie $rc)" \
--filename="$DBG" --width=1100 --height=720 2>/dev/null &
fi
wait "$_OB_PID"
fi
wait "$_OB_PID"
else
echo "[FWS] Anaconda absent de l'ISO — à builder (setup-aur.sh) + ajouter à packages.x86_64." >&2
exec openbox