From 50773635e83fe36b5e692ee2b34195435ce04cb1 Mon Sep 17 00:00:00 2001 From: nocode Date: Tue, 7 Jul 2026 02:47:14 +0200 Subject: [PATCH] feat(grub): add fws-recovery boot menu entry script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a new GRUB menu entry script that provides system recovery functionality. The script generates a 'Réparer FWS (récupération du système)' menu entry that boots the system into fws-recovery.target with the fws.recovery=1 marker. This allows the recovery application to launch and perform system repairs via GUI or console fallback. The script uses the fallback initramfs for maximum hardware compatibility during recovery operations, matching the UUID-based root detection logic of the standard 10_linux script. --- .../airootfs/etc/grub.d/42_fws-recovery | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 configs/releng/airootfs/etc/grub.d/42_fws-recovery diff --git a/configs/releng/airootfs/etc/grub.d/42_fws-recovery b/configs/releng/airootfs/etc/grub.d/42_fws-recovery new file mode 100755 index 0000000..d0b300c --- /dev/null +++ b/configs/releng/airootfs/etc/grub.d/42_fws-recovery @@ -0,0 +1,40 @@ +#!/bin/sh +# ============================================================================ +# FWS — entrée « Réparer FWS » dans le menu GRUB du SYSTÈME INSTALLÉ +# (l'équivalent de l'environnement de récupération de Windows). +# +# Ce script est exécuté par grub-mkconfig (à l'installation via le %post du +# kickstart, puis à chaque fws-recovery « Réinstaller GRUB »). Il démarre le +# MÊME système sur fws-recovery.target (+ marqueur fws.recovery=1) : +# fws-recovery-boot.service prend alors tty1 et lance l'application de +# réparation (GUI via startx, repli console). +# +# Sur le live, ce fichier est inerte (grub-mkconfig n'y tourne jamais). +# ============================================================================ +set -e +. /usr/share/grub/grub-mkconfig_lib + +kernel=/boot/vmlinuz-linux +# L'initramfs FALLBACK (sans autodetect) : c'est l'entrée de secours, elle +# doit démarrer même si le matériel a changé depuis le dernier mkinitcpio. +initrd=/boot/initramfs-linux-fallback.img +[ -f "$initrd" ] || initrd=/boot/initramfs-linux.img +[ -f "$kernel" ] && [ -f "$initrd" ] || exit 0 + +# Même logique racine que 10_linux : UUID sauf refus explicite. +if [ -n "${GRUB_DEVICE_UUID:-}" ] && [ "x${GRUB_DISABLE_LINUX_UUID:-}" != xtrue ]; then + rootarg="root=UUID=$GRUB_DEVICE_UUID" +else + rootarg="root=$GRUB_DEVICE" +fi + +rel_kernel="$(make_system_path_relative_to_its_root "$kernel")" +rel_initrd="$(make_system_path_relative_to_its_root "$initrd")" + +cat <