feat(Installer): Add Multi Desktop environnement in the installer to allow the user to choose wich desktop env
This commit is contained in:
@@ -1,8 +1,65 @@
|
||||
---
|
||||
# Minimal Calamares view module config for desktop selection
|
||||
# This tells Calamares to use our QML page from the branding folder.
|
||||
module: view
|
||||
name: desktop
|
||||
qml: "branding/fws/desktop.qml"
|
||||
title: "Choix de l'environnement"
|
||||
description: "Sélectionne le bureau à installer"
|
||||
# Module packagechooser : sélection d'environnement de bureau
|
||||
# Un seul choix possible (boutons radio)
|
||||
|
||||
mode: required
|
||||
id: desktop
|
||||
|
||||
items:
|
||||
- id: xfce
|
||||
packages: []
|
||||
name:
|
||||
- locale: ""
|
||||
value: "Xfce (Recommandé)"
|
||||
description:
|
||||
- locale: ""
|
||||
value: "Léger, rapide et stable — déjà inclus dans l'ISO, aucun téléchargement."
|
||||
|
||||
- id: kde
|
||||
packages:
|
||||
- plasma-meta
|
||||
- konsole
|
||||
- dolphin
|
||||
- sddm
|
||||
name:
|
||||
- locale: ""
|
||||
value: "KDE Plasma"
|
||||
description:
|
||||
- locale: ""
|
||||
value: "Bureau moderne, riche en fonctionnalités et très personnalisable."
|
||||
|
||||
- id: gnome
|
||||
packages:
|
||||
- gnome
|
||||
- gdm
|
||||
name:
|
||||
- locale: ""
|
||||
value: "GNOME"
|
||||
description:
|
||||
- locale: ""
|
||||
value: "Interface épurée centrée sur la productivité."
|
||||
|
||||
- id: hyprland
|
||||
packages:
|
||||
- hyprland
|
||||
- xdg-desktop-portal-hyprland
|
||||
- xdg-desktop-portal-gtk
|
||||
- waybar
|
||||
- wofi
|
||||
- kitty
|
||||
- swaybg
|
||||
- swayidle
|
||||
- swaylock
|
||||
- xorg-xwayland
|
||||
- wl-clipboard
|
||||
- grim
|
||||
- slurp
|
||||
- qt5-wayland
|
||||
- qt6-wayland
|
||||
- sddm
|
||||
name:
|
||||
- locale: ""
|
||||
value: "Hyprland"
|
||||
description:
|
||||
- locale: ""
|
||||
value: "Compositeur Wayland dynamique — tiling Wayland (utilisateurs avancés)."
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Calamares job : lit le choix de bureau depuis GlobalStorage
|
||||
(packagechooser_desktop) et l'écrit dans /run/fws-desktop pour
|
||||
que shellprocess puisse appeler le bon fws-desktop-init-*.
|
||||
"""
|
||||
import libcalamares
|
||||
|
||||
VALID_DESKTOPS = {"xfce", "kde", "gnome", "hyprland"}
|
||||
FALLBACK = "xfce"
|
||||
|
||||
|
||||
def pretty_name():
|
||||
return "Sauvegarde du choix d'environnement de bureau"
|
||||
|
||||
|
||||
def run():
|
||||
gs = libcalamares.globalstorage
|
||||
|
||||
raw = gs.value("packagechooser_desktop")
|
||||
|
||||
# packagechooser peut renvoyer une str ou une liste selon la version
|
||||
if isinstance(raw, list):
|
||||
choice = raw[0] if raw else FALLBACK
|
||||
elif isinstance(raw, str):
|
||||
choice = raw.strip()
|
||||
else:
|
||||
choice = FALLBACK
|
||||
|
||||
if choice not in VALID_DESKTOPS:
|
||||
choice = FALLBACK
|
||||
|
||||
try:
|
||||
with open("/run/fws-desktop", "w") as fh:
|
||||
fh.write(choice)
|
||||
except OSError as exc:
|
||||
return (
|
||||
"Impossible d'écrire /run/fws-desktop",
|
||||
f"{exc}\nLe bureau sera xfce par défaut.",
|
||||
)
|
||||
|
||||
libcalamares.utils.debug(f"fws-desktop-choice : bureau sélectionné = {choice}")
|
||||
return None
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
type: "job"
|
||||
name: "fws-desktop-choice"
|
||||
interface: "python"
|
||||
script: "main.py"
|
||||
@@ -1,13 +1,11 @@
|
||||
---
|
||||
# Étape post-unpackfs : retire les paquets live-only.
|
||||
# Tous les paquets utiles sont déjà dans le squashfs.
|
||||
# Pas besoin d'installer quoi que ce soit depuis internet.
|
||||
|
||||
backend: pacman
|
||||
update_db: false
|
||||
update_db: true
|
||||
update_system: false
|
||||
|
||||
operations:
|
||||
- install:
|
||||
- packagechooser_desktop
|
||||
- remove:
|
||||
- calamares
|
||||
- kpmcore
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
---
|
||||
# Exécuté HORS chroot (live system) pour accéder à l'ISO montée.
|
||||
# But : restaurer le kernel (retiré du squashfs par mkarchiso) et
|
||||
# corriger les fichiers mkinitcpio archiso-spécifiques.
|
||||
# But : restaurer le kernel, détecter le bureau installé, lancer son init.
|
||||
|
||||
dontChroot: true
|
||||
|
||||
script:
|
||||
# Copie le kernel depuis l'ISO vers /boot du système cible
|
||||
- 'cp "$(find /run/archiso/bootmnt -name vmlinuz-linux 2>/dev/null | head -1)" "${ROOT}/boot/vmlinuz-linux"'
|
||||
- 'DESKTOP="$(cat /run/fws-desktop 2>/dev/null || printf xfce)"'
|
||||
- 'if [ -z "$DESKTOP" ]; then DESKTOP="xfce"; fi'
|
||||
- 'if [ ! -f "${ROOT}/usr/local/bin/fws-desktop-init-$DESKTOP" ]; then echo "Script bureau introuvable: $DESKTOP" >&2; exit 1; fi'
|
||||
- 'chroot "${ROOT}" /bin/bash "/usr/local/bin/fws-desktop-init-$DESKTOP"'
|
||||
|
||||
# Supprime le drop-in archiso (surcharge HOOKS avec des hooks inexistants post-install)
|
||||
# Détecte le bureau installé en vérifiant les binaires présents dans la cible.
|
||||
# (packagechooser a déjà installé les paquets via le module packages)
|
||||
# Xfce est toujours présent (squashfs) donc on le garde en fallback.
|
||||
- 'if [ -f "${ROOT}/usr/bin/plasmashell" ]; then DESKTOP=kde; elif [ -f "${ROOT}/usr/bin/gnome-shell" ]; then DESKTOP=gnome; elif [ -f "${ROOT}/usr/bin/hyprland" ]; then DESKTOP=hyprland; else DESKTOP=xfce; fi'
|
||||
|
||||
# Lance le script d'initialisation du bureau choisi
|
||||
- 'if [ ! -f "${ROOT}/usr/local/bin/fws-desktop-init-${DESKTOP}" ]; then echo "Script introuvable pour le bureau: ${DESKTOP}" >&2; exit 1; fi'
|
||||
- 'chroot "${ROOT}" /bin/bash "/usr/local/bin/fws-desktop-init-${DESKTOP}"'
|
||||
|
||||
# Supprime le drop-in archiso (surcharge HOOKS inexistants post-install)
|
||||
- 'rm -f "${ROOT}/etc/mkinitcpio.conf.d/archiso.conf"'
|
||||
|
||||
# Remplace le linux.preset archiso par le preset standard (default + fallback)
|
||||
# \x27 = ' et \x22 = " pour éviter les conflits de quotes dans YAML/bash
|
||||
- 'printf "PRESETS=(\x27default\x27 \x27fallback\x27)\nALL_kver=\x22/boot/vmlinuz-linux\x22\nALL_config=\x22/etc/mkinitcpio.conf\x22\nALL_microcode=(/boot/*-ucode.img)\ndefault_image=\x22/boot/initramfs-linux.img\x22\nfallback_image=\x22/boot/initramfs-linux-fallback.img\x22\nfallback_options=\x22-S autodetect\x22\n" > "${ROOT}/etc/mkinitcpio.d/linux.preset"'
|
||||
|
||||
Reference in New Issue
Block a user