fix(Calamares): Installater will ask the desktop env before the calamares install
- The installer is still W.I.P
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import calamares 1.0
|
||||
|
||||
Page {
|
||||
id: page
|
||||
title: qsTr("Choix de l'environnement")
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 20
|
||||
spacing: 12
|
||||
|
||||
Text {
|
||||
text: qsTr("Choisissez l'environnement de bureau à installer :")
|
||||
font.pixelSize: 20
|
||||
color: "#00d4ff"
|
||||
}
|
||||
|
||||
RadioButton { id: rb_xfce; text: "Xfce"; checked: true; onCheckedChanged: if (checked) saveChoice() }
|
||||
RadioButton { id: rb_kde; text: "KDE"; onCheckedChanged: if (checked) saveChoice() }
|
||||
RadioButton { id: rb_gnome; text: "GNOME"; onCheckedChanged: if (checked) saveChoice() }
|
||||
RadioButton { id: rb_hypr; text: "Hyprland"; onCheckedChanged: if (checked) saveChoice() }
|
||||
|
||||
Button {
|
||||
text: qsTr("Enregistrer le choix")
|
||||
onClicked: saveChoice()
|
||||
}
|
||||
|
||||
function saveChoice() {
|
||||
var choice = rb_xfce.checked ? "xfce" : (rb_kde.checked ? "kde" : (rb_gnome.checked ? "gnome" : "hyprland"))
|
||||
try {
|
||||
calamares.globalStorage.insert("FWS_DESKTOP", choice)
|
||||
} catch (e) {
|
||||
// ignore if unavailable
|
||||
}
|
||||
try {
|
||||
calamares.utils.runCommand("/bin/sh", ["-c", "printf '%s' \"" + choice + "\" > /run/fws-desktop"], true)
|
||||
} catch (e) {
|
||||
// best effort
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,39 @@
|
||||
|
||||
dontChroot: true
|
||||
|
||||
# Timeout par défaut (secondes) appliqué à chaque commande.
|
||||
# La valeur par défaut de Calamares est 30 s — beaucoup trop courte
|
||||
# pour l'installation d'un bureau complet (pacman télécharge des
|
||||
# centaines de Mo). On relève le défaut et on accorde un délai
|
||||
# spécifique très large à la commande d'init du bureau.
|
||||
timeout: 300
|
||||
|
||||
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"'
|
||||
- 'chroot "${ROOT}" /bin/bash "/usr/local/bin/fws-desktop-init-$(cat /run/fws-desktop 2>/dev/null || printf xfce)"'
|
||||
# Installation du bureau choisi : peut être long (réseau + gros DE
|
||||
# comme KDE/GNOME) → 1 h de marge pour ne jamais expirer à tort.
|
||||
#
|
||||
# arch-chroot (et non « chroot » brut) : monte /proc /sys /dev /run et
|
||||
# copie resolv.conf dans la cible. Indispensable, sinon les hooks
|
||||
# post-transaction de pacman (systemd daemon-reload, udev, tmpfiles…)
|
||||
# échouent faute de ces points de montage → pacman sort en code 1
|
||||
# alors même que les téléchargements ont réussi.
|
||||
# Le nom du bureau est validé contre une allow-list (mêmes valeurs que
|
||||
# les scripts fws-desktop-init-* présents) : toute valeur vide / inconnue
|
||||
# / avec espace parasite retombe sur xfce → jamais d'abandon d'install sur
|
||||
# un script d'init manquant.
|
||||
- command: 'd="$(cat /run/fws-desktop 2>/dev/null)"; d="${d%%[[:space:]]*}"; case "$d" in xfce|kde|gnome|hyprland) ;; *) d=xfce ;; esac; arch-chroot "${ROOT}" /bin/bash "/usr/local/bin/fws-desktop-init-$d"'
|
||||
timeout: 3600
|
||||
|
||||
# ── Nettoyage des artefacts « live-only » qui ne doivent PAS persister
|
||||
# sur le système installé (le squashfs du live devient le root cible) ──
|
||||
# 1) Autologin root SANS mot de passe sur tty1 (drop-in getty du live) :
|
||||
# trou de sécurité + conflit avec le display manager sur vt1.
|
||||
- 'rm -rf "${ROOT}/etc/systemd/system/getty@tty1.service.d"'
|
||||
# 2) Provisionnement auto archiso (param noyau script=) : ne doit jamais
|
||||
# tourner sur la machine installée.
|
||||
- 'rm -f "${ROOT}/root/.zlogin" "${ROOT}/root/.automated_script.sh"'
|
||||
|
||||
# Supprime le drop-in archiso (surcharge HOOKS avec des hooks inexistants post-install)
|
||||
- 'rm -f "${ROOT}/etc/mkinitcpio.conf.d/archiso.conf"'
|
||||
|
||||
@@ -6,13 +6,16 @@
|
||||
modules-search: [ local, /usr/lib/calamares/modules ]
|
||||
|
||||
sequence:
|
||||
# NB : pas de module `packagechooser` ici — il n'est pas compilé dans le
|
||||
# paquet calamares (AUR). Le choix du bureau se fait dans le live via
|
||||
# /usr/local/bin/fws-pick-desktop (écrit /run/fws-desktop), validé ensuite
|
||||
# par le job `fws-desktop-choice` ci-dessous.
|
||||
- show:
|
||||
- welcome
|
||||
- locale
|
||||
- keyboard
|
||||
- partition
|
||||
- users
|
||||
- packagechooser
|
||||
- summary
|
||||
- exec:
|
||||
- partition
|
||||
|
||||
@@ -7,4 +7,9 @@ fi
|
||||
xsetroot -solid "#1a1a2e"
|
||||
openbox &
|
||||
sleep 1
|
||||
|
||||
# Choix du bureau AVANT Calamares (le module packagechooser n'est pas compilé
|
||||
# dans le paquet calamares AUR). Écrit /run/fws-desktop, lu pendant l'install.
|
||||
/usr/local/bin/fws-pick-desktop || true
|
||||
|
||||
exec calamares
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# fix for screen readers
|
||||
if grep -Fqa 'accessibility=' /proc/cmdline &> /dev/null; then
|
||||
setopt SINGLE_LINE_ZLE
|
||||
fi
|
||||
|
||||
# Provisionnement automatique archiso (param noyau script=) : LIVE uniquement.
|
||||
# Sur le système installé /run/archiso n'existe pas ; de plus shellprocess.conf
|
||||
# retire ce fichier de la cible. Ceci est une seconde barrière de sécurité.
|
||||
if [[ -d /run/archiso ]]; then
|
||||
~/.automated_script.sh
|
||||
fi
|
||||
+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"
|
||||
@@ -14,6 +14,23 @@ pacman_conf="pacman.conf"
|
||||
airootfs_image_type="squashfs"
|
||||
airootfs_image_tool_options=('-comp' 'xz' '-Xbcj' 'x86' '-b' '1M' '-Xdict-size' '1M')
|
||||
bootstrap_tarball_compression=(xz -9e)
|
||||
# NB : ce profiledef.sh ÉCRASE celui de configs/releng/ lors de la fusion du
|
||||
# build (baseline prioritaire). Il doit donc être un SUR-ENSEMBLE des
|
||||
# permissions de releng, sinon les helpers live perdent leur bit exécutable
|
||||
# (ils sont versionnés en 0644) et /root/.gnupg perd son 0700 (gpg refuse).
|
||||
file_permissions=(
|
||||
["/etc/shadow"]="0:0:400"
|
||||
["/root"]="0:0:750"
|
||||
["/root/.automated_script.sh"]="0:0:755"
|
||||
["/root/.gnupg"]="0:0:700"
|
||||
["/usr/local/bin/choose-mirror"]="0:0:755"
|
||||
["/usr/local/bin/Installation_guide"]="0:0:755"
|
||||
["/usr/local/bin/livecd-sound"]="0:0:755"
|
||||
["/usr/local/bin/fws-pick-desktop"]="0:0:755"
|
||||
["/usr/bin/fws-installer"]="0:0:755"
|
||||
["/usr/local/bin/fws-desktop-init-common"]="0:0:755"
|
||||
["/usr/local/bin/fws-desktop-init-xfce"]="0:0:755"
|
||||
["/usr/local/bin/fws-desktop-init-kde"]="0:0:755"
|
||||
["/usr/local/bin/fws-desktop-init-gnome"]="0:0:755"
|
||||
["/usr/local/bin/fws-desktop-init-hyprland"]="0:0:755"
|
||||
)
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+48
-8
@@ -5,8 +5,50 @@ fws_first_user() {
|
||||
awk -F: '$3 >= 1000 && $1 != "nobody" { print $1; exit }' /etc/passwd
|
||||
}
|
||||
|
||||
FWS_LOG=/var/log/fws-desktop-init.log
|
||||
|
||||
# Paquets communs à TOUS les bureaux graphiques. La cible de base n'installe
|
||||
# rien de tout ça (packages.conf ne fait que des « remove »), donc chaque
|
||||
# bureau doit les tirer explicitement : audio (PipeWire), applet réseau NM,
|
||||
# accès volumes (gvfs), dossiers utilisateur, trousseau, polices (dont emoji).
|
||||
# (Xfce a déjà sa propre liste complète et n'utilise pas ce tableau.)
|
||||
FWS_BASE_PACKAGES=(
|
||||
pipewire pipewire-alsa pipewire-pulse wireplumber pavucontrol
|
||||
networkmanager network-manager-applet
|
||||
gvfs gvfs-mtp gvfs-gphoto2 gvfs-smb
|
||||
xdg-user-dirs xdg-user-dirs-gtk xdg-utils
|
||||
gnome-keyring libsecret polkit
|
||||
noto-fonts noto-fonts-emoji ttf-dejavu ttf-liberation
|
||||
)
|
||||
|
||||
fws_install_packages() {
|
||||
pacman -Sy --noconfirm --needed "$@"
|
||||
# NE PAS faire « pacman -Sy <paquets> » : rafraîchir les bases sans
|
||||
# upgrader le système (partial upgrade) provoque des « conflicting
|
||||
# files » / dépendances cassées → pacman sort en code 1.
|
||||
#
|
||||
# 1) Rafraîchit d'abord archlinux-keyring (seule exception admise au
|
||||
# partial upgrade) : son hook relance pacman-key --populate et évite
|
||||
# les erreurs de signature dans le chroot.
|
||||
pacman -Sy --noconfirm --needed archlinux-keyring 2>&1 | tee -a "$FWS_LOG" || true
|
||||
|
||||
# 2) -Syu COMPLET. On désactive CheckSpace à la volée via une conf
|
||||
# temporaire (process substitution) : le calcul d'espace est non
|
||||
# fiable pendant une install en chroot et peut faire échouer pacman.
|
||||
# La conf du système installé (/etc/pacman.conf) reste intacte.
|
||||
# --noconfirm sélectionne le provider par défaut (ex.
|
||||
# qt6-multimedia-ffmpeg) sans bloquer sur une saisie.
|
||||
if ! pacman --config <(sed 's/^[[:space:]]*CheckSpace/#CheckSpace/' /etc/pacman.conf) \
|
||||
-Syu --noconfirm --needed "$@" 2>&1 | tee -a "$FWS_LOG"; then
|
||||
# Surface l'erreur réelle (sinon noyée/tronquée dans la boîte
|
||||
# Calamares). Tout est aussi conservé dans $FWS_LOG sur la cible.
|
||||
echo "" >&2
|
||||
echo "######## ÉCHEC pacman — log complet : $FWS_LOG (système installé) ########" >&2
|
||||
echo "######## Lignes d'erreur détectées : ########" >&2
|
||||
grep -iE "error|conflicting|exists in filesystem|no space|impossible|introuvable|failed" \
|
||||
"$FWS_LOG" | tail -n 25 >&2
|
||||
echo "#########################################################################" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
fws_enable_services() {
|
||||
@@ -22,13 +64,11 @@ fws_disable_services() {
|
||||
done
|
||||
}
|
||||
|
||||
fws_write_dmrc() {
|
||||
local user_name="$1"
|
||||
local session_name="$2"
|
||||
|
||||
if [ -n "$user_name" ] && [ -d "/home/$user_name" ]; then
|
||||
printf '[Desktop]\nSession=%s\n' "$session_name" > "/home/$user_name/.dmrc"
|
||||
fi
|
||||
fws_set_graphical_default() {
|
||||
# Système installé : démarrer en mode graphique (lance le display manager).
|
||||
# Idempotent ; le défaut systemd est déjà graphical.target mais on le rend
|
||||
# explicite pour ne dépendre d'aucun héritage du squashfs archiso.
|
||||
systemctl set-default graphical.target >/dev/null 2>&1 || true
|
||||
}
|
||||
|
||||
fws_write_lightdm_config() {
|
||||
|
||||
Regular → Executable
+3
-3
@@ -5,8 +5,8 @@ set -euo pipefail
|
||||
|
||||
first_user="$(fws_first_user)"
|
||||
|
||||
fws_install_packages gnome sddm
|
||||
fws_install_packages "${FWS_BASE_PACKAGES[@]}" gnome sddm
|
||||
fws_disable_services lightdm.service gdm.service
|
||||
fws_enable_services sddm.service
|
||||
fws_write_sddm_config "$first_user" gnome
|
||||
fws_write_dmrc "$first_user" gnome
|
||||
fws_set_graphical_default
|
||||
fws_write_sddm_config "$first_user" gnome
|
||||
Regular → Executable
+40
-2
@@ -5,8 +5,46 @@ set -euo pipefail
|
||||
|
||||
first_user="$(fws_first_user)"
|
||||
|
||||
fws_install_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
|
||||
# Config Hyprland minimale + autostart (agent polkit, barre, applet réseau,
|
||||
# notifications). Sans config ni agent polkit, la session est inutilisable
|
||||
# pour un non-technicien (pas de raccourcis, pas d'élévation de privilèges GUI).
|
||||
fws_write_hyprland_config() {
|
||||
local user_name="$1"
|
||||
[ -n "$user_name" ] && [ -d "/home/$user_name" ] || return 0
|
||||
local cfg_dir="/home/$user_name/.config/hypr"
|
||||
install -d -m 755 "$cfg_dir"
|
||||
if [ -f /usr/share/hypr/hyprland.conf ]; then
|
||||
cp -f /usr/share/hypr/hyprland.conf "$cfg_dir/hyprland.conf"
|
||||
else
|
||||
cat > "$cfg_dir/hyprland.conf" <<'EOF'
|
||||
$terminal = kitty
|
||||
$menu = wofi --show drun
|
||||
bind = SUPER, Q, exec, $terminal
|
||||
bind = SUPER, R, exec, $menu
|
||||
bind = SUPER, C, killactive
|
||||
bind = SUPER, M, exit
|
||||
EOF
|
||||
fi
|
||||
cat >> "$cfg_dir/hyprland.conf" <<'EOF'
|
||||
|
||||
# ── FWS : démarrage automatique de la session ──
|
||||
exec-once = systemctl --user start hyprpolkitagent
|
||||
exec-once = waybar
|
||||
exec-once = nm-applet --indicator
|
||||
exec-once = mako
|
||||
EOF
|
||||
chown -R "$user_name:$user_name" "/home/$user_name/.config"
|
||||
}
|
||||
|
||||
# PipeWire/applet NM/polices viennent de FWS_BASE_PACKAGES ; hyprpolkitagent
|
||||
# fournit l'agent d'authentification polkit pour Wayland/Hyprland.
|
||||
fws_install_packages "${FWS_BASE_PACKAGES[@]}" \
|
||||
hyprland xdg-desktop-portal-hyprland xdg-desktop-portal-gtk \
|
||||
waybar wofi kitty mako swaybg swayidle swaylock \
|
||||
xorg-xwayland wl-clipboard grim slurp \
|
||||
qt5-wayland qt6-wayland hyprpolkitagent sddm
|
||||
fws_disable_services lightdm.service gdm.service
|
||||
fws_enable_services sddm.service
|
||||
fws_set_graphical_default
|
||||
fws_write_sddm_config "$first_user" hyprland
|
||||
fws_write_dmrc "$first_user" hyprland
|
||||
fws_write_hyprland_config "$first_user"
|
||||
Regular → Executable
+3
-3
@@ -5,8 +5,8 @@ set -euo pipefail
|
||||
|
||||
first_user="$(fws_first_user)"
|
||||
|
||||
fws_install_packages plasma-meta konsole dolphin sddm
|
||||
fws_install_packages "${FWS_BASE_PACKAGES[@]}" plasma-meta konsole dolphin sddm
|
||||
fws_disable_services lightdm.service gdm.service
|
||||
fws_enable_services sddm.service
|
||||
fws_write_sddm_config "$first_user" plasma
|
||||
fws_write_dmrc "$first_user" plasma
|
||||
fws_set_graphical_default
|
||||
fws_write_sddm_config "$first_user" plasma
|
||||
Regular → Executable
+2
-2
@@ -22,5 +22,5 @@ fws_install_packages \
|
||||
upower
|
||||
fws_disable_services sddm.service gdm.service
|
||||
fws_enable_services lightdm.service
|
||||
fws_write_lightdm_config "$first_user" xfce
|
||||
fws_write_dmrc "$first_user" xfce
|
||||
fws_set_graphical_default
|
||||
fws_write_lightdm_config "$first_user" xfce
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
# ============================================================
|
||||
# FWS — Sélecteur d'environnement de bureau (LIVE uniquement)
|
||||
#
|
||||
# Le paquet calamares (AUR) ne compile PAS le module packagechooser :
|
||||
# on choisit donc le bureau ICI, dans le live, AVANT de lancer Calamares.
|
||||
# Le choix est écrit dans /run/fws-desktop, lu ensuite par :
|
||||
# - le module Calamares fws-desktop-choice (validation),
|
||||
# - shellprocess.conf → /usr/local/bin/fws-desktop-init-<bureau>.
|
||||
# ============================================================
|
||||
set -u
|
||||
|
||||
STATE=/run/fws-desktop
|
||||
DEFAULT=xfce
|
||||
VALID_RE='^(xfce|kde|gnome|hyprland)$'
|
||||
|
||||
choice=""
|
||||
|
||||
# Dialogue graphique si zenity + X sont disponibles ; sinon repli silencieux.
|
||||
if command -v zenity >/dev/null 2>&1 && [ -n "${DISPLAY:-}" ]; then
|
||||
choice="$(zenity --list --radiolist \
|
||||
--title="FWS — Environnement de bureau" \
|
||||
--text="Choisissez le bureau à installer :" \
|
||||
--width=560 --height=360 \
|
||||
--column="Choix" --column="id" --column="Bureau" \
|
||||
--hide-column=2 --print-column=2 \
|
||||
TRUE xfce "Xfce — léger, stable et rapide (recommandé)" \
|
||||
FALSE kde "KDE Plasma — moderne et très personnalisable" \
|
||||
FALSE gnome "GNOME — épuré et intuitif" \
|
||||
FALSE hyprland "Hyprland — compositeur Wayland dynamique" \
|
||||
2>/dev/null)"
|
||||
fi
|
||||
|
||||
# Normalisation : toute valeur vide / annulée / invalide → bureau par défaut.
|
||||
choice="$(printf '%s' "$choice" | tr -d '[:space:]')"
|
||||
if ! printf '%s' "$choice" | grep -Eq "$VALID_RE"; then
|
||||
choice="$DEFAULT"
|
||||
fi
|
||||
|
||||
printf '%s' "$choice" > "$STATE"
|
||||
exit 0
|
||||
Regular → Executable
Reference in New Issue
Block a user