feat: multi environnemnt desktop
[180][WIP]
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
# 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"
|
||||
@@ -12,10 +12,6 @@ units:
|
||||
action: "enable"
|
||||
mandatory: false
|
||||
|
||||
- name: "lightdm.service"
|
||||
action: "enable"
|
||||
mandatory: true
|
||||
|
||||
- name: "sshd.service"
|
||||
action: "enable"
|
||||
mandatory: false
|
||||
|
||||
@@ -8,14 +8,13 @@ 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"'
|
||||
|
||||
# Configure LightDM pour démarrer automatiquement la session XFCE du premier utilisateur créé.
|
||||
- 'FIRST_USER="$(awk -F: ''$$3 >= 1000 && $$1 != "nobody" { print $$1; exit }'' "${ROOT}/etc/passwd")"'
|
||||
- 'if [ -n "$$FIRST_USER" ]; then mkdir -p "${ROOT}/etc/lightdm/lightdm.conf.d"; printf ''[Seat:*]\nautologin-user=%s\nautologin-user-timeout=0\nuser-session=xfce\nautologin-session=xfce\ngreeter-hide-users=true\nallow-guest=false\n'' "$$FIRST_USER" > "${ROOT}/etc/lightdm/lightdm.conf.d/50-fws.conf"; fi'
|
||||
- 'if [ -n "$$FIRST_USER" ] && [ -d "${ROOT}/home/$$FIRST_USER" ]; then printf ''[Desktop]\nSession=xfce\n'' > "${ROOT}/home/$$FIRST_USER/.dmrc"; fi'
|
||||
- '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)
|
||||
- '-rm -f "${ROOT}/etc/mkinitcpio.conf.d/archiso.conf"'
|
||||
- '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
|
||||
|
||||
@@ -12,6 +12,7 @@ sequence:
|
||||
- keyboard
|
||||
- partition
|
||||
- users
|
||||
- desktop
|
||||
- summary
|
||||
- exec:
|
||||
- partition
|
||||
|
||||
@@ -61,6 +61,7 @@ wget
|
||||
zsh
|
||||
grml-zsh-config
|
||||
bash
|
||||
zenity
|
||||
nano
|
||||
vim
|
||||
less
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
# Script de lancement de Calamares
|
||||
# ============================================================
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Vérifie que Calamares est installé
|
||||
if ! command -v calamares &>/dev/null; then
|
||||
if ! command -v calamares >/dev/null 2>&1; then
|
||||
echo "ERREUR : calamares n'est pas installé."
|
||||
exit 1
|
||||
fi
|
||||
@@ -15,17 +17,91 @@ if [ ! -d /run/archiso ]; then
|
||||
echo "ATTENTION : Ce script doit être lancé depuis le live FWS."
|
||||
fi
|
||||
|
||||
choose_desktop() {
|
||||
local selection
|
||||
|
||||
if command -v zenity >/dev/null 2>&1; then
|
||||
selection=$(zenity --list \
|
||||
--title="Choix de l'environnement" \
|
||||
--width=520 \
|
||||
--height=320 \
|
||||
--radiolist \
|
||||
--print-column=2 \
|
||||
--column="Choisir" --column="Environnement" --column="Description" \
|
||||
TRUE "xfce" "Léger et classique" \
|
||||
FALSE "kde" "KDE Plasma" \
|
||||
FALSE "gnome" "GNOME" \
|
||||
FALSE "hyprland" "Wayland / Hyprland" \
|
||||
--text="Sélectionne l'environnement desktop à installer") || exit 1
|
||||
|
||||
printf '%s' "$selection"
|
||||
return 0
|
||||
fi
|
||||
|
||||
printf 'xfce'
|
||||
}
|
||||
|
||||
DESKTOP="${FWS_DESKTOP:-xfce}"
|
||||
DESKTOP_EXPLICIT=0
|
||||
CALAMARES_ARGS=()
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
-d|--desktop)
|
||||
shift
|
||||
DESKTOP="${1:-xfce}"
|
||||
DESKTOP_EXPLICIT=1
|
||||
;;
|
||||
--desktop=*)
|
||||
DESKTOP="${1#*=}"
|
||||
DESKTOP_EXPLICIT=1
|
||||
;;
|
||||
*)
|
||||
CALAMARES_ARGS+=("$1")
|
||||
;;
|
||||
esac
|
||||
shift || true
|
||||
done
|
||||
|
||||
if [ "$DESKTOP_EXPLICIT" -eq 0 ] && [ -z "${FWS_DESKTOP:-}" ]; then
|
||||
DESKTOP="$(choose_desktop)"
|
||||
fi
|
||||
|
||||
case "$DESKTOP" in
|
||||
xfce|kde|gnome|hyprland)
|
||||
export FWS_DESKTOP="$DESKTOP"
|
||||
;;
|
||||
*)
|
||||
echo "Environnement invalide: $DESKTOP"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Lance Calamares avec les droits root
|
||||
# -D6 active les logs de debug (retirer en production)
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
if command -v sudo >/dev/null 2>&1; then
|
||||
exec sudo -E calamares "$@"
|
||||
# Persist the chosen desktop for Calamares (read by shellprocess before chroot)
|
||||
if [ -n "${FWS_DESKTOP:-}" ]; then
|
||||
mkdir -p /run
|
||||
printf '%s' "$FWS_DESKTOP" > /run/fws-desktop
|
||||
fi
|
||||
exec sudo -E calamares "${CALAMARES_ARGS[@]}"
|
||||
elif command -v pkexec >/dev/null 2>&1; then
|
||||
exec pkexec calamares "$@"
|
||||
if [ -n "${FWS_DESKTOP:-}" ]; then
|
||||
mkdir -p /run
|
||||
printf '%s' "$FWS_DESKTOP" > /run/fws-desktop
|
||||
fi
|
||||
exec pkexec calamares "${CALAMARES_ARGS[@]}"
|
||||
else
|
||||
echo "ERREUR : Impossible de lancer Calamares en tant que root (sudo/pkexec non trouvés)."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
exec calamares "$@"
|
||||
if [ -n "${FWS_DESKTOP:-}" ]; then
|
||||
mkdir -p /run
|
||||
printf '%s' "$FWS_DESKTOP" > /run/fws-desktop
|
||||
fi
|
||||
exec calamares "${CALAMARES_ARGS[@]}"
|
||||
fi
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
fws_first_user() {
|
||||
awk -F: '$3 >= 1000 && $1 != "nobody" { print $1; exit }' /etc/passwd
|
||||
}
|
||||
|
||||
fws_install_packages() {
|
||||
pacman -Sy --noconfirm --needed "$@"
|
||||
}
|
||||
|
||||
fws_enable_services() {
|
||||
for service in "$@"; do
|
||||
systemctl enable "$service" >/dev/null 2>&1 || true
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
fws_disable_services() {
|
||||
for service in "$@"; do
|
||||
systemctl disable "$service" >/dev/null 2>&1 || true
|
||||
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_write_lightdm_config() {
|
||||
local user_name="$1"
|
||||
local session_name="$2"
|
||||
|
||||
if [ -z "$user_name" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
mkdir -p /etc/lightdm/lightdm.conf.d
|
||||
printf '[Seat:*]\nautologin-user=%s\nautologin-user-timeout=0\nuser-session=%s\nautologin-session=%s\ngreeter-hide-users=true\nallow-guest=false\n' "$user_name" "$session_name" "$session_name" > /etc/lightdm/lightdm.conf.d/50-fws.conf
|
||||
}
|
||||
|
||||
fws_write_sddm_config() {
|
||||
local user_name="$1"
|
||||
local session_name="$2"
|
||||
|
||||
if [ -z "$user_name" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
mkdir -p /etc/sddm.conf.d
|
||||
printf '[Autologin]\nUser=%s\nSession=%s.desktop\nRelogin=false\n' "$user_name" "$session_name" > /etc/sddm.conf.d/50-fws.conf
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
. /usr/local/bin/fws-desktop-init-common
|
||||
|
||||
first_user="$(fws_first_user)"
|
||||
|
||||
fws_install_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
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
. /usr/local/bin/fws-desktop-init-common
|
||||
|
||||
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
|
||||
fws_disable_services lightdm.service gdm.service
|
||||
fws_enable_services sddm.service
|
||||
fws_write_sddm_config "$first_user" hyprland
|
||||
fws_write_dmrc "$first_user" hyprland
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
. /usr/local/bin/fws-desktop-init-common
|
||||
|
||||
first_user="$(fws_first_user)"
|
||||
|
||||
fws_install_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
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
. /usr/local/bin/fws-desktop-init-common
|
||||
|
||||
first_user="$(fws_first_user)"
|
||||
|
||||
fws_install_packages xfce4 xfce4-goodies lightdm lightdm-gtk-greeter
|
||||
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
|
||||
Reference in New Issue
Block a user