fix(Calamares): Installater will ask the desktop env before the calamares install
- The installer is still W.I.P
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python3
|
||||
import libcalamares
|
||||
|
||||
# Chaque valeur doit avoir un /usr/local/bin/fws-desktop-init-<valeur>
|
||||
# correspondant (invariant 1:1). Toute valeur hors-set retombe sur FALLBACK.
|
||||
VALID = {"xfce", "kde", "gnome", "hyprland"}
|
||||
FALLBACK = "xfce"
|
||||
|
||||
|
||||
def pretty_name():
|
||||
return "Sélection de l'environnement de bureau"
|
||||
|
||||
|
||||
STATE = "/run/fws-desktop"
|
||||
|
||||
|
||||
def run():
|
||||
# Le choix est fait dans le live par /usr/local/bin/fws-pick-desktop, qui
|
||||
# écrit STATE (le module packagechooser n'est pas compilé dans le paquet
|
||||
# calamares AUR, donc pas de sélection côté Calamares). Ici on valide et on
|
||||
# normalise pour garantir une valeur sûre à shellprocess (repli xfce).
|
||||
choice = FALLBACK
|
||||
try:
|
||||
with open(STATE) as fh:
|
||||
raw = fh.read().strip()
|
||||
if raw in VALID:
|
||||
choice = raw
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
try:
|
||||
with open(STATE, "w") as fh:
|
||||
fh.write(choice)
|
||||
except OSError as e:
|
||||
libcalamares.utils.warning(f"fws-desktop-choice: impossible d'écrire {STATE}: {e}")
|
||||
|
||||
libcalamares.utils.debug(f"fws-desktop-choice: bureau = {choice}")
|
||||
return None
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
type: "job"
|
||||
name: "fws-desktop-choice"
|
||||
interface: "python"
|
||||
script: "main.py"
|
||||
Reference in New Issue
Block a user