diff --git a/AGENTS.md b/AGENTS.md index 2a67a23..1cc2239 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,12 +1,12 @@ # AGENTS.md — Instructions pour les agents IA -> Fichier de référence pour les agents IA (Codebuff, Cursor, Claude Code, GitHub Copilot…) qui travaillent sur un repo de l'organisation **FWS**. Un agent doit lire ce fichier en premier : il contient les instructions à respecter. Le `README.md` apporte le contexte complet. +> Fichier de référence pour les agents IA (Codebuff, Cursor, Claude Code, GitHub Copilot…) qui travaillent sur un dépôt de l'organisation **FWS**. Un agent doit lire ce fichier en premier : il contient les instructions à respecter. Le `README.md` présente l'organisation et le `CONTRIBUTING.md` détaille les conventions de collaboration. ## Contexte -- **FWS** est une organisation open source multi-projets : chaque projet choisit librement sa stack (pas de restriction de langage). -- Projet principal : **FWS Arch** — un fork d'Arch Linux avec une surcouche conviviale pour simplifier l'installation et l'usage au quotidien. -- Conventions détaillées : `README.md` (FR) / `README.en.md` (EN). +- **FWS** est une organisation open source multi-projets : chaque projet choisit librement sa stack technique (sans restriction de langage). +- Projet principal : **FWS ISO** — une distribution Linux basée sur Arch Linux, pensée pour simplifier l'installation et l'usage au quotidien. +- Conventions détaillées : `CONTRIBUTING.md` (FR) / `CONTRIBUTING.en.md` (EN). ## Règles à respecter @@ -24,29 +24,36 @@ ### Code & commentaires -- Commentaires en **anglais**, style « pourquoi » : pas de commentaire si le code est explicite, documenter le non-évident (choix d'implémentation, trade-offs, cas limites). -- Respecter la stack et les conventions existantes du repo avant d'ajouter de nouvelles dépendances. +- Commentaires en **anglais**, style « pourquoi » : pas de commentaire si le code est explicite ; documenter le non-évident (choix d'implémentation, compromis, cas limites). +- Respecter la stack technique et les conventions existantes du dépôt avant d'ajouter de nouvelles dépendances. ### Fichiers sensibles (`.gitignore`) -- Ne **jamais** committer : fichiers d'environnement (`.env*`), données d'assistants de développement (`.freebuff/`), artefacts compilés (`dist/`, `build/`, `target/`, `__pycache__/`…), dépendances (`node_modules/`), secrets. -- Un `.gitignore` doit exister à la racine de chaque repo. +- Ne **jamais** versionner : fichiers d'environnement (`.env*`), données d'assistants de développement (`.freebuff/`), artefacts compilés (`dist/`, `build/`, `target/`, `__pycache__/`…), dépendances (`node_modules/`), secrets. +- Un `.gitignore` doit exister à la racine de chaque dépôt. ### Tests -- Fichiers de test : `*.test.*`, noms `describe` / `it` en anglais. +- Fichiers de test : `*.test.*` ; noms de tests `describe` / `it` en anglais. - Vérifier que les tests (et le typecheck / lint quand ils existent) passent avant de considérer une tâche terminée. ### Issues & signalement de bugs -- Les bugs et demandes sont suivis via les **issues**, liées au tableau Kanban. -- Une PR qui corrige un bug référence l'issue dans son titre ou sa description (`Fixes #123`). +- Les bugs et demandes sont suivis via les **issues** et, lorsqu'il existe, le tableau Kanban du projet. +- Une pull request qui corrige un bug référence l'issue dans son titre ou sa description (`Fixes #123`). - Ne pas fermer ni modifier une issue sans demande explicite de l'utilisateur. +### Commits demandés par l'utilisateur + +- Lorsque l'utilisateur demande explicitement de créer un commit, l'IA doit le faire après avoir vérifié les changements et les contrôles disponibles, sans attendre une confirmation supplémentaire. +- Le titre et le corps du commit ne doivent jamais mentionner l'IA, l'assistant, Codebuff ou l'outil utilisé. +- Ne pas ajouter l'IA comme auteur ou co-auteur dans le message du commit. + ## Bonnes pratiques pour un agent -- Lire `AGENTS.md` puis `README.md` avant d'éditer du code. +- Lire `AGENTS.md`, le `README.md` et le `CONTRIBUTING.md` avant d'éditer du code. +- Les commits doivent être signés. - Faire les changements les plus petits possibles qui répondent à la demande. -- Ne pas pousser, merger ni publier sans demande explicite de l'utilisateur. -- Suivre les cartes du tableau Kanban du projet pour l'organisation du travail. -- En cas de doute, demander plutôt que deviner. +- Ne pas pousser, fusionner ni publier sans demande explicite de l'utilisateur. +- Suivre les cartes du tableau Kanban lorsqu'il existe pour organiser le travail. +- En cas de doute, demander plutôt que de deviner. diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e15f024..7aaa251 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -47,10 +47,8 @@ Added - **PacManager**, le gestionnaire de paquets graphique de FWS, est installé sur le système final. Raccourci **``Super+P``** sur i3 et Hyprland, et entrée dans le lanceur d'applications ``Super+R``. - **podman** est désormais dans l'image. Il n'y était jamais : seul ``fws-setup-hardware`` l'installait - après coup, donc uniquement si le réseau tenait pendant l'installation. Il n'est pas non plus tiré - comme dépendance — ``winboat-bin`` ne déclare que ``optdepend = podman-compose`` — si bien qu'une - machine installée hors ligne n'avait aucun moteur de conteneurs, et donc aucun moyen de faire tourner - les applications Windows auxquelles winboat sert. + après coup, donc uniquement si le réseau tenait pendant l'installation — une machine installée hors + ligne n'avait aucun moteur de conteneurs. - ``build.sh`` refuse de démarrer si un paquet que seul ``local-repo`` peut fournir n'est pas construit. Auparavant l'absence remontait en ``target not found`` de pacman, à la toute fin — après le rafraîchissement des miroirs, la mise à jour complète et toute la préparation de mkarchiso : plusieurs @@ -59,7 +57,7 @@ Added Changed ------- -- **PacManager passe de 1.2.1 à 1.4.1.** Il gagne une troisième source de paquets, l'**AUR** (greffon +- **PacManager passe de 1.2.1 à 1.4.1, puis à 1.6.2 (voir ci-dessous).** Il gagne une troisième source de paquets, l'**AUR** (greffon chargé au démarrage, qui s'appuie sur ``yay`` ou ``paru``), un historique des opérations, un journal consultable et une vérification des mises à jour auprès du dépôt. Le paquet FWS ramasse désormais les greffons construits au lieu de les lister un par un — l'arrivée de l'AUR n'aurait sinon demandé qu'une @@ -70,6 +68,15 @@ Changed dès le premier démarrage, sans rien lui retirer — c'est un Arch complet dessous, et tout y reste possible. Faire tourner des applications Windows demeure une fonctionnalité, ce n'est plus la finalité. Reformulé dans le README, l'« À propos » et la métadonnée ``iso_application`` de l'ISO. +- **WinBoat remplacé par PacManager** : `winboat-bin` (AUR) est retiré de l'image, de ``setup-aur.sh`` + et de toute la documentation. Il est remplacé par **PacManager 1.6.2** (paquet maison + ``fws-pacmanage``, Qt6, construit depuis la release amont) : gestionnaire de paquets graphique + (recherche, installation, suppression, mises à jour, nettoyage, historique, journal, plugins + Flatpak/AUR, CLI). +- **Installation de PacManager dans un répertoire dédié** ``/opt/fws-pacmanage`` (``bin/PacManager``, + ``bin/version``, ``bin/plugins/``), avec lien ``/usr/bin/PacManager`` et entrée de bureau : c'est le + dossier que son **self-update** réécrit, ce qui rend les mises à jour automatiques possibles sans + jamais modifier ``/usr/bin`` ni la base pacman. Fixed ----- diff --git a/NOTICE b/NOTICE index 47b0fd2..6ec9d01 100644 --- a/NOTICE +++ b/NOTICE @@ -38,8 +38,6 @@ Composants sous MIT ----------------------------------------------------------------------- python-xkbregistry — Copyright (C) Stephen Early https://github.com/sde1000/python-xkbregistry -WinBoat (winboat-bin) — Copyright (C) WinBoat authors (TibixDev) - https://www.winboat.app langtable (python-langtable, partie MIT) — Copyright (C) Mike FABIAN https://github.com/mike-fabian/langtable @@ -50,9 +48,18 @@ xmlrpc-c (libxmlrpc) — Copyright (C) les auteurs de xmlrpc-c Licence permissive de type BSD (« custom ») — voir le source amont https://xmlrpc-c.sourceforge.net/ +----------------------------------------------------------------------- +Composants FWS (première partie — pas un logiciel tiers) +----------------------------------------------------------------------- +PacManager (fws-pacmanage) — Copyright (C) FWS, tous droits réservés. + Distribué avec FWS sous la licence propriétaire « source disponible » du + projet (voir pkgbuilds/fws-pacmanage, archive V1.6.2 du dépôt amont) : + usage personnel autorisé, redistribution par des tiers interdite. + https://gitea.nocode-var.tech/FWS/FWS-PacManage + ----------------------------------------------------------------------- Marques ----------------------------------------------------------------------- Arch Linux, Red Hat, Fedora, Anaconda, Windows, Microsoft, GNOME, KDE, -Plasma, Xfce, Hyprland, GTK, Linux et WinBoat sont des marques de leurs +Plasma, Xfce, Hyprland, GTK et Linux sont des marques de leurs détenteurs respectifs. FWS n'est affilié à aucun d'eux. Voir TRADEMARKS.md. diff --git a/OMEN-demarrage-sans-cle-usb.md b/OMEN-demarrage-sans-cle-usb.md new file mode 100644 index 0000000..8068084 --- /dev/null +++ b/OMEN-demarrage-sans-cle-usb.md @@ -0,0 +1,155 @@ +# HP OMEN MAX 16 (FWS installé) — démarrage sans clé USB : tout ce qui a été fait + +Document destiné aux IA. Relevé exact des opérations faites le 2026-11-03 par Claude sur la machine +**HP OMEN MAX 16-ah0xxx** (board 8D42) où FWS est installé, pour que le système démarre depuis le +NVMe sans la clé Ventoy. Tout a été fait **depuis le système en marche**, sans live USB. +Les chemins, UUID et numéros sont ceux relevés sur la machine ; les vérifier avant de s'y fier. + +--- + +## 1. Problème constaté + +- Machine en UEFI, Secure Boot désactivé, GRUB 2.16, `/etc/default/grub` fourni par FWS (os-prober activé). +- Le NVMe `/dev/nvme0n1` (KIOXIA KBG60ZNV1T02, 953,9 Gio, GPT) n'avait **aucune partition EFI** : + - `nvme0n1p1` : ext4, `/boot`, 2 Gio (1 Mio → 2049 Mio), UUID `d828c272-0ad9-4a68-b868-fa4e3b619357`. + - `nvme0n1p2` : PV LVM `fws_fws` (2049 Mio → fin), LV `root` 70 Gio et LV `home` 881,87 Gio. +- `efibootmgr` : `BootCurrent: 0000` = « USB Hard Drive (UEFI) » = la clé Ventoy (`/dev/sda2`, label + `VTOYEFI`, FAT 32 Mio, contient `grub/grub.cfg` et des modules GRUB). Entrée `Boot0001 Fedora` + morte (pointe sur un GUID de partition qui n'existe plus). Donc : **sans la clé, pas de démarrage**. +- `/boot/efi` existait mais vide ; `/proc/cmdline` = `BOOT_IMAGE=/vmlinuz-linux root=/dev/mapper/fws_fws-root rw` + (pas de `nvidia_drm.modeset=1`, demandé par `FWS-OMEN-MAX-16-integration.md`). +- Aucun espace libre sur le disque (PV LVM jusqu'au dernier secteur) : impossible d'ajouter une + partition sans réduire quelque chose. + +**Cause probable côté FWS** : l'installateur FWS ne crée pas de partition EFI sur le disque cible et +s'appuie sur le GRUB de la clé. À corriger dans FWS (voir § 8). + +## 2. Solution retenue + +Réduire `/boot` (2 Gio, 406 Mo utilisés) à 1 Gio, créer une partition EFI de 1 Gio dans l'espace +libéré (entre `/boot` et le PV LVM), y installer GRUB, mettre l'entrée firmware en tête. +`/boot` peut être démonté à chaud (rien ne l'utilise en fonctionnement), donc pas besoin de live. + +## 3. Script exécuté + +Fichier : `/home/nocode/.cache/fws-make-esp.sh`, lancé avec `pkexec bash …` (root via fenêtre de mot +de passe, règle FWS « jamais de terminal » respectée). `set -euo pipefail`, s'arrête à la première +erreur. Étapes, dans l'ordre : + +```sh +D=/dev/nvme0n1; P1=${D}p1; P3=${D}p3 +# contrôles : /boot = p1 si monté ; p3 n'existe pas ; p1 = 1.00MiB→2049MiB ; /sys/firmware/efi/efivars présent +findmnt /boot >/dev/null && umount /boot +udevadm settle; sleep 2 +e2fsck -fy $P1 # (boucle de 5 essais, voir § 4) +resize2fs $P1 1000M # fs ext4 réduit à 1000 Mio (256000 blocs de 4 k) +printf 'Yes\n' | parted ---pretend-input-tty $D resizepart 1 1025MiB # p1 : 1 Mio → 1025 Mio +partx -u $P1 # le noyau prend la nouvelle taille (vérifié = 1073741824 octets) +resize2fs $P1 # fs agrandi pour remplir la partition (262144 blocs) +e2fsck -fy $P1 +parted -s $D mkpart ESP fat32 1025MiB 2049MiB # nouvelle p3, 1 Gio +parted -s $D set 3 esp on +partx -a $D # p3 visible sans reboot (vérifié = 1073741824 octets) +mkfs.fat -F32 -n EFI $P3 +mount /boot ; mkdir -p /boot/efi ; mount $P3 /boot/efi +echo "UUID=$(blkid -s UUID -o value $P3) /boot/efi vfat defaults 0 2" >> /etc/fstab +# /etc/default/grub : GRUB_CMDLINE_LINUX_DEFAULT absent → ajouté = "nvidia_drm.modeset=1" +grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=FWS +grub-install --target=x86_64-efi --efi-directory=/boot/efi --removable # copie EFI/BOOT/BOOTX64.EFI +grub-mkconfig -o /boot/grub/grub.cfg +``` + +Aucune commande n'a touché `/dev/sda` (la clé) : elle est intacte et reste utilisable en secours. + +## 4. Pièges rencontrés (à connaître pour ne pas perdre du temps) + +1. **`e2fsck: /dev/nvme0n1p1 is in use` alors que `/boot` est démonté et que `fuser`/`lsof` + ne montrent rien.** Cause : les sandboxes Flatpak lancées avant (VSCodium `com.vscodium.codium-insiders` + et VS Code `com.visualstudio.code`, repérées via leurs `xdg-dbus-proxy`, PID 11094 et 51251) avaient + `/boot` monté dans leur propre espace de noms de montage, ce qui garde le superbloc actif et fait + échouer l'ouverture `O_EXCL`. Diagnostic : `grep nvme0n1p1 /proc/*/mountinfo` (en root). + Remède : `nsenter -m -t umount /boot` pour chaque PID, puis `udevadm settle`. Sans effet sur + les applications, mais elles voient `/boot` vide jusqu'à leur relance. Alternative : fermer ces + Flatpaks avant de démonter `/boot`. +2. `udevadm settle` + 2 s après `umount` : udev ré-inspecte la partition juste après un démontage. +3. `parted resizepart` en réduction pose une question « Yes/No » : passer par `---pretend-input-tty` + et `printf 'Yes\n'`. Avec `-s` seul, la question n'est pas répondue. +4. `grub-mkconfig` ajoute des entrées « EFI BootNext » pour chaque entrée firmware (clé USB, Fedora + morte, FWS, etc.) : menu encombré mais sans danger (voir § 8). +5. Le fichier `/etc/default/grub` de FWS n'a **pas** de ligne `GRUB_CMDLINE_LINUX_DEFAULT` : la + `sed` d'ajout ne trouve rien, il faut la créer. + +## 5. État final vérifié + +``` +nvme0n1p1 1 Gio ext4 /boot UUID d828c272-0ad9-4a68-b868-fa4e3b619357 (406 Mo utilisés) +nvme0n1p3 1 Gio vfat (ESP) /boot/efi UUID B4EC-5927 PARTUUID 5a698787-d185-4f87-987e-697e5a56e45c +nvme0n1p2 951,9 Gio LVM fws_fws (root 70 Gio /, home 881,87 Gio /home) — inchangé +``` + +- `/boot/efi/EFI/FWS/grubx64.efi` et `/boot/efi/EFI/BOOT/BOOTX64.EFI` présents. +- `efibootmgr` : `BootOrder: 0002,2001,2005,2002,2004` ; `Boot0002* FWS HD(3,GPT,5a698787-…)/\EFI\FWS\grubx64.efi`. +- `/etc/fstab` : ligne `UUID=B4EC-5927 /boot/efi vfat defaults 0 2` ajoutée. +- `/etc/default/grub` : `GRUB_CMDLINE_LINUX_DEFAULT="nvidia_drm.modeset=1"` ajouté (prend effet au + prochain démarrage ; le module avait déjà `modeset=Y` par défaut du pilote `nvidia-open 615.78.08`). +- `grub.cfg` régénéré : entrées FWS, fallback, memtest86+, firmware UEFI, BootNext. +- **Non encore testé** au moment de l'écriture : le redémarrage clé débranchée. Si le BIOS HP ignore + `Boot0002`, F9 au logo → « FWS » ou disque interne ; la copie `BOOTX64.EFI` couvre ce cas. + +## 6. Thème GRUB « space » (fait dans la même session, après le correctif de démarrage) + +Demande : GRUB en mode espace, trou noir et étoiles. + +- Image `background.png` 1920x1200 (résolution native de la dalle eDP) générée en **Python pur** + (pas de numpy/PIL/ImageMagick sur la machine) par + `/home/nocode/.cache/fws-grub-space/gen_background.py` : trou noir centré en (1330, 600), horizon + rayon 150 px, anneau de photons, halo de lentille, disque d'accrétion vu presque par la tranche + avec effet Doppler (gauche plus brillant), ~2600 étoiles, nébuleuse discrète. Graine `random.seed(42)`. +- Pixmaps de sélection (`select_w/c/e.png`, ambre `#ffb347` alpha 56, liseré 3 px) et boîte terminal + (`terminal_box_*.png`) par `gen_pixmaps.py`. +- Polices `.pf2` via `grub-mkfont` depuis `/usr/share/fonts/TTF/Hack-{Bold,Regular}.ttf` : + Hack Bold 48/20, Hack Regular 20/18/16/14 (noms internes = « Hack Bold 48 », etc.). +- `theme.txt` : titre « FWS » ambre, sous-titre, `boot_menu` à gauche (8 %/34 %, 44 %x46 %), + `progress_bar` `__timeout__`, aide des touches. Menu à gauche, trou noir à droite. +- Installé dans `/boot/grub/themes/space/` (20 fichiers, 932 Ko). Dans `/etc/default/grub` + (sauvegarde préalable `/etc/default/grub.bak-avant-theme-space`) : + `GRUB_TERMINAL_OUTPUT=gfxterm`, `GRUB_GFXMODE=1920x1200x32,auto`, `GRUB_GFXPAYLOAD_LINUX=keep`, + `GRUB_THEME=/boot/grub/themes/space/theme.txt`. `grub-mkconfig` relancé (« Thème trouvé »). +- Sources conservées dans `/home/nocode/.cache/fws-grub-space/`. Rendu réel non prévisualisable. + +## 7. Autres changements faits sur la machine pendant la session (hors démarrage) + +Pour le dual boot Windows (objectif : 500 Gio libres), à la demande explicite de l'utilisateur : +- Supprimés : préfixe `~/Games/ubisoft-connect` (103 Gio), Steam Garry's Mod (28 Gio) et Skyrim SE + (22 Gio) avec leurs `appmanifest_4000.acf`/`appmanifest_489830.acf`, `compatdata` et `shadercache`, + trois archives dans `~/Téléchargements` (11 Gio), cache pacman `paccache -rk1` (6,3 → 3,4 Gio). + L'utilisateur avait lui-même retiré Overwatch, Helldivers 2 et le cache shaders Steam. +- `/home/swapfile` recréé : 26 Gio → 8 Gio (`fallocate`, `mkswap`, `swapon` ; ligne fstab inchangée). +- `/home` après : 346 Gio utilisés sur 867 Gio. +- Procédure de redimensionnement LVM écrite dans `/home/nocode/Documents/dualboot-windows-procedure.md`. + **Elle date d'avant la création de l'ESP** : son étape 4 ne doit plus créer de partition EFI et son + étape 5 (GRUB sur le NVMe) est déjà faite. Windows réutilisera `nvme0n1p3`. Reste valable : la + réduction de `home` (PE 0-225757) puis déplacement de `root` (PE 225758-243677) par `pvmove`, le + `pvresize`, le `parted resizepart 2`, l'installation Windows dans l'espace libre, puis + `grub-mkconfig` + `efibootmgr -o` pour remettre FWS en premier. + +## 8. Travail restant / à intégrer dans FWS + +- [ ] Tester le démarrage clé débranchée, puis supprimer l'entrée firmware morte : `efibootmgr -b 0001 -B`. +- [ ] Si menu trop chargé : désactiver le script `/etc/grub.d/*` qui génère les entrées « EFI BootNext » + (le repérer avec `grep -l BootNext /etc/grub.d/*`), puis `grub-mkconfig`. +- [ ] **[FWS]** L'installateur doit créer une partition EFI (≥ 512 Mio, FAT32, drapeau `esp`) sur le + disque cible et y faire `grub-install --bootloader-id=FWS` + `--removable`, au lieu de dépendre du + GRUB de la clé. Sans ça, toute installation FWS ne démarre qu'avec la clé branchée. +- [ ] **[FWS]** Mettre `nvidia_drm.modeset=1` dans le `GRUB_CMDLINE_LINUX_DEFAULT` du template + (`/etc/default/grub` livré par FWS n'a pas cette ligne du tout). +- [ ] **[FWS]** Le thème « space » peut être livré par défaut (`/boot/grub/themes/space/` + les + quatre lignes `GRUB_*` ci-dessus) ; le générateur Python n'a aucune dépendance. +- [ ] Mettre à jour `dualboot-windows-procedure.md` pour retirer la création d'ESP (§ 7). + +## 9. Retour arrière + +- Thème : restaurer `/etc/default/grub.bak-avant-theme-space` puis `grub-mkconfig -o /boot/grub/grub.cfg`. +- ESP : ne pas la supprimer (c'est elle qui permet le démarrage). Pour revenir à `/boot` 2 Gio il + faudrait supprimer p3 et agrandir p1 : inutile, 406 Mo utilisés sur 939 Mo. +- La clé Ventoy fonctionne toujours comme avant ; le BIOS la choisit si on la met en premier (F9). diff --git a/README.md b/README.md index 9ed95cf..527b4d4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # FWS -**FWS** est une distribution Linux live/installable basée sur **Arch Linux**, qui **ouvre ses bras à tout le monde**. Son pari : Linux n'est pas compliqué — c'est la façon de le présenter qui l'était. FWS le rend simple dès le premier démarrage (installateur guidé, bureau prêt à l'emploi, pilotes et matériel pris en charge) **sans rien lui retirer** : dessous, c'est un Arch complet, et rien n'empêche d'y faire des choses complexes. Jeux (Steam/Proton-GE), réalité virtuelle (SteamVR), applications Windows (winboat/Wine) et outillage de maintenance intégré en font une machine de tous les jours, quel que soit le niveau de l'utilisateur. L'installateur graphique est **Anaconda** (celui de Fedora/RHEL), **porté sur Arch** : payload LiveOS (copie du live sur le disque), spokes FWS (choix du bureau, récapitulatif avant installation), finalisation pacman/GRUB/mkinitcpio en `%post`. +**FWS** est une distribution Linux live/installable basée sur **Arch Linux**, qui **ouvre ses bras à tout le monde**. Son pari : Linux n'est pas compliqué — c'est la façon de le présenter qui l'était. FWS le rend simple dès le premier démarrage (installateur guidé, bureau prêt à l'emploi, pilotes et matériel pris en charge) **sans rien lui retirer** : dessous, c'est un Arch complet, et rien n'empêche d'y faire des choses complexes. Jeux (Steam/Proton-GE), réalité virtuelle (SteamVR), applications Windows (Wine), gestionnaire de paquets graphique (PacManager) et outillage de maintenance intégré en font une machine de tous les jours, quel que soit le niveau de l'utilisateur. L'installateur graphique est **Anaconda** (celui de Fedora/RHEL), **porté sur Arch** : payload LiveOS (copie du live sur le disque), spokes FWS (choix du bureau, récapitulatif avant installation), finalisation pacman/GRUB/mkinitcpio en `%post`. Le projet est conçu pour être **construit depuis Windows via WSL** (les scripts détectent Git Bash et basculent automatiquement dans WSL), mais fonctionne aussi directement depuis une **Arch Linux native** ou depuis **toute distribution non-Arch (Fedora, Ubuntu…) via une bascule automatique dans un conteneur Arch podman**. Sur Windows **sans distro WSL Arch** mais avec **Docker Desktop**, les scripts basculent automatiquement dans un conteneur archlinux (équivalent Windows du repli podman). @@ -29,7 +29,7 @@ Le projet est conçu pour être **construit depuis Windows via WSL** (les script - **Clavier appliqué immédiatement** : la disposition déduite de la langue choisie au 1er écran est poussée dans l'installateur en cours. Les mots de passe Wi-Fi et de compte ne se tapent plus en QWERTY US - **Choix du bureau** dans Anaconda, **KDE Plasma par défaut**, avec compatibilité VR affichée (i3 = SteamVR ✔ ; Hyprland = ✘) - **Page récapitulative** avant toute écriture disque : config choisie (langue, clavier, fuseau, comptes, partitionnement, bureau, nom de machine) + matériel détecté (GPU, disques, virtualisation, réseau) -- **Automatique en fin d'install** : drivers GPU (NVIDIA/AMD/Intel), outils invité VM (VMware/VirtualBox/QEMU/Hyper-V), PipeWire + pavucontrol, Bluetooth (BlueZ + blueman), luminosité (brightnessctl), **pare-feu firewalld activé**, clavier/locale, hostname, sudo pour l'utilisateur créé, branding FWS +- **Automatique en fin d'install** : drivers GPU (NVIDIA/AMD/Intel) + **Vulkan** (loader, `vulkaninfo`, ICD de chaque GPU détecté — portables hybrides compris — et ICD 32 bits pour Steam/Proton), outils invité VM (VMware/VirtualBox/QEMU/Hyper-V), PipeWire + pavucontrol, Bluetooth (BlueZ + blueman), luminosité (brightnessctl), **police emoji par défaut** (Noto Color Emoji + règle fontconfig `etc/fonts/conf.d/99-fws-emoji.conf`), **pare-feu firewalld activé**, clavier/locale, hostname, sudo pour l'utilisateur créé, branding FWS - **Sur un clic, au premier démarrage** : la fenêtre « Pilotes et matériel » propose les codecs audio/vidéo, Steam + Wine + Proton + MangoHud + gamemode et la VR (Monado/SteamVR) — plusieurs gigaoctets qui ne s'installent jamais sans accord explicite - **Wi-Fi Broadcom** : les puces SoftMAC (BCM4311 à BCM4360) que ni `b43` ni `brcmsmac` ne font fonctionner reçoivent le pilote propriétaire `wl`, embarqué dans l'image. Il n'est posé que si une Broadcom est là **et** que le noyau n'a produit aucune interface sans fil — sinon il couperait le Wi-Fi des machines que les modules libres font justement marcher. Sans ça, ces portables finissaient l'installation sans réseau, donc sans moyen de télécharger le pilote manquant - **Bureau lancé au démarrage** : le display manager du bureau choisi (SDDM/GDM) est activé et `graphical.target` est la cible par défaut. Si l'installation des paquets du bureau échoue pendant le `%post` (réseau/miroirs), le système installé se **répare tout seul au premier démarrage** (`fws-desktop-finalize.service` → `fws-desktop-retry --auto`) : le bureau est installé puis l'écran de connexion apparaît, sans intervention @@ -38,6 +38,7 @@ Le projet est conçu pour être **construit depuis Windows via WSL** (les script | Commande | Rôle | Accès | |---|---|---| | `fws-hello` | Bienvenue au 1er démarrage (mise à jour, codecs, Proton-GE, VR, raccourcis) | auto au 1er login | +| `fws-wallpaper` | Fond d'écran FWS au **premier démarrage** — image embarquée dans l'ISO (aucun téléchargement) ; le choix fait ensuite par l'utilisateur n'est jamais écrasé (`--force` pour le reposer) | auto au 1er login, `fws-wallpaper --force` | | `fws-update` | Mise à jour complète (pacman + cache + orphelins + flatpak) | bouton 󰚰 de la barre | | `fws-keys` | Panneau des **raccourcis clavier réels** (lit la config Hyprland/i3) | `Super+K`, bouton ⌨ | | `fws-powermenu` | Verrouiller / déconnexion / suspendre / redémarrer / éteindre | `Super+X`, bouton 󰐥 | @@ -52,6 +53,18 @@ Le projet est conçu pour être **construit depuis Windows via WSL** (les script | `fws-recovery` | **Application GTK de réparation** : GRUB, initramfs, pacman, terminal chroot (moteur bash + repli console) | menu « Récupération FWS » de l'OS installé, entrée GRUB « Réparer FWS », entrée de boot du live | | `fws-desktop-retry` *(généré à l'install)* | (Ré)installe le bureau choisi et active le display manager — appelé automatiquement par `fws-desktop-finalize.service` au 1er démarrage si l'install du bureau a échoué ; `--auto` bascule sur l'écran de connexion sans reboot | auto au 1er boot si échec, sinon `sudo fws-desktop-retry` | +### Gestionnaire de paquets : PacManager +**PacManager** (paquet `fws-pacmanage`, interface Qt6 sur pacman) remplace la gestion en lignes de commande : +recherche, installation, suppression, mises à jour, nettoyage (orphelins, paquets hérités, cache), historique, +journal, plugins (Flatpak et AUR fournis) et une CLI (`pacmanager search vlc`). + +Il est installé **dans son propre répertoire `/opt/fws-pacmanage`** (`bin/PacManager`, `bin/version`, +`bin/plugins/`), lancé par le lien `/usr/bin/PacManager` et le menu d'applications. Ce répertoire dédié est ce +qui rend ses **mises à jour automatiques** possibles : au démarrage (puis une fois par jour) l'application +interroge ses releases et réécrit **son propre binaire**, sans jamais toucher à `/usr/bin` — donc sans +fragiliser la base pacman. Le remplacement du binaire demande le mot de passe admin (sudo) ; la *vérification* +des mises à jour, elle, se fait sans mot de passe et notifie quand une version est disponible. + ### Hyprland & i3 : parité visuelle Même identité Catppuccin Mocha (nuances de bleu) sur les deux : barre flottante arrondie (**waybar** / **polybar**) avec date+heure, indicateur de mises à jour, volume/réseau/CPU/RAM/luminosité/Bluetooth cliquables ; menus assortis (**wofi** / **rofi**) ; mêmes raccourcis (déclarés avec descriptions → `Super+K`) ; **Dolphin** en gestionnaire de fichiers ; thème **SDDM « fws »** maison (pur QtQuick, accent adapté au bureau ; GNOME garde GDM avec bannière FWS). @@ -186,8 +199,8 @@ Détails utiles : Depuis **Git Bash sur Windows** (à la racine du repo) : ```bash -# Étape 1 : compilation des paquets AUR (winboat) + PKGBUILD locaux -# (anaconda porté sur Arch + ses dépendances python) +# Étape 1 : compilation des paquets AUR + PKGBUILD locaux +# (PacManager, anaconda porté sur Arch + ses dépendances python) # → crée local-repo/ avec les .pkg.tar.zst ./setup-aur.sh @@ -210,7 +223,7 @@ L'ISO finale est générée dans `./out/FWS-YYYY.MM.DD-x86_64.iso`. 4. **`pacman -Syu`** complet (obligatoire — sinon `makepkg` plante sur les "conflicting files" lors des splits de paquets type `gcc-libs`). 5. **Install des outils de build** : `base-devel git`. 6. **Création d'un utilisateur `fwsbuild`** non-root avec `sudo` NOPASSWD (makepkg refuse de tourner en root). -7. **Clone + build AUR** : `winboat-bin`, `broadcom-wl-dkms` et leurs voisins via `makepkg -s --noconfirm`, plus les PKGBUILD locaux de `pkgbuilds/` (anaconda, anaconda-widgets, pykickstart, blivet, python-meh patché, PacManager…). Le build est **incrémental** : un paquet déjà présent dans `local-repo/` à la bonne version est sauté. +7. **Clone + build AUR** : `broadcom-wl-dkms` et les paquets de `AUR_PACKAGES` via `makepkg -s --noconfirm`, plus les PKGBUILD locaux de `pkgbuilds/` (fws-pacmanage → PacManager 1.6.2, anaconda, anaconda-widgets, pykickstart, blivet, python-meh patché…). Le build est **incrémental** : un paquet déjà présent dans `local-repo/` à la bonne version est sauté. - **Si l'AUR est injoignable**, chaque clonage a une seconde chance, puis le paquet déjà construit dans `local-repo/` est réutilisé. Le script n'abandonne que si le paquet est réellement absent. Un réseau qui bronche ne coûte plus les dix minutes de préparation pacman qui précèdent. - **`broadcom-wl-dkms` est construit mais PAS installé** sur la machine de build : il blackliste `b43`/`bcma`/`ssb` pour tout le système et compilerait un module contre le noyau du conteneur. Sur un run Arch natif, l'installer couperait le Wi-Fi de ta propre machine. 8. **Création du repo local** : `repo-add local-repo/fws-local.db.tar.gz`. @@ -250,7 +263,7 @@ L'ISO finale est générée dans `./out/FWS-YYYY.MM.DD-x86_64.iso`. | Chemin | Rôle | |---|---| -| `setup-aur.sh` | Build des paquets AUR (winboat) + PKGBUILD locaux, crée `local-repo/` | +| `setup-aur.sh` | Build des paquets AUR + PKGBUILD locaux (fws-pacmanage, Anaconda…), crée `local-repo/` | | `build.sh` | Build de l'ISO via `mkarchiso` | | `configs/releng/` | Profil principal (base ArchISO releng) | | `configs/baseline/` | Overlay FWS (surcharge le profil releng) — **prioritaire** sur releng | @@ -280,6 +293,10 @@ L'ISO finale est générée dans `./out/FWS-YYYY.MM.DD-x86_64.iso`. - **Kickstart de l'installateur** : `configs/releng/airootfs/usr/share/anaconda/interactive-defaults.ks` (payload LiveOS via `--liveinst` + tout le `%post` : bureaux, drivers, pare-feu, branding) - **Spokes Anaconda FWS** : `configs/baseline/airootfs/usr/lib/python3.14/site-packages/pyanaconda/ui/gui/spokes/` (`fws_desktop.py`, `fws_recap.py`, `fws_network.py` — écran « Connexion Internet » post-langue : sélecteur minimal Wi-Fi/Ethernet (plus l'UI complexe d'anaconda) + mot de passe, persistance du Wi-Fi via `%post --nochroot` ; glades dans `usr/share/anaconda/ui/spokes/` (`fws_network.glade`)) - **Configs bureaux & thèmes** : `configs/releng/airootfs/usr/local/share/fws/` (hyprland, i3, waybar, polybar, wofi, rofi, picom) et `usr/share/sddm/themes/fws/` +- **Fond d'écran par défaut** : `configs/releng/airootfs/usr/local/share/fws/wallpaper.png` (PNG 2560×1440, **embarqué dans l'ISO** — rien à télécharger au premier boot) appliqué par `usr/local/bin/fws-wallpaper` : autostart XDG (`etc/xdg/autostart/`) pour KDE/GNOME/XFCE, `swaybg` pour Hyprland et `feh` pour i3 (paquets ajoutés au `%post`) +- **Police emoji par défaut** : `configs/releng/airootfs/etc/fonts/conf.d/99-fws-emoji.conf` (Noto Color Emoji, paquet `noto-fonts-emoji` : présent sur le live, ajouté à la transaction du bureau par le `%post` et à la base de `fws-setup-hardware`) — famille `emoji` résolue, emoji en dernier recours des familles génériques, `embeddedbitmap` forcé pour que les emoji bitmap ne soient jamais désactivés ; piles de polices des bureaux (waybar, wofi, polybar) complétées +- **Écran de progression de l'installation** : plus de « Running post-installation scripts » figé — `fws-install-step` (`usr/local/bin/`, appelée par les `%post` du kickstart) publie « pourcentage | ce qui est en cours » dans `/var/log/fws-install-progress`, et les overlays `pyanaconda/modules/runtime/scripts/runtime.py` + `pyanaconda/modules/boss/installation.py` (livrés dans `configs/baseline/airootfs/usr/local/share/fws/anaconda-overlay/` puis copiés par `root/customize_airootfs.sh` **après** le pacstrap — mkarchiso copie l'airootfs avant les paquets, un écrasement direct ferait échouer pacman) transforment ça en « Script 2/3 · Installation du bureau (pacman) — 62 % » avec une barre qui avance par paliers de 5 % (titre de chaque script déclaré par sa ligne `# FWS-TITLE:`) +- **fastfetch : logo FWS partout** : `configs/releng/airootfs/etc/fastfetch/config.jsonc` (config **système** lue par fastfetch quand le compte n'a pas la sienne : logo `usr/local/share/fws/logo.txt` + couleurs FWS, et la liste `modules` reprend la structure par défaut de fastfetch — sans elle, un fichier de config supprime TOUTES les infos et on n'a que le logo ; `OS:` lit `/etc/os-release`, donc « FWS Linux » et non « Arch Linux »). `etc/profile.d/fastfetch.sh` se contente d'appeler `fastfetch` en shell de login : le rendu est donc le même au login, dans un terminal de bureau, en TTY, pour root comme pour un utilisateur, sur le live comme sur le système installé (une config perso `~/.config/fastfetch/` reste prioritaire) - **Outils fws-\*** : `configs/releng/airootfs/usr/local/bin/` - **GRUB du système installé (dualboot / bare-metal)** : `configs/releng/airootfs/etc/default/grub` (overlay : `GRUB_DISABLE_OS_PROBER=false` — sur Arch c'est `true` par défaut, d'où les « menus GRUB vides » sans Windows) ; `usr/local/bin/fws-grub-finalize` + `etc/systemd/system/fws-grub-finalize.service` (activé par le %post) : au 1er démarrage du système installé, réinstalle GRUB en `--removable` (chemin `EFI/BOOT/BOOTX64.EFI`, boote même si le firmware ASUS… oublie l'entrée NVRAM), crée/rafraîchit l'entrée NVRAM « FWS » (efibootmgr) et régénère le menu avec os-prober (Windows détecté) - **Récupération sur l'OS installé** : entrée GRUB générée par `configs/releng/airootfs/etc/grub.d/42_fws-recovery` → `fws-recovery.target` + `fws-recovery-boot.service` (`etc/systemd/system/`) ; lanceur `usr/local/share/applications/fws-recovery.desktop` + politique polkit `usr/share/polkit-1/actions/org.fws.recovery.policy` diff --git a/THIRD-PARTY-LICENSES.md b/THIRD-PARTY-LICENSES.md index 06cc76a..e251690 100644 --- a/THIRD-PARTY-LICENSES.md +++ b/THIRD-PARTY-LICENSES.md @@ -50,7 +50,6 @@ référencé par `source=()` dans le PKGBUILD, plus le PKGBUILD lui-même. | libreport | 2.17.15 | **`GPL-2.0-only`** ⚠ | Red Hat, Inc. (projet ABRT) | https://github.com/abrt/libreport | | satyr | 0.43 | `GPL-2.0-or-later` | Red Hat, Inc. (projet ABRT) | https://github.com/abrt/satyr | | libxmlrpc (xmlrpc-c) | 1.64.03 | `custom` (BSD-style permissive) | Auteurs xmlrpc-c | https://xmlrpc-c.sourceforge.net/ | -| winboat-bin | 0.9.0 | `MIT` | Auteurs WinBoat (TibixDev) | https://www.winboat.app | > Les versions et identifiants SPDX ci-dessus proviennent des champs `license=` > des PKGBUILD et des `.PKGINFO` des paquets de `local-repo/`. Quand le `.PKGINFO` @@ -58,6 +57,25 @@ référencé par `source=()` dans le PKGBUILD, plus le PKGBUILD lui-même. > SPDX retenu est celui du dépôt amont (p. ex. `satyr` → `GPL-2.0-or-later`). > **À corriger dans les PKGBUILD** pour des étiquettes SPDX exactes. +### 2.1 Composant FWS propriétaire (pas un tiers) + +**PacManager** (`fws-pacmanage`, recette `pkgbuilds/fws-pacmanage`, installé dans +`/opt/fws-pacmanage`) n'est **pas** un logiciel tiers : il est développé et +détenu par **FWS**. Sa licence amont (archive `V1.6.0` du dépôt, fichier +`LICENSE`) est **propriétaire « source disponible »**, tous droits réservés : +consultation, modification et compilation pour un **usage personnel** autorisées ; +**distribution, revente et réutilisation par des tiers interdites** sans accord +écrit de FWS. FWS redistribue donc son propre logiciel dans sa propre +distribution. + +Conséquences : + +- sa licence **n'est pas** compatible avec la `GPL-3.0-or-later` du dépôt au sens + d'une œuvre combinée — elle ne l'a pas à être, FWS en est l'ayant droit ; +- un tiers ne peut pas extraire `fws-pacmanage` de l'ISO pour le redistribuer ; +- le texte de licence est conservé dans `/usr/share/licenses/fws-pacmanage/` sur + le système installé (voir [NOTICE](NOTICE)). + --- ## 3. Paquets Arch Linux de l'ISO @@ -99,7 +117,7 @@ l'exécution. Les licences en présence et leur compatibilité montante vers GPL | `LGPL-2.1-or-later` (productmd) | ✅ | montée vers (L)GPLv3 | | `LGPL-3.0-or-later` (simpleline) | ✅ | sous-ensemble de GPLv3 | | `Apache-2.0` (requests-file, requests-ftp, pid) | ✅ | compatible GPLv3 (sens unique) ; voir [NOTICE](NOTICE) | -| `MIT` (xkbregistry, winboat) | ✅ | permissive | +| `MIT` (xkbregistry) | ✅ | permissive | | `MIT`/`BSD-style` (langtable, libxmlrpc) | ✅ | permissive | ### 4.3 ⚠ Deux points à surveiller (signalés en bonne foi) diff --git a/TRADEMARKS.md b/TRADEMARKS.md index a4a8ba6..9237ce3 100644 --- a/TRADEMARKS.md +++ b/TRADEMARKS.md @@ -116,10 +116,11 @@ loyale du composant amont (version modifiée d'Anaconda), utile au diagnostic. ## Windows & Microsoft > **Windows®** et **Microsoft®** sont des marques de **Microsoft Corporation**. -> FWS embarque **WinBoat** (MIT), qui permet d'exécuter des applications Windows -> sous Linux. FWS et WinBoat **ne sont ni affiliés, ni approuvés** par Microsoft. -> Exécuter des applications Windows requiert vos **propres licences Windows -> valides** ; FWS ne fournit aucun logiciel ni licence Microsoft. +> FWS embarque **Wine** et **Steam/Proton**, qui permettent d'exécuter des +> applications Windows sous Linux. FWS, Wine et Valve **ne sont ni affiliés, ni +> approuvés** par Microsoft. Exécuter des applications Windows requiert vos +> **propres licences Windows valides** ; FWS ne fournit aucun logiciel ni licence +> Microsoft. Le nom du projet et son slogan font un usage **parodique / nominatif** du terme « Windows » et n'impliquent aucun lien avec Microsoft. @@ -138,7 +139,6 @@ de façon **purement descriptive** : - **Hyprland** — projet Hyprland - **GTK** — The GNOME Foundation - **Linux®** — marque déposée de Linus Torvalds -- **WinBoat** — projet WinBoat --- diff --git a/build-offi.sh b/build-offi.sh index d9d8afc..7cadfd9 100755 --- a/build-offi.sh +++ b/build-offi.sh @@ -341,7 +341,7 @@ echo "==> Vérification des services systemd..." ls /tmp/fws-build/releng/airootfs/etc/systemd/system/ 2>/dev/null || echo " (aucun service)" ls /tmp/fws-build/releng/airootfs/etc/systemd/system/multi-user.target.wants/ 2>/dev/null || echo " (aucun symlink)" -# Copie le repo local (winboat-bin + deps Anaconda packagées) +# Copie le repo local (fws-pacmanage + fws-dnd + deps Anaconda packagées) if ls "$WORK_DIR/local-repo/"*.pkg.tar.zst &>/dev/null 2>&1; then echo "==> Copie du repo local fws-local..." mkdir -p /tmp/fws-build/local-repo @@ -385,7 +385,7 @@ if [ -n "$MISSING" ]; then echo -e "\e[31mPaquets introuvables dans les dépôts du profil :\e[0m" >&2 printf ' \e[31m%s\e[0m\n' $MISSING >&2 echo -e "\e[33mDépôt fws-local absent/incomplet ? Lance ./setup-aur.sh (construit" >&2 - echo -e "anaconda, winboat-bin, fws-dnd, …) puis relance ce script.\e[0m" >&2 + echo -e "anaconda, fws-pacmanage, fws-dnd, …) puis relance ce script.\e[0m" >&2 exit 1 fi echo "==> Pré-vol OK : ${#PROFILE_PKGS[@]} paquets résolus." diff --git a/build.sh b/build.sh index 506f29f..fc12799 100755 --- a/build.sh +++ b/build.sh @@ -305,7 +305,7 @@ echo "==> Vérification des services systemd..." ls "$SDDIR" 2>/dev/null | head -25 || echo " (aucun service)" ls "$SDDIR/multi-user.target.wants/" 2>/dev/null || echo " (aucun symlink)" -# Copie le repo local (winboat-bin + deps Anaconda packagées) +# Copie le repo local (fws-pacmanage + fws-dnd + deps Anaconda packagées) if ls "$WORK_DIR/local-repo/"*.pkg.tar.zst &>/dev/null 2>&1; then echo "==> Copie du repo local fws-local..." mkdir -p /tmp/fws-build/local-repo @@ -329,7 +329,7 @@ fi # Garde-fou : les paquets FWS doivent EXISTER dans local-repo # # packages.x86_64 liste des paquets que seul le dépôt local fournit (fws-*, -# anaconda, winboat-bin, deps python…). S'ils n'ont pas encore été construits, +# anaconda, fws-pacmanage, deps python…). S'ils n'ont pas encore été construits, # pacman ne le découvre qu'à la toute fin — après le -Syu, les miroirs et # toute la préparation de mkarchiso — avec un « target not found » sec et # plusieurs minutes de perdues. On vérifie donc AVANT de lancer quoi que ce @@ -360,25 +360,6 @@ if [ "${#_missing[@]}" -gt 0 ]; then fi echo " ${#_local_pkgs[@]} paquets locaux attendus, tous présents ✔" -# ============================================================ -# PacManager : embarqué dans l'image, installé seulement sur la CIBLE -# -# Volontairement absent de packages.x86_64 : sur un live qu'on s'apprête à -# remplacer, un gestionnaire de paquets n'a aucun sens (et il tirerait qt6-base -# dans le squashfs pour rien). On dépose donc le .pkg dans l'airootfs et c'est -# le %post du kickstart qui fait « pacman -U » dans le système installé, puis -# supprime le fichier. -# ============================================================ -_PM_PKG="$(ls "$WORK_DIR/local-repo"/fws-pacmanage-[0-9]*.pkg.tar.* 2>/dev/null | head -1)" -if [ -n "$_PM_PKG" ]; then - install -Dm644 "$_PM_PKG" \ - "/tmp/fws-build/releng/airootfs/usr/local/share/fws/packages/$(basename "$_PM_PKG")" - echo "==> PacManager embarqué pour l'installation : $(basename "$_PM_PKG")" -else - echo -e "\e[33m[!] fws-pacmanage absent de local-repo — PacManager ne sera pas installé.\e[0m" >&2 - echo " Lance ./setup-aur.sh pour le construire." >&2 -fi - # ============================================================ # Pilote Wi-Fi Broadcom : embarqué, installé seulement SI DÉTECTÉ # diff --git a/configs/baseline/airootfs/root/customize_airootfs.sh b/configs/baseline/airootfs/root/customize_airootfs.sh index 6bf5eb0..57da1c1 100644 --- a/configs/baseline/airootfs/root/customize_airootfs.sh +++ b/configs/baseline/airootfs/root/customize_airootfs.sh @@ -13,3 +13,25 @@ set -euo pipefail # sinon « locale.Error: unsupported locale setting » → le module Boss plante). # ~3 Mo générés, vs 222 Mo pour le paquet glibc-locales complet. locale-gen + +# --- Overlays pyanaconda (écran de progression FWS) --------------------------- +# mkarchiso copie l'airootfs AVANT le pacstrap (cf. fws/mkarchiso : +# _make_custom_airootfs puis _make_packages) : un fichier de l'airootfs qui +# remplace un fichier du paquet « anaconda » fait échouer pacman (« exists in +# filesystem ») et donc tout le build. Ces deux fichiers vivent donc hors des +# chemins du paquet, et on les pose ICI, après l'installation : c'est le seul +# moment où écraser un fichier de paquet est légitime (et le script est +# supprimé après exécution, il ne part pas dans l'ISO). +if [ -d /usr/local/share/fws/anaconda-overlay/pyanaconda ]; then + cp -a /usr/local/share/fws/anaconda-overlay/. /usr/lib/python3.14/site-packages/ + rm -rf /usr/local/share/fws/anaconda-overlay + + # Le build doit s'arrêter net si l'overlay n'a pas atterri : sans lui, plus + # d'écran de progression détaillé (mais l'installateur fonctionne quand même). + for _f in modules/runtime/scripts/runtime.py modules/boss/installation.py; do + if [ ! -f "/usr/lib/python3.14/site-packages/pyanaconda/${_f}" ]; then + echo "[FWS] overlay pyanaconda manquant : ${_f}" >&2 + exit 1 + fi + done +fi diff --git a/configs/baseline/airootfs/usr/lib/python3.14/site-packages/pyanaconda/ui/gui/spokes/fws_recap.py b/configs/baseline/airootfs/usr/lib/python3.14/site-packages/pyanaconda/ui/gui/spokes/fws_recap.py index fff02b7..364237f 100644 --- a/configs/baseline/airootfs/usr/lib/python3.14/site-packages/pyanaconda/ui/gui/spokes/fws_recap.py +++ b/configs/baseline/airootfs/usr/lib/python3.14/site-packages/pyanaconda/ui/gui/spokes/fws_recap.py @@ -211,7 +211,7 @@ def _build_summary(): net = ("INDISPONIBLE ✖ — bureau, drivers et stack FWS ne\n" " s'installeront PAS (rattrapable au 1er boot)") - extras = ("Steam, Wine, VR (Monado/OpenXR), winboat-bin" + extras = ("Steam, Wine, VR (Monado/OpenXR), PacManager" if desk != "cli" else "rien de plus (choix CLI)") return f"""\ diff --git a/configs/baseline/airootfs/usr/local/share/fws/anaconda-overlay/pyanaconda/modules/boss/installation.py b/configs/baseline/airootfs/usr/local/share/fws/anaconda-overlay/pyanaconda/modules/boss/installation.py new file mode 100644 index 0000000..8743f77 --- /dev/null +++ b/configs/baseline/airootfs/usr/local/share/fws/anaconda-overlay/pyanaconda/modules/boss/installation.py @@ -0,0 +1,906 @@ +# +# Copyright (C) 2021 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# the GNU General Public License v.2, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY expressed or implied, including the implied warranties of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. You should have received a copy of the +# GNU General Public License along with this program; if not, write to the +# Free Software Foundation, Inc., 31 Milk Street #960789 Boston, MA +# 02196 USA. Any Red Hat trademarks that are incorporated in the +# source code or documentation are not subject to the GNU General Public +# License and may only be used or replicated with the express permission of +# Red Hat, Inc. + +import glob +import os.path +import shutil + +from dasbus.error import DBusError +from threading import Event + +from pykickstart.constants import ( + KS_SCRIPT_POST, + KS_SCRIPT_PREINSTALL, + SNAPSHOT_WHEN_POST_INSTALL, +) + +from pyanaconda import flags, network +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core import util +from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.constants import ( + CATEGORY_BOOTLOADER, + CATEGORY_ENVIRONMENT, + CATEGORY_SOFTWARE, + CATEGORY_STORAGE, + CATEGORY_SYSTEM, + PAYLOAD_LIVE_TYPES, + PAYLOAD_TYPE_DNF, +) +from pyanaconda.core.i18n import _ +from pyanaconda.core.path import ( + join_paths, + make_directories, + open_with_perm, +) +from pyanaconda.core.service import is_service_installed +from pyanaconda.core.signal import Signal +from pyanaconda.core.util import execWithRedirect, restorecon +from pyanaconda.installation_tasks import DBusTask, Task, TaskQueue +from pyanaconda.kexec import setup_kexec +from pyanaconda.modules.boss.install_manager.installation_category_interface import ( + CategoryReportTaskInterface, +) +from pyanaconda.modules.common.constants.installation import InstallationErrorDialogType +from pyanaconda.modules.common.constants.objects import ( + BOOTLOADER, + CERTIFICATES, + FIREWALL, + SCRIPTS, + SNAPSHOT, +) +from pyanaconda.modules.common.constants.services import ( + BOSS, + LOCALIZATION, + NETWORK, + PAYLOADS, + RUNTIME, + SECURITY, + SERVICES, + STORAGE, + SUBSCRIPTION, + TIMEZONE, + USERS, +) +from pyanaconda.modules.common.task import Task as InstallationTask +from pyanaconda.modules.common.task import sync_run_task +from pyanaconda.modules.common.util import is_module_available + +log = get_module_logger(__name__) + +TARGET_LOG_DIR = "/var/log/anaconda/" + +def _writeKS_via_boss(): + boss_proxy = BOSS.get_proxy() + ks_string = boss_proxy.GenerateKickstart() + path = conf.target.system_root + "/root/anaconda-ks.cfg" + + with open_with_perm(path, "w", 0o600) as f: + f.write("# Generated by Anaconda {}\n".format(util.get_anaconda_version_string())) + f.write(ks_string) + + +class CopyLogsTask(InstallationTask): + """Task to copy logs to target system.""" + def __init__(self, sysroot): + """Create a new task. + + :param sysroot: a path to the root of installed system + :type sysroot: str + """ + super().__init__() + self._sysroot = sysroot + + @property + def name(self): + return "Copy installation logs" + + def run(self): + """Copy installation logs and other related files, and do necessary operations on them. + + - Copy logs of all kinds, incl. ks scripts, journal dump, and lorax pkg list + - Copy input kickstart file + - SELinux contexts are left as is (fixed by SetContextsTask) + """ + self._copy_kickstart() + self._copy_logs() + + def _copy_logs(self): + """Copy installation logs to the target system""" + if not conf.target.can_save_installation_logs: + log.warning("Installation logs will not be saved to the installed system due to the " + "nosave option.") + return + + log.info("Copying logs from the installation environment.") + self._create_logs_directory() + self._copy_tmp_logs() + self._copy_lorax_packages() + self._copy_pre_script_logs() + self._copy_dnf_debugdata() + self._copy_post_script_logs() + self._dump_journal() + + def _create_logs_directory(self): + """Create directory for Anaconda logs on the install target""" + make_directories(join_paths(self._sysroot, TARGET_LOG_DIR)) + + def _copy_tmp_logs(self): + """Copy a number of log files from /tmp""" + log_files_to_copy = [ + "anaconda.log", + "syslog", + "X.log", + "program.log", + "packaging.log", + "storage.log", + "ifcfg.log", + "lvm.log", + "dnf.librepo.log", + "hawkey.log", + "dbus.log", + ] + for logfile in log_files_to_copy: + self._copy_file_to_sysroot( + join_paths("/tmp/", logfile), + join_paths(TARGET_LOG_DIR, logfile) + ) + + def _copy_lorax_packages(self): + """Copy list of packages used for creating the installation media""" + self._copy_file_to_sysroot( + "/root/lorax-packages.log", + join_paths(TARGET_LOG_DIR, "lorax-packages.log") + ) + + def _copy_pre_script_logs(self): + """Copy logs from %pre scripts""" + self._copy_tree_to_sysroot( + "/tmp/pre-anaconda-logs", + TARGET_LOG_DIR + ) + + def _copy_dnf_debugdata(self): + """Copy DNF debug data""" + self._copy_tree_to_sysroot( + "/root/debugdata", + join_paths(TARGET_LOG_DIR, "dnf_debugdata/") + ) + + def _copy_post_script_logs(self): + """Copy logs from %post scripts""" + for logfile in glob.glob("/tmp/ks-script*.log"): + self._copy_file_to_sysroot( + logfile, + join_paths(TARGET_LOG_DIR, os.path.basename(logfile)) + ) + + def _dump_journal(self): + """Dump journal from the installation environment""" + tempfile = "/tmp/journal.log" + with open_with_perm(tempfile, "w", perm=0o600) as logfile: + execWithRedirect("journalctl", ["-b"], stdout=logfile, log_output=False) + self._copy_file_to_sysroot(tempfile, join_paths(TARGET_LOG_DIR, "journal.log")) + + def _copy_kickstart(self): + """Copy input kickstart file""" + if conf.target.can_copy_input_kickstart: + log.info("Copying input kickstart file.") + self._copy_file_to_sysroot( + "/run/install/ks.cfg", + "/root/original-ks.cfg" + ) + else: + log.warning("Input kickstart will not be saved to the installed system due to the " + "nosave option.") + + def _copy_file_to_sysroot(self, src, dest): + """Copy a file, if it exists, and set its access bits. + + :param str src: path to source file + :param str dest: path to destination file within sysroot + """ + if os.path.exists(src): + log.info("Copying file: %s -> %s", src, dest) + full_dest_path = join_paths(self._sysroot, dest) + shutil.copyfile( + src, + full_dest_path + ) + os.chmod(full_dest_path, 0o0600) + + def _copy_tree_to_sysroot(self, src, dest): + """Copy a directory tree, if it exists, and set its access bits. + + :param str src: path to source directory + :param str dest: path to destination directory within sysroot + """ + if os.path.exists(src): + log.info("Copying directory tree: %s -> %s", src, dest) + full_dest_path = join_paths(self._sysroot, dest) + shutil.copytree( + src, + full_dest_path, + dirs_exist_ok=True + ) + os.chmod(full_dest_path, 0o0600) + + +class SetContextsTask(InstallationTask): + """Task to set file contexts on target system. + + We need to handle SELinux relabeling for a few reasons: + + - %post scripts that write files into places in /etc, but don't do labeling correctly + - Anaconda code that does the same (e.g. moving our log files into /var/log/anaconda) + - ostree payloads, where all of the labeling of /var is the installer's responsibility + (see https://github.com/ostreedev/ostree/pull/872 ) + - OSTree variants of the traditional mounts if present + """ + def __init__(self, sysroot): + """Create a new task. + + :param sysroot: a path to the root of installed system + :type sysroot: str + """ + super().__init__() + self._sysroot = sysroot + + @property + def name(self): + return "Set file contexts" + + def run(self): + """Relabel files (set contexts). + + Do not fail if the executable is not present. + """ + dirs_to_relabel = [ + "/boot", + "/dev", + "/etc", + "/lib64", + "/root", + "/usr/lib", + "/usr/lib64", + "/var/cache/yum", + "/var/home", + "/var/lib", + "/var/lock", + "/var/log", + "/var/media", + "/var/mnt", + "/var/opt", + "/var/roothome", + "/var/run", + "/var/spool", + "/var/srv" + ] + + log.info("Restoring SELinux contexts.") + if not restorecon(dirs_to_relabel, root=self._sysroot, skip_nonexistent=True): + log.warning("Cannot restore contexts because restorecon was not installed.") + + +# Module-private helper for RunInstallationTask. +class _RemoteErrorUI: + """Error UI proxy that forwards dialog calls to the real UI over D-Bus. + + This is used in the Boss process where errorHandler.ui is not set. + It forwards showYesNoQuestion, showDetailedError, and showError + calls via the RunInstallationTask's error_raised_signal, blocking + until the UI responds via respond_to_error. + """ + + def __init__(self, task): + self._task = task + + def showYesNoQuestion(self, message): + return self._task._show_dialog(message, InstallationErrorDialogType.YES_NO) + + def showDetailedError(self, message, details, buttons=None): + full_message = message + if details: + full_message += "\n\n" + details + self._task._show_dialog(full_message, InstallationErrorDialogType.FATAL_ERROR) + return False + + def showError(self, message): + self._task._show_dialog(message, InstallationErrorDialogType.FATAL_ERROR) + + +class RunInstallationTask(InstallationTask): + """Task to run the installation queue.""" + + def __init__(self, install_manager): + """Create a new task. + """ + super().__init__() + self._total_steps = 0 + self._install_manager = install_manager + self._error_raised_signal = Signal() + self._error_response_event = Event() + self._error_should_continue = False + + # FWS: the post-install scripts task reports one step per phase instead + # of taking a single step for the whole %post, so the progress bar + # follows what the installer is actually doing. _fws_scripts_steps is + # how many steps it occupies, _fws_scripts_base the absolute position + # where the phase starts. + self._fws_scripts_task = None + self._fws_scripts_steps = 1 + self._fws_scripts_base = 0 + self._fws_scripts_active = False + + @property + def error_raised_signal(self): + """Signal emitted when an error needs user interaction. + + Carries the error message string and InstallationErrorDialogType value. + """ + return self._error_raised_signal + + def _show_dialog(self, message, dialog_type): + """Emit error signal and block until UI responds. + + :param message: the error message to display + :param dialog_type: the type of dialog to show + """ + self._error_response_event.clear() + self._error_raised_signal.emit(message, dialog_type.value) + self._error_response_event.wait() + return self._error_should_continue + + def respond_to_error(self, should_continue): + """Respond to a previously reported error. + + :param should_continue: True to continue, False to abort. + """ + self._error_should_continue = should_continue + self._error_response_event.set() + + @property + def name(self): + """Name of the task""" + return "Run the installation queue." + + @property + def steps(self): + """Total number of steps.""" + return self._total_steps + + def run(self): + """Run the task.""" + self._run_installation() + + def for_publication(self): + """Return a DBus representation.""" + return CategoryReportTaskInterface(self) + + def _queue_started_cb(self, task): + """The installation queue was started.""" + self.report_category(task.task_category) + self.report_progress(task.status_message) + + # FWS: remember where the post-install scripts start, so the sub-steps + # they report land inside the span reserved for them in _total_steps. + if task.name == "Post installation scripts" and self._fws_scripts_steps > 1: + self._fws_scripts_active = True + self._fws_scripts_base = self.progress[0] + + def _task_completed_cb(self, task): + """The installation task was completed.""" + if task is self._fws_scripts_task: + # FWS: this task owned several steps, not just one. + self._fws_scripts_active = False + self.report_progress("", step_size=self._fws_scripts_steps) + return + + self.report_progress("", step_size=1) + + def _progress_report_cb(self, step, message): + """Handle a progress report of a task.""" + if self._fws_scripts_active: + # FWS: the scripts task reports its own step numbers; translate + # them into absolute positions of the installation progress. + self.report_progress( + message, + step_number=min(self._fws_scripts_base + step, self.steps) + ) + return + + self.report_progress(message) + + def _prepare_configuration(self): + """Prepare queue with tasks configuring installed system.""" + payloads_proxy = PAYLOADS.get_proxy() + payload_path = payloads_proxy.ActivePayload + if not payload_path: + log.error("No active payload found! Can't continue install.") + raise RuntimeError("No active payload") + + payload_proxy = PAYLOADS.get_proxy(payload_path) + configuration_queue = TaskQueue("Configuration queue") + + # connect progress reporting + configuration_queue.queue_started.connect(self._queue_started_cb) + configuration_queue.task_completed.connect(self._task_completed_cb) + + # import certificates first + # they may be required for subscription, initramfs regenerating, ... ? + if is_module_available(SECURITY): + certificates_import = TaskQueue( + "Certificates import", + _("Importing certificates"), + CATEGORY_SYSTEM + ) + certificates_proxy = SECURITY.get_proxy(CERTIFICATES) + certificates_import.append_dbus_tasks(SECURITY, [ + certificates_proxy.InstallWithTask() + ]) + configuration_queue.append(certificates_import) + + # schedule the execute methods of ksdata that require an installed system to be present + os_config = TaskQueue( + "Installed system configuration", + _("Configuring installed system"), + CATEGORY_SYSTEM + ) + + # add installation tasks for the Security DBus module + if is_module_available(SECURITY): + security_proxy = SECURITY.get_proxy() + security_dbus_tasks = security_proxy.InstallWithTasks() + os_config.append_dbus_tasks(SECURITY, security_dbus_tasks) + + # add installation tasks for the Timezone DBus module + # run these tasks before tasks of the Services module + if is_module_available(TIMEZONE): + timezone_proxy = TIMEZONE.get_proxy() + timezone_dbus_tasks = timezone_proxy.InstallWithTasks() + os_config.append_dbus_tasks(TIMEZONE, timezone_dbus_tasks) + + # add installation tasks for the Services DBus module + if is_module_available(SERVICES): + services_proxy = SERVICES.get_proxy() + services_dbus_tasks = services_proxy.InstallWithTasks() + os_config.append_dbus_tasks(SERVICES, services_dbus_tasks) + + # add installation tasks for the Localization DBus module + if is_module_available(LOCALIZATION): + localization_proxy = LOCALIZATION.get_proxy() + localization_dbus_tasks = localization_proxy.InstallWithTasks() + os_config.append_dbus_tasks(LOCALIZATION, localization_dbus_tasks) + + # add the Firewall configuration task + if conf.target.can_configure_network: + firewall_proxy = NETWORK.get_proxy(FIREWALL) + firewall_dbus_task = firewall_proxy.InstallWithTask() + os_config.append_dbus_tasks(NETWORK, [firewall_dbus_task]) + + configuration_queue.append(os_config) + + # schedule network configuration (if required) + if conf.target.can_configure_network and conf.system.provides_network_config: + overwrite = payload_proxy.Type in PAYLOAD_LIVE_TYPES + network_config = TaskQueue( + "Network configuration", + _("Writing network configuration"), + CATEGORY_SYSTEM + ) + network_config.append(Task( + "Network configuration", + network.write_configuration, + (overwrite, ) + )) + configuration_queue.append(network_config) + + # add installation tasks for the Subscription DBus module + if is_module_available(SUBSCRIPTION): + # we only run the tasks if the Subscription module is available + subscription_config = TaskQueue( + "Subscription configuration", + _("Configuring Red Hat subscription"), + CATEGORY_SYSTEM + ) + subscription_proxy = SUBSCRIPTION.get_proxy() + subscription_dbus_tasks = subscription_proxy.InstallWithTasks() + subscription_config.append_dbus_tasks(SUBSCRIPTION, subscription_dbus_tasks) + configuration_queue.append(subscription_config) + + # add installation tasks for the Users DBus module + if is_module_available(USERS): + user_config = TaskQueue( + "User creation", + _("Creating users"), + CATEGORY_SYSTEM + ) + users_proxy = USERS.get_proxy() + users_dbus_tasks = users_proxy.InstallWithTasks() + user_config.append_dbus_tasks(USERS, users_dbus_tasks) + configuration_queue.append(user_config) + + # Anaconda addon configuration + addon_config = TaskQueue( + "Anaconda addon configuration", + _("Configuring addons"), + CATEGORY_SYSTEM + ) + + tasks_list = self._install_manager.collect_install_system_tasks() + for task_proxy in tasks_list: + addon_config.append(DBusTask(task_proxy)) + + configuration_queue.append(addon_config) + + # Initramfs generation + generate_initramfs = TaskQueue( + "Initramfs generation", + _("Generating initramfs"), + CATEGORY_BOOTLOADER + ) + bootloader_proxy = STORAGE.get_proxy(BOOTLOADER) + + def run_generate_initramfs(): + tasks = bootloader_proxy.GenerateInitramfsWithTasks( + payload_proxy.Type, + payloads_proxy.GetKernelVersionList() + ) + + for task in tasks: + sync_run_task(STORAGE.get_proxy(task)) + + generate_initramfs.append(Task( + "Generate initramfs", + run_generate_initramfs + )) + configuration_queue.append(generate_initramfs) + + if is_module_available(SECURITY): + security_proxy = SECURITY.get_proxy() + + # Configure FIPS. + configuration_queue.append_dbus_tasks(SECURITY, [ + security_proxy.ConfigureFIPSWithTask() + ]) + + # Join a realm. This can run only after network + # is configured in the target system chroot. + configuration_queue.append_dbus_tasks(SECURITY, [ + security_proxy.JoinRealmWithTask() + ]) + + # Calling zipl should be the last task on s390 + configuration_queue.append_dbus_tasks(STORAGE, [ + bootloader_proxy.FixZIPLBootloaderWithTask() + ]) + + # setup kexec reboot if requested + if flags.flags.kexec: + kexec_setup = TaskQueue( + "Kexec setup", + _("Setting up kexec"), + CATEGORY_BOOTLOADER + ) + kexec_setup.append(Task( + "Setup kexec", + setup_kexec + )) + configuration_queue.append(kexec_setup) + + # write anaconda related configs & kickstarts + write_configs = TaskQueue( + "Write configs and kickstarts", + _("Storing configuration files and kickstarts"), + CATEGORY_SYSTEM + ) + + # Write the kickstart file to the installed system (or, copy the input + # kickstart file over if one exists). + if conf.target.can_save_output_kickstart: + # write anaconda related configs & kickstarts + write_configs.append(Task("Store kickstarts", _writeKS_via_boss)) + else: + # don't write the kickstart file to the installed system if this has + # been disabled by the nosave option + log.warning("Writing of the output kickstart to installed system has been disabled" + " by the nosave option.") + + # only add write_configs to the main queue if we actually store some kickstarts/configs + if write_configs.task_count: + configuration_queue.append(write_configs) + + post_scripts = TaskQueue( + "Post installation scripts", + _("Running post-installation scripts"), + CATEGORY_SYSTEM + ) + scripts_proxy = RUNTIME.get_proxy(SCRIPTS) + # FWS: keep a handle on this task and learn how many steps it declares + # (one per installation phase), so the progress bar can track them. + scripts_task_proxy = RUNTIME.get_proxy( + scripts_proxy.RunScriptsWithTask(KS_SCRIPT_POST) + ) + try: + self._fws_scripts_steps = max(1, int(scripts_task_proxy.Steps)) + except DBusError: + # Progress is cosmetic: never fail the installation over it. + log.warning("FWS: cannot read the post-script steps, using one step") + self._fws_scripts_steps = 1 + self._fws_scripts_task = DBusTask(scripts_task_proxy) + post_scripts.append(self._fws_scripts_task) + configuration_queue.append(post_scripts) + + configuration_queue.append(Task( + "Copy installation logs", + CopyLogsTask(conf.target.system_root).run + )) + configuration_queue.append(Task( + "Set file contexts", + SetContextsTask(conf.target.system_root).run + )) + + return configuration_queue + + def _prepare_installation(self): + """Prepare the installation task queue. + + This method builds and returns a queue of tasks that perform the system installation. + The queue includes tasks for setting up the environment, configuring storage, + installing the software payload, running installation scripts, setting up the + bootloader, and executing post-installation steps. + """ + payloads_proxy = PAYLOADS.get_proxy() + payload_path = payloads_proxy.ActivePayload + if not payload_path: + log.error("No active payload found! Can't continue install.") + raise RuntimeError("No active payload") + + payload_proxy = PAYLOADS.get_proxy(payload_path) + installation_queue = TaskQueue("Installation queue") + + # connect progress reporting + installation_queue.queue_started.connect(self._queue_started_cb) + installation_queue.task_completed.connect(self._task_completed_cb) + + # setup the installation environment + setup_environment = TaskQueue( + "Installation environment setup", + _("Setting up the installation environment"), + CATEGORY_ENVIRONMENT + ) + + tasks_list = self._install_manager.collect_configure_runtime_tasks() + for task_proxy in tasks_list: + setup_environment.append(DBusTask(task_proxy)) + + # Add configuration tasks for the Localization DBus module. + if is_module_available(LOCALIZATION): + localization_proxy = LOCALIZATION.get_proxy() + # Populate the missing keyboard values before the payload installation, + # so the module requirements can be generated for the right configuration. + # FIXME: Make sure that the module always returns right values. + populate_task = localization_proxy.PopulateMissingKeyboardConfigurationWithTask() + setup_environment.append_dbus_tasks(LOCALIZATION, [populate_task]) + + installation_queue.append(setup_environment) + + # Do partitioning. + # Depending on current payload the storage might be apparently configured + # either before or after package/payload installation. + # So let's have two task queues - early storage & late storage. + storage_proxy = STORAGE.get_proxy() + early_storage = TaskQueue( + "Early storage configuration", + _("Configuring storage"), + CATEGORY_STORAGE + ) + early_storage.append_dbus_tasks(STORAGE, storage_proxy.InstallWithTasks()) + + if payload_proxy.Type == PAYLOAD_TYPE_DNF: + conf_task = storage_proxy.WriteConfigurationWithTask() + early_storage.append_dbus_tasks(STORAGE, [conf_task]) + + installation_queue.append(early_storage) + + # Run %pre-install scripts with the filesystem mounted and no packages + pre_install_scripts = TaskQueue( + "Pre-install scripts", + _("Running pre-installation scripts"), + CATEGORY_ENVIRONMENT + ) + scripts_proxy = RUNTIME.get_proxy(SCRIPTS) + pre_install_scripts.append_dbus_tasks(RUNTIME, [ + scripts_proxy.RunScriptsWithTask(KS_SCRIPT_PREINSTALL) + ]) + installation_queue.append(pre_install_scripts) + + # Do various pre-installation tasks + # - try to discover a realm (if any) + # - check for possibly needed additional packages. + pre_install = TaskQueue( + "Pre install tasks", + _("Running pre-installation tasks"), + CATEGORY_SOFTWARE + ) + + # Make name resolution work for rpm scripts in chroot. + # Also make sure dns resolution works in %post scripts + # when systemd-resolved is not available. + if conf.system.provides_resolver_config and \ + not is_service_installed("systemd-resolved.service"): + pre_install.append(Task( + "Copy resolv.conf to sysroot", + network.copy_resolv_conf_to_root, + (conf.target.system_root, ) + )) + + if is_module_available(SECURITY): + security_proxy = SECURITY.get_proxy() + + # Discover a realm. + pre_install.append_dbus_tasks(SECURITY, [ + security_proxy.DiscoverRealmWithTask() + ]) + + # Set up FIPS for the payload installation. + fips_task = security_proxy.PreconfigureFIPSWithTask(payload_proxy.Type) + pre_install.append_dbus_tasks(SECURITY, [fips_task]) + + # Import certificates so they are available for rpm scripts + certificates_proxy = SECURITY.get_proxy(CERTIFICATES) + certificates_task = certificates_proxy.PreInstallWithTask(payload_proxy.Type) + pre_install.append_dbus_tasks(SECURITY, [certificates_task]) + + installation_queue.append(pre_install) + + payload_install = TaskQueue( + "Payload installation", + _("Installing the software"), + CATEGORY_SOFTWARE + ) + + tasks = payloads_proxy.InstallWithTasks() + payload_install.append_dbus_tasks(PAYLOADS, tasks) + + installation_queue.append(payload_install) + + # for some payloads storage is configured after the payload is installed + if payload_proxy.Type != PAYLOAD_TYPE_DNF: + late_storage = TaskQueue( + "Late storage configuration", + _("Configuring storage"), + CATEGORY_STORAGE, + ) + conf_task = storage_proxy.WriteConfigurationWithTask() + late_storage.append_dbus_tasks(STORAGE, [conf_task]) + installation_queue.append(late_storage) + + # Do bootloader. + bootloader_proxy = STORAGE.get_proxy(BOOTLOADER) + bootloader_install = TaskQueue( + "Bootloader installation", + _("Installing boot loader"), + CATEGORY_BOOTLOADER + ) + + def run_configure_bootloader(): + task_proxies = self._install_manager.collect_configure_bootloader_tasks(payloads_proxy.GetKernelVersionList()) + + for proxy in task_proxies: + sync_run_task(proxy) + + bootloader_install.append(Task( + "Configure bootloader", + run_configure_bootloader + )) + + def run_install_bootloader(): + tasks = bootloader_proxy.InstallBootloaderWithTasks( + payload_proxy.Type, + payloads_proxy.GetKernelVersionList() + ) + + for task in tasks: + sync_run_task(STORAGE.get_proxy(task)) + + bootloader_install.append(Task( + "Install bootloader", + run_install_bootloader + )) + installation_queue.append(bootloader_install) + + post_install = TaskQueue( + "Post-installation setup tasks", + _("Performing post-installation setup tasks"), + CATEGORY_SYSTEM + ) + tasks = payloads_proxy.PostInstallWithTasks() + post_install.append_dbus_tasks(PAYLOADS, tasks) + installation_queue.append(post_install) + + # Create snapshot + snapshot_proxy = STORAGE.get_proxy(SNAPSHOT) + + if snapshot_proxy.IsRequested(SNAPSHOT_WHEN_POST_INSTALL): + snapshot_creation = TaskQueue( + "Creating post installation snapshots", + _("Creating snapshots"), + CATEGORY_STORAGE + ) + snapshot_task = snapshot_proxy.CreateWithTask(SNAPSHOT_WHEN_POST_INSTALL) + snapshot_creation.append_dbus_tasks(STORAGE, [snapshot_task]) + installation_queue.append(snapshot_creation) + + return installation_queue + + def _run_installation(self): + """Run the complete installation.""" + from pyanaconda.errors import errorHandler + + queue = TaskQueue("Complete installation queue") + queue.append(self._prepare_installation()) + queue.append(self._prepare_configuration()) + + # notify progress tracking about the number of steps + # FWS: the post-install scripts task reports its own sub-steps, so it + # takes more than the single step counted for it by task_count. + self._total_steps = queue.task_count + max(0, self._fws_scripts_steps - 1) + + # Set the progress reporting callback of the DBus tasks. + # FIXME: This is a temporary workaround. + for item in queue.nested_items: + if isinstance(item, DBusTask): + item._progress_cb = self._progress_report_cb + + # log contents of the main task queue + log.info(queue.summary) + + # log tasks and queues when they are started + # - note that we are using generators to add the counter + queue_counter = util.item_counter(queue.queue_count) + task_started_counter = util.item_counter(queue.task_count) + task_completed_counter = util.item_counter(queue.task_count) + queue.queue_started.connect( + lambda x: log.info("Queue started: %s (%s)", x.name, next(queue_counter)) + ) + queue.task_started.connect( + lambda x: log.info("Task started: %s (%s)", x.name, next(task_started_counter)) + ) + queue.task_completed.connect( + lambda x: log.debug("Task completed: %s (%s) (%1.1f s)", x.name, + next(task_completed_counter), x.elapsed_time) + ) + + # Boss has no UserInterface; during the installation queue, tasks may call + # errorHandler.cb() for non-fatal errors. Temporarily install a D-Bus proxy + # that forwards dialogs to the progress spoke in the UI process. + previous_ui = errorHandler.ui + errorHandler.ui = _RemoteErrorUI(self) + try: + queue.start() + finally: + errorHandler.ui = previous_ui + + # done + self.report_progress(_("Complete!"), step_number=self.steps) + + # this message is automatically detected by QE tools, do not change it lightly + log.info( + "All tasks in the installation queue are done. " + "Installation successfully finished." + ) diff --git a/configs/baseline/airootfs/usr/local/share/fws/anaconda-overlay/pyanaconda/modules/runtime/scripts/runtime.py b/configs/baseline/airootfs/usr/local/share/fws/anaconda-overlay/pyanaconda/modules/runtime/scripts/runtime.py new file mode 100644 index 0000000..a76c49d --- /dev/null +++ b/configs/baseline/airootfs/usr/local/share/fws/anaconda-overlay/pyanaconda/modules/runtime/scripts/runtime.py @@ -0,0 +1,199 @@ +# +# Copyright (C) 2024 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# the GNU General Public License v.2, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY expressed or implied, including the implied warranties of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. You should have received a copy of the +# GNU General Public License along with this program; if not, write to the +# Free Software Foundation, Inc., 31 Milk Street #960789 Boston, MA +# 02196 USA. Any Red Hat trademarks that are incorporated in the +# source code or documentation are not subject to the GNU General Public +# License and may only be used or replicated with the express permission of +# Red Hat, Inc. +# +# FWS: this file is an overlay of the upstream Anaconda module. Upstream runs +# every kickstart script of a type in one task without reporting anything, so +# the GUI could only say "Running post-installation scripts" and the progress +# bar sat still until the whole %post was done. FWS scripts publish their own +# progress (helper: /usr/local/bin/fws-install-step), so the task below turns +# that into one step per installation phase and a message that says which +# script is running and what it is doing. +# +import os +import re +import threading + +from pykickstart.constants import KS_SCRIPT_POST + +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.modules.common.errors.runtime import ScriptError +from pyanaconda.modules.common.task import Task + +log = get_module_logger(__name__) + +# Progress file written by fws-install-step, relative to a root. The %post +# running in the chroot writes it into the target, the --nochroot ones into +# the live system; both are read so any script can publish progress. +FWS_PROGRESS_FILE = "var/log/fws-install-progress" +FWS_PROGRESS_POLL = 0.5 + +# Title of a script, declared as its first comment: +# # FWS-TITLE: Configuration du système installé +FWS_TITLE_PATTERN = re.compile(r"^#\s*FWS-TITLE:\s*(.+?)\s*$", re.MULTILINE) + + +class _ProgressWatcher(threading.Thread): + """Follow the progress published by the running kickstart script. + + The scripts cannot talk to the installer directly: they are plain shell + processes, possibly inside a chroot. They write "|