fix(anaconda): improve desktop environment setup and system configuration
- Fix XFCE display manager: replace lightdm-gtk-greeter with sddm for consistency - Add SDDM numlock initialization for KDE, XFCE, and Hyprland - Configure X11 keyboard layout from kickstart or locale via langtable to ensure correct SDDM login keyboard - Enable wheel group sudo access and add all human users to wheel group - Apply FWS branding to os-release, lsb-release, and GRUB configuration - Remove inappropriate live system motd file - Fix DNS resolution: configure systemd-resolved stub resolver with NetworkManager integration to prevent "Limited Connectivity" on first boot - Reformat case statement for better readability
This commit is contained in:
@@ -210,10 +210,10 @@ DESK="cli"
|
|||||||
[ -f /tmp/fws-desktop ] && DESK="$(tr -d '[:space:]' < /tmp/fws-desktop)"
|
[ -f /tmp/fws-desktop ] && DESK="$(tr -d '[:space:]' < /tmp/fws-desktop)"
|
||||||
DM=""
|
DM=""
|
||||||
case "$DESK" in
|
case "$DESK" in
|
||||||
kde) PKGS="plasma-meta sddm konsole dolphin"; DM="sddm" ;;
|
kde) PKGS="plasma-meta sddm konsole dolphin"; DM="sddm" ;;
|
||||||
gnome) PKGS="gnome gdm"; DM="gdm" ;;
|
gnome) PKGS="gnome gdm"; DM="gdm" ;;
|
||||||
xfce) PKGS="xfce4 xfce4-goodies lightdm lightdm-gtk-greeter"; DM="lightdm" ;;
|
xfce) PKGS="xfce4 xfce4-goodies sddm"; DM="sddm" ;;
|
||||||
hyprland) PKGS="hyprland kitty wofi waybar sddm"; DM="sddm" ;;
|
hyprland) PKGS="hyprland kitty wofi waybar sddm"; DM="sddm" ;;
|
||||||
cli|*) PKGS="" ;;
|
cli|*) PKGS="" ;;
|
||||||
esac
|
esac
|
||||||
# Navigateur de base ajouté DÈS QU'un bureau est choisi (jamais en CLI).
|
# Navigateur de base ajouté DÈS QU'un bureau est choisi (jamais en CLI).
|
||||||
@@ -224,11 +224,80 @@ if [ -n "$PKGS" ]; then
|
|||||||
if pacman -Sy --noconfirm $PKGS; then
|
if pacman -Sy --noconfirm $PKGS; then
|
||||||
[ -n "$DM" ] && systemctl enable "$DM" || true
|
[ -n "$DM" ] && systemctl enable "$DM" || true
|
||||||
systemctl set-default graphical.target || true
|
systemctl set-default graphical.target || true
|
||||||
|
# SDDM (KDE / XFCE / Hyprland) : pavé numérique allumé au login.
|
||||||
|
if [ "$DM" = "sddm" ]; then
|
||||||
|
install -d /etc/sddm.conf.d
|
||||||
|
printf '[General]\nNumlock=on\n' > /etc/sddm.conf.d/10-fws.conf
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "[FWS] Bureau '$DESK' non installé (réseau ?) — à refaire après le 1er boot."
|
echo "[FWS] Bureau '$DESK' non installé (réseau ?) — à refaire après le 1er boot."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# --- Clavier X11 (SDDM + sessions graphiques) --------------------------------
|
||||||
|
# SDDM et les sessions X/Wayland (kwin lit aussi ce fichier) prennent leur
|
||||||
|
# disposition de /etc/X11/xorg.conf.d/00-keyboard.conf. Anaconda passe par localed
|
||||||
|
# qui ne l'écrit pas fiablement sur la CIBLE → écran SDDM en QWERTY US → le mot de
|
||||||
|
# passe (tapé sur le clavier choisi, ex. suisse QWERTZ) ne correspond pas. On
|
||||||
|
# l'écrit donc nous-mêmes, depuis la disposition X CHOISIE (kickstart généré),
|
||||||
|
# sinon dérivée de la locale via langtable. Cohérent avec le clavier du GUI.
|
||||||
|
XKB="$(sed -n "s/.*--xlayouts=//p" /root/anaconda-ks.cfg 2>/dev/null | head -1)"
|
||||||
|
XKB="${XKB#[\'\"]}"; XKB="${XKB%%[\'\"]*}"; XKB="${XKB%%,*}" # 1re dispo, ex. « ch (fr) »
|
||||||
|
if [ -z "$XKB" ]; then
|
||||||
|
_loc="$(. /etc/locale.conf 2>/dev/null; printf '%s' "${LANG%%.*}")" # fr_CH
|
||||||
|
_lng="${_loc%%_*}"; _terr="${_loc#*_}"; [ "$_terr" = "$_loc" ] && _terr=""
|
||||||
|
[ -n "$_terr" ] && XKB="$(python3 -c "import langtable; k=langtable.list_keyboards(languageId='$_lng', territoryId='$_terr'); print(k[0] if k else '')" 2>/dev/null)"
|
||||||
|
fi
|
||||||
|
if [ -n "$XKB" ]; then
|
||||||
|
XL="${XKB%%(*}"; XL="${XL%% *}" # ch
|
||||||
|
case "$XKB" in *'('*')') XV="${XKB#*(}"; XV="${XV%)}" ;; *) XV="" ;; esac # fr
|
||||||
|
install -d /etc/X11/xorg.conf.d
|
||||||
|
cat > /etc/X11/xorg.conf.d/00-keyboard.conf <<KBEOF
|
||||||
|
Section "InputClass"
|
||||||
|
Identifier "system-keyboard"
|
||||||
|
MatchIsKeyboard "on"
|
||||||
|
Option "XkbLayout" "$XL"
|
||||||
|
Option "XkbVariant" "$XV"
|
||||||
|
EndSection
|
||||||
|
KBEOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- 4bis) Sudo : l'utilisateur créé doit pouvoir administrer -----------------
|
||||||
|
# Arch laisse « %wheel » COMMENTÉ dans sudoers → même un membre de wheel ne peut
|
||||||
|
# pas sudo. On active le groupe wheel (drop-in) ET on y ajoute tous les
|
||||||
|
# utilisateurs HUMAINS (UID 1000-60000) créés par Anaconda → ils sont sudoers.
|
||||||
|
install -d -m 750 /etc/sudoers.d
|
||||||
|
printf '%%wheel ALL=(ALL:ALL) ALL\n' > /etc/sudoers.d/10-fws-wheel
|
||||||
|
chmod 440 /etc/sudoers.d/10-fws-wheel
|
||||||
|
while IFS=: read -r _u _x _uid _rest; do
|
||||||
|
if [ "$_uid" -ge 1000 ] && [ "$_uid" -le 60000 ]; then
|
||||||
|
usermod -aG wheel "$_u" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
done < /etc/passwd
|
||||||
|
|
||||||
|
# --- 4ter) Branding FWS sur le système installé -------------------------------
|
||||||
|
# Le hook os-release du build n'est PAS sur la cible et « pacman -S » a pu
|
||||||
|
# remettre l'os-release d'Arch → d'où « Arch Linux » au menu GRUB, le logo Arch
|
||||||
|
# sur l'écran de connexion (GDM lit os-release LOGO) et le nom « Arch ». On FORCE
|
||||||
|
# donc l'os-release FWS (+ lsb-release + GRUB_DISTRIBUTOR), on RÉGÉNÈRE le menu
|
||||||
|
# GRUB (10_linux lit le NAME d'os-release), et on retire le motd « live ».
|
||||||
|
if [ -f /usr/local/share/fws/os-release ]; then
|
||||||
|
cp -f /usr/local/share/fws/os-release /usr/lib/os-release
|
||||||
|
ln -sf ../usr/lib/os-release /etc/os-release
|
||||||
|
fi
|
||||||
|
if [ -f /etc/lsb-release ]; then
|
||||||
|
sed -i 's/^DISTRIB_ID=.*/DISTRIB_ID=FWS/; s/^DISTRIB_DESCRIPTION=.*/DISTRIB_DESCRIPTION="FWS Linux"/' \
|
||||||
|
/etc/lsb-release
|
||||||
|
fi
|
||||||
|
if grep -q '^GRUB_DISTRIBUTOR=' /etc/default/grub 2>/dev/null; then
|
||||||
|
sed -i 's/^GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR="FWS"/' /etc/default/grub
|
||||||
|
else
|
||||||
|
echo 'GRUB_DISTRIBUTOR="FWS"' >> /etc/default/grub
|
||||||
|
fi
|
||||||
|
grub-mkconfig -o /boot/grub/grub.cfg 2>/dev/null || true
|
||||||
|
# motd « live » (texte inadapté + codes ANSI bruts affichés crus par GDM).
|
||||||
|
rm -f /etc/motd
|
||||||
|
|
||||||
# --- 5) Sécurité : verrouiller root s'il est resté SANS mot de passe ----------
|
# --- 5) Sécurité : verrouiller root s'il est resté SANS mot de passe ----------
|
||||||
# L'airootfs live a souvent un root sans mot de passe ; si l'utilisateur n'en a
|
# L'airootfs live a souvent un root sans mot de passe ; si l'utilisateur n'en a
|
||||||
# pas défini dans le GUI, on verrouille plutôt que de laisser le compte ouvert.
|
# pas défini dans le GUI, on verrouille plutôt que de laisser le compte ouvert.
|
||||||
@@ -236,9 +305,21 @@ if passwd -S root 2>/dev/null | grep -qE '\bNP\b'; then
|
|||||||
passwd -l root || true
|
passwd -l root || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- 6) Le resolv.conf du live ne doit pas rester figé -----------------------
|
# --- 6) DNS du système installé : NetworkManager + systemd-resolved ----------
|
||||||
# NetworkManager (activé sur le système installé) régénère /etc/resolv.conf.
|
# Le live utilise systemd-resolved (/etc/resolv.conf → stub 127.0.0.53). L'ANCIEN
|
||||||
rm -f /tmp/fws-desktop /etc/resolv.conf 2>/dev/null || true
|
# « rm /etc/resolv.conf » comptait sur NM pour recréer le fichier — MAIS avec
|
||||||
|
# systemd-resolved actif, NM ne réécrit PAS resolv.conf (il pousse les DNS vers
|
||||||
|
# resolved). Sans le lien, la résolution est MORTE → « Limited Connectivity » /
|
||||||
|
# Firefox « Server Not Found » (le réseau marche, le DNS non). Fix robuste :
|
||||||
|
# - resolv.conf → stub systemd-resolved,
|
||||||
|
# - service systemd-resolved activé,
|
||||||
|
# - on FORCE NM à utiliser resolved (dns=systemd-resolved) → il lui fournit les
|
||||||
|
# DNS DHCP, la résolution marche dès le 1er boot.
|
||||||
|
rm -f /tmp/fws-desktop 2>/dev/null || true
|
||||||
|
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
||||||
|
systemctl enable systemd-resolved.service 2>/dev/null || true
|
||||||
|
install -d /etc/NetworkManager/conf.d
|
||||||
|
printf '[main]\ndns=systemd-resolved\n' > /etc/NetworkManager/conf.d/dns.conf
|
||||||
%end
|
%end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user