diff --git a/configs/releng/airootfs/usr/local/bin/fws-setup-hardware b/configs/releng/airootfs/usr/local/bin/fws-setup-hardware index 74cae08..797c30d 100755 --- a/configs/releng/airootfs/usr/local/bin/fws-setup-hardware +++ b/configs/releng/airootfs/usr/local/bin/fws-setup-hardware @@ -33,6 +33,11 @@ WANTED="" usage() { sed -n '3,18p' "$0" | sed 's/^# \{0,1\}//'; } +# Texts in the language of the environment (hardware.* keys). Like every step +# here, a missing helper must not stop the engine: t then prints the keys. +[ -r /usr/local/lib/fws/i18n.sh ] && . /usr/local/lib/fws/i18n.sh hardware +declare -F t >/dev/null || t() { printf '%s' "$1"; } + while [ $# -gt 0 ]; do case "$1" in --plan) MODE="plan" ;; @@ -41,19 +46,22 @@ while [ $# -gt 0 ]; do --unattended) MODE="unattended" ;; --groups) MODE="groups"; WANTED="$2"; shift ;; -h|--help) usage; exit 0 ;; - -*) echo "option inconnue : $1" >&2; exit 2 ;; + -*) echo "$(t hardware.unknown_option option="$1")" >&2; exit 2 ;; *) DESK="$1" ;; esac shift done log() { echo "[FWS-hw] $*"; } +# A step that fws-drivers shows in its status line: the window reads the step +# name in the tag ("[FWS-hw:install] …"), never the text, which is translated. +step() { local name="$1"; shift; echo "[FWS-hw:$name] $*"; } ok() { echo " ✔ $*"; } ko() { echo " ✘ $*"; } # Les installations et les activations de services exigent root ; « --plan » non. if [ "$MODE" != "plan" ] && [ "$(id -u)" -ne 0 ]; then - echo "Ce script doit être lancé en root (sudo fws-setup-hardware …)" >&2 + echo "$(t hardware.needs_root)" >&2 exit 1 fi @@ -125,7 +133,7 @@ if printf '%s' "$GPU" | grep -qiE 'NVIDIA|GeForce'; then # prendre la main, alors qu'une carte récente sans module propriétaire est # tout simplement inutilisable. if [ "$_NEWEST" -eq 0 ] || [ "$_NEWEST" -ge $((16#1E00)) ]; then - GPU_NOTE="NVIDIA 0x$(printf '%04x' "$_NEWEST") → modules ouverts (Turing ou plus récent)" + GPU_NOTE="$(t hardware.note_nvidia_open device="NVIDIA 0x$(printf '%04x' "$_NEWEST")")" # libva-nvidia-driver : le pilote VA-API (décodage vidéo matériel) — # nvidia-utils ne fournit que le VDPAU historique ; sans ce paquet, # Firefox/Chrome et les lecteurs décodent en CPU et saccadent en 4K. @@ -138,7 +146,7 @@ if printf '%s' "$GPU" | grep -qiE 'NVIDIA|GeForce'; then printf '%s' "$GPU" | grep -qiE '\bIntel\b|\bAMD\b|\bATI\b' \ && GPU_PKGS="$GPU_PKGS nvidia-prime" else - GPU_NOTE="NVIDIA 0x$(printf '%04x' "$_NEWEST") antérieure à Turing → nouveau (pilote libre)" + GPU_NOTE="$(t hardware.note_nvidia_nouveau device="NVIDIA 0x$(printf '%04x' "$_NEWEST")")" GPU_PKGS="$GPU_PKGS xf86-video-nouveau" fi fi @@ -162,7 +170,7 @@ if printf '%s' "$GPU" | grep -qi '\bIntel\b'; then [ "$LIB32" = 1 ] && GPU_PKGS="$GPU_PKGS lib32-vulkan-intel" fi -group gpu "Pilotes graphiques${GPU_NOTE:+ — $GPU_NOTE}" 1 $GPU_PKGS +group gpu "$(t hardware.group_gpu)${GPU_NOTE:+ — $GPU_NOTE}" 1 $GPU_PKGS # ── 1bis) Réseau sans fil ─────────────────────────────────────────────────── # linux-firmware couvre Intel, Atheros, Realtek et les Broadcom FullMAC @@ -196,18 +204,18 @@ WIFI_IFACE="$(wifi_iface)" if [ -n "$WIFI_HW" ]; then WIFI_DETECT=1 if [ -n "$WIFI_IFACE" ]; then - WIFI_NOTE="interface $WIFI_IFACE reconnue par le noyau" + WIFI_NOTE="$(t hardware.note_wifi_interface interface="$WIFI_IFACE")" elif printf '%s' "$WIFI_HW" | grep -qi 'Broadcom'; then - WIFI_NOTE="Broadcom muette → pilote propriétaire wl" + WIFI_NOTE="$(t hardware.note_wifi_broadcom)" # dkms + linux-headers : broadcom-wl-dkms compile son module à # l'installation ET à chaque mise à jour du noyau. WIFI_PKGS="$WIFI_PKGS broadcom-wl-dkms linux-headers dkms" BROADCOM_WL=1 else - WIFI_NOTE="contrôleur sans interface — micrologiciel manquant ?" + WIFI_NOTE="$(t hardware.note_wifi_no_interface)" fi fi -group wifi "Réseau sans fil${WIFI_NOTE:+ — $WIFI_NOTE}" "$WIFI_DETECT" $WIFI_PKGS +group wifi "$(t hardware.group_wifi)${WIFI_NOTE:+ — $WIFI_NOTE}" "$WIFI_DETECT" $WIFI_PKGS # ── 2) Son ────────────────────────────────────────────────────────────────── # PipeWire est le serveur audio, PAS PulseAudio : « pipewire-pulse » est la @@ -215,7 +223,7 @@ group wifi "Réseau sans fil${WIFI_NOTE:+ — $WIFI_NOTE}" "$WIFI_DETECT" $WIFI_ # les modules volume de waybar/polybar fonctionnent) et elle est en conflit # pacman avec le vrai paquet pulseaudio — il ne peut pas s'installer. # alsa-firmware/alsa-plugins : codecs et cartes muets sans eux. -group audio "Son et micro (PipeWire)" 1 \ +group audio "$(t hardware.group_audio)" 1 \ pipewire pipewire-alsa pipewire-pulse pipewire-jack wireplumber \ pavucontrol alsa-utils alsa-firmware alsa-plugins realtime-privileges @@ -225,17 +233,17 @@ BT_DETECT=0 BT_PKGS="bluez bluez-utils" # KDE et GNOME ont leur propre gestionnaire ; blueman pour les autres bureaux. case "$DESK" in hyprland|xfce|i3) BT_PKGS="$BT_PKGS blueman" ;; esac -group bluetooth "Bluetooth" "$BT_DETECT" $BT_PKGS +group bluetooth "$(t hardware.group_bluetooth)" "$BT_DETECT" $BT_PKGS # ── 4) Luminosité ─────────────────────────────────────────────────────────── # brightnessctl règle la luminosité sans root (via logind) — utilisé par les # touches XF86MonBrightness* et le module backlight de waybar/polybar. BL_DETECT=0 [ -n "$(ls -A /sys/class/backlight 2>/dev/null)" ] && BL_DETECT=1 -group brightness "Luminosité de l'écran" "$BL_DETECT" brightnessctl +group brightness "$(t hardware.group_brightness)" "$BL_DETECT" brightnessctl # ── 5) Codecs multimédia ──────────────────────────────────────────────────── -group codecs "Codecs audio et vidéo" "$GRAPHICAL" \ +group codecs "$(t hardware.group_codecs)" "$GRAPHICAL" \ gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly \ gst-libav ffmpeg mpv @@ -256,21 +264,21 @@ done # déclarer une imprimante sur absolument toutes les machines. [ "$PRINT_DETECT" = 0 ] && ls -d /sys/class/parport/parport* >/dev/null 2>&1 && PRINT_DETECT=1 [ "$PRINT_DETECT" = 0 ] && [ -s /etc/cups/printers.conf ] && PRINT_DETECT=1 -group printing "Imprimantes et scanners" "$PRINT_DETECT" \ +group printing "$(t hardware.group_printing)" "$PRINT_DETECT" \ cups cups-filters cups-pdf gutenprint foomatic-db foomatic-db-engine \ system-config-printer sane avahi nss-mdns # ── 7) Jeux ───────────────────────────────────────────────────────────────── # mangohud : overlay FPS/perfs en jeu (mangohud %command% dans Steam). -group gaming "Jeux (Steam, Wine, Proton)" "$GRAPHICAL" \ +group gaming "$(t hardware.group_gaming)" "$GRAPHICAL" \ steam wine winetricks wine-mono wine-gecko lib32-pipewire \ gamemode lib32-gamemode mangohud lib32-mangohud \ noto-fonts ttf-liberation # ── 8) Réalité virtuelle ──────────────────────────────────────────────────── # Monado/OpenXR → SteamVR pour HTC Vive et Valve Index ; Oculus/Meta n'a pas de -# support Linux officiel (fws-vr-setup l'explique et propose ALVR pour Quest). -group vr "Réalité virtuelle (OpenXR, Monado)" "$GRAPHICAL" monado +# support Linux officiel (streaming Wi-Fi via ALVR, hors dépôts Arch). +group vr "$(t hardware.group_vr)" "$GRAPHICAL" monado # ── 9) Outils invité de virtualisation ────────────────────────────────────── VM_PKGS=""; VMSVC=""; VM_DETECT=0 @@ -280,11 +288,11 @@ case "$(systemd-detect-virt 2>/dev/null)" in qemu|kvm) VM_PKGS="qemu-guest-agent spice-vdagent"; VMSVC="qemu-guest-agent spice-vdagentd"; VM_DETECT=1 ;; microsoft) VM_PKGS="hyperv"; VMSVC="hv_fcopy_daemon hv_kvp_daemon hv_vss_daemon"; VM_DETECT=1 ;; esac -[ -n "$VM_PKGS" ] && group vm "Outils invité de la machine virtuelle" "$VM_DETECT" $VM_PKGS +[ -n "$VM_PKGS" ] && group vm "$(t hardware.group_vm)" "$VM_DETECT" $VM_PKGS # ── 10) Conteneurs ────────────────────────────────────────────────────────── # Moteur de conteneurs sans démon : applications isolées (Distrobox, images OCI). -group containers "Conteneurs (Podman)" 1 podman +group containers "$(t hardware.group_containers)" 1 podman # ── Groupes À LA DEMANDE ──────────────────────────────────────────────────── # Ces groupes sont PERTINENTS (donc détectés, donc pré-cochés dans l'installation @@ -306,6 +314,8 @@ is_ondemand() { # ── Mode « plan » : lister et sortir ──────────────────────────────────────── # Format volontairement tabulé pour être lu par fws-drivers : # id détecté libellé paquets +# The label is already in the language of the environment: the window, which +# runs this as the same user, shows it as is. if [ "$MODE" = "plan" ]; then for id in "${ORDER[@]}"; do printf '%s\t%s\t%s\t%s\n' \ @@ -337,7 +347,7 @@ case "$MODE" in if [ -n "${G_LABEL[$id]:-}" ]; then SELECTED+=("$id") else - log "groupe inconnu, ignoré : $id" + log "$(t hardware.unknown_group group="$id")" fi done ;; @@ -357,11 +367,11 @@ selected_has() { if [ "${#SELECTED[@]}" -gt 0 ]; then WANTED_PKGS="" for id in "${SELECTED[@]}"; do - log "groupe « ${G_LABEL[$id]} »" + log "$(t hardware.group_selected group="${G_LABEL[$id]}")" WANTED_PKGS="$WANTED_PKGS ${G_PKGS[$id]}" done - pacman -Sy --noconfirm || log "synchro pacman échouée (réseau ?)" + pacman -Sy --noconfirm || log "$(t hardware.sync_failed)" # Filtre aux paquets RÉELLEMENT existants : un nom manquant ou renommé ne # doit pas faire échouer toute la transaction. Les absents sont NOMMÉS — @@ -374,9 +384,9 @@ if [ "${#SELECTED[@]}" -gt 0 ]; then MISSING="$MISSING $p" fi done - [ -n "$MISSING" ] && log "AVERTISSEMENT : paquets introuvables dans les dépôts :$MISSING" + [ -n "$MISSING" ] && log "$(t hardware.packages_not_found packages="${MISSING# }")" if [ -n "$VALID" ]; then - log "installation :$VALID" + step install "$(t hardware.installing_packages packages="${VALID# }")" if pacman -S --noconfirm --needed $VALID; then # polices : le cache fontconfig doit inclure la police emoji qui # vient d'être installée, sinon les applications déjà lancées ne la @@ -401,17 +411,16 @@ if [ "${#SELECTED[@]}" -gt 0 ]; then done if [ -n "$_pending" ]; then rm -f /var/lib/fws/hardware-done - log "reste à proposer à l'utilisateur :$_pending" - log "« Pilotes et matériel » s'ouvrira au premier démarrage" + log "$(t hardware.pending_groups groups="${_pending# }")" + log "$(t hardware.drivers_will_open)" else install -d /var/lib/fws printf '%s groupes=%s\n' "$(date -Is)" "${SELECTED[*]}" \ > /var/lib/fws/hardware-done - log "mise en route matérielle enregistrée (/var/lib/fws/hardware-done)" + log "$(t hardware.setup_recorded path=/var/lib/fws/hardware-done)" fi else - log "certains paquets n'ont pas été installés — la fenêtre « Pilotes et matériel »" - log "s'ouvrira au premier démarrage pour terminer" + log "$(t hardware.install_incomplete)" rm -f /var/lib/fws/hardware-done fi fi @@ -429,19 +438,19 @@ _wifi_selected=0 for id in "${SELECTED[@]}"; do [ "$id" = wifi ] && _wifi_selected=1; done if [ "$BROADCOM_WL" = 1 ] && [ "$_wifi_selected" = 1 ]; then if pacman -Qq broadcom-wl-dkms >/dev/null 2>&1; then - log "wi-fi Broadcom : pilote wl déjà installé" + log "$(t hardware.broadcom_already_installed)" else _WL_PKG="$(ls /usr/local/share/fws/drivers/broadcom-wl-dkms-*.pkg.tar.* 2>/dev/null | head -1)" if [ -z "$_WL_PKG" ]; then - log "wi-fi Broadcom : pilote wl introuvable (ni dépôts, ni image)" + log "$(t hardware.broadcom_not_found)" elif pacman -U --noconfirm "$_WL_PKG"; then - log "wi-fi Broadcom : pilote wl installé — redémarre pour l'activer" + log "$(t hardware.broadcom_installed)" rm -f "$_WL_PKG" else # dkms et linux-headers ne sont PAS dans l'image : sans réseau, # « -U » échoue sur les dépendances. On le dit au lieu de laisser # croire que la carte est définitivement morte. - log "wi-fi Broadcom : échec — dkms/linux-headers manquants (réseau requis)" + log "$(t hardware.broadcom_failed)" fi fi fi @@ -455,14 +464,14 @@ fi # Jouée après une installation, et seule avec « --check ». Chaque contrôle est # idempotent : on peut la relancer autant de fois qu'on veut. echo -log "vérification des services et des connexions" +step check "$(t hardware.checking_services)" # --- Réseau ----------------------------------------------------------------- if systemctl is-enabled NetworkManager.service >/dev/null 2>&1; then - ok "NetworkManager activé" + ok "$(t hardware.networkmanager_enabled)" else systemctl enable --now NetworkManager.service >/dev/null 2>&1 \ - && ok "NetworkManager activé (réparé)" || ko "NetworkManager : activation impossible" + && ok "$(t hardware.networkmanager_repaired)" || ko "$(t hardware.networkmanager_failed)" fi # --- Son -------------------------------------------------------------------- @@ -478,8 +487,8 @@ if selected_has audio; then # Une unité par appel : groupées, un seul échec en masquerait les autres. for u in pipewire.socket pipewire-pulse.socket wireplumber.service; do systemctl --global enable "$u" >/dev/null 2>&1 \ - && ok "son : $u activé pour toutes les sessions" \ - || ko "son : activation de $u impossible" + && ok "$(t hardware.audio_unit_enabled unit="$u")" \ + || ko "$(t hardware.audio_unit_failed unit="$u")" done # Priorité temps réel : contre les craquements et les coupures sous charge. if getent group realtime >/dev/null 2>&1; then @@ -487,7 +496,7 @@ if selected_has audio; then [ "$uid" -ge 1000 ] && [ "$uid" -le 60000 ] \ && usermod -aG realtime "$u" 2>/dev/null done < /etc/passwd - ok "son : comptes humains ajoutés au groupe realtime" + ok "$(t hardware.audio_realtime_group)" fi fi @@ -495,41 +504,42 @@ fi if selected_has bluetooth; then # rfkill d'abord : un contrôleur bloqué au niveau noyau ne répondra à # aucune commande, et c'est l'état par défaut sur pas mal de portables. - rfkill unblock bluetooth 2>/dev/null && ok "bluetooth : radio débloquée" + rfkill unblock bluetooth 2>/dev/null && ok "$(t hardware.bluetooth_unblocked)" if systemctl enable --now bluetooth.service >/dev/null 2>&1; then - ok "bluetooth : service activé" + ok "$(t hardware.bluetooth_service_enabled)" # Contrôleur allumé + appairages retrouvés au démarrage. printf 'power on\n' | timeout 10 bluetoothctl >/dev/null 2>&1 \ - && ok "bluetooth : contrôleur allumé" \ - || ko "bluetooth : contrôleur injoignable (aucun adaptateur ?)" + && ok "$(t hardware.bluetooth_powered_on)" \ + || ko "$(t hardware.bluetooth_unreachable)" else - ko "bluetooth : service indisponible" + ko "$(t hardware.bluetooth_service_unavailable)" fi fi # --- Impression ------------------------------------------------------------- if selected_has printing; then systemctl enable --now cups.service >/dev/null 2>&1 \ - && ok "impression : cups activé" || ko "impression : cups indisponible" + && ok "$(t hardware.printing_cups_enabled)" || ko "$(t hardware.printing_cups_unavailable)" # Découverte des imprimantes réseau (mDNS) : avahi + résolution .local. systemctl enable --now avahi-daemon.service >/dev/null 2>&1 \ - && ok "impression : découverte réseau (avahi) activée" || true + && ok "$(t hardware.printing_discovery_enabled)" || true if [ -f /etc/nsswitch.conf ] && ! grep -q 'mdns' /etc/nsswitch.conf; then sed -i 's/^hosts:.*/& mdns_minimal [NOTFOUND=return]/' /etc/nsswitch.conf \ - && ok "impression : résolution .local ajoutée à nsswitch.conf" + && ok "$(t hardware.printing_local_names_added)" fi fi # --- Conteneurs ------------------------------------------------------------- if selected_has containers; then systemctl enable podman.socket >/dev/null 2>&1 \ - && ok "conteneurs : podman.socket activé" || ko "conteneurs : podman indisponible" + && ok "$(t hardware.containers_enabled)" || ko "$(t hardware.containers_unavailable)" fi # --- Outils invité VM ------------------------------------------------------- if selected_has vm && [ -n "$VMSVC" ]; then systemctl enable $VMSVC >/dev/null 2>&1 \ - && ok "machine virtuelle : $VMSVC activés" || ko "machine virtuelle : activation partielle" + && ok "$(t hardware.vm_services_enabled services="$VMSVC")" \ + || ko "$(t hardware.vm_services_partial)" fi # --- Modules DKMS réellement compilés --------------------------------------- @@ -544,13 +554,13 @@ if command -v dkms >/dev/null 2>&1; then : # aucun module DKMS attendu sur cette machine else _NBOK="$(printf '%s\n' "$_DKMS" | grep -c 'installed')" - [ "$_NBOK" -gt 0 ] && ok "dkms : $_NBOK module(s) compilé(s) et installé(s)" + [ "$_NBOK" -gt 0 ] && ok "$(t hardware.dkms_built count="$_NBOK")" printf '%s\n' "$_DKMS" | grep -v 'installed' | while read -r _l; do - [ -n "$_l" ] && ko "dkms : PAS compilé → $_l" + [ -n "$_l" ] && ko "$(t hardware.dkms_not_built module="$_l")" done if [ "$_NBOK" -eq 0 ]; then - ko "dkms : aucun module compilé — en-têtes du noyau absentes ?" - ko " réessaie avec : sudo dkms autoinstall" + ko "$(t hardware.dkms_none_built)" + ko " $(t hardware.dkms_retry command="sudo dkms autoinstall")" fi fi fi @@ -562,9 +572,9 @@ fi if selected_has gpu; then _GMOD="$(lsmod 2>/dev/null | grep -oE '^(nvidia|amdgpu|i915|xe|radeon|nouveau)' | head -1)" if [ -n "$_GMOD" ]; then - ok "graphique : module chargé ($_GMOD)" + ok "$(t hardware.gpu_module_loaded module="$_GMOD")" else - ko "graphique : aucun module noyau chargé — redémarre pour appliquer les pilotes" + ko "$(t hardware.gpu_no_module)" fi # Un module chargé ne prouve RIEN sur le rendu : le loader Vulkan doit @@ -574,26 +584,26 @@ if selected_has gpu; then # l'installateur. Sans module chargé ou sans /dev/dri, le test ne prouve # rien : on le dit plutôt que d'afficher un échec qui n'en est pas un. if [ -z "$_GMOD" ] || [ ! -d /dev/dri ]; then - log " … rendu non testé ici (pilote pas encore actif) — contrôle au prochain démarrage" + log " … $(t hardware.rendering_not_tested)" else if command -v vulkaninfo >/dev/null 2>&1; then _VK="$(vulkaninfo --summary 2>/dev/null \ | sed -n 's/^[[:space:]]*deviceName[[:space:]]*=[[:space:]]*//p')" if [ -z "$_VK" ]; then - ko "vulkan : aucun périphérique — ICD absent ou illisible" - ko " ICD présents : $(ls /usr/share/vulkan/icd.d/ 2>/dev/null | tr '\n' ' ')" + ko "$(t hardware.vulkan_no_device)" + ko " $(t hardware.vulkan_icds_present files="$(ls /usr/share/vulkan/icd.d/ 2>/dev/null | tr '\n' ' ')")" elif ! printf '%s\n' "$_VK" | grep -qvi 'llvmpipe'; then # llvmpipe SEUL = rendu logiciel : ça « marche », mais au CPU. # Le symptôme est un bureau qui rame et zéro jeu jouable, sans # le moindre message d'erreur nulle part. - ko "vulkan : rendu LOGICIEL seulement (llvmpipe) — le pilote matériel n'est pas actif" + ko "$(t hardware.vulkan_software_only)" else printf '%s\n' "$_VK" | while read -r _d; do - [ -n "$_d" ] && ok "vulkan : $_d" + [ -n "$_d" ] && ok "$(t hardware.vulkan_device device="$_d")" done fi else - ko "vulkan : vulkan-tools absent, impossible de vérifier le rendu" + ko "$(t hardware.vulkan_tools_missing)" fi # OpenGL : second avis, mais glxinfo EXIGE un affichage ouvert. Lancé @@ -602,7 +612,7 @@ if selected_has gpu; then if command -v glxinfo >/dev/null 2>&1 \ && [ -n "${DISPLAY:-}${WAYLAND_DISPLAY:-}" ]; then _GL="$(glxinfo -B 2>/dev/null | sed -n 's/^OpenGL renderer string: //p')" - [ -n "$_GL" ] && ok "opengl : $_GL" + [ -n "$_GL" ] && ok "$(t hardware.opengl_renderer renderer="$_GL")" fi fi fi @@ -613,16 +623,16 @@ fi if selected_has wifi; then WIFI_IFACE="$(wifi_iface)" if [ -n "$WIFI_IFACE" ]; then - ok "wi-fi : interface $WIFI_IFACE présente" - rfkill unblock wifi 2>/dev/null && ok "wi-fi : radio débloquée" + ok "$(t hardware.wifi_interface_present interface="$WIFI_IFACE")" + rfkill unblock wifi 2>/dev/null && ok "$(t hardware.wifi_unblocked)" elif [ -n "$WIFI_HW" ]; then - ko "wi-fi : contrôleur détecté mais AUCUNE interface — pilote manquant" + ko "$(t hardware.wifi_no_interface)" ko " $(printf '%s' "$WIFI_HW" | head -1 | cut -c1-72)" [ "$BROADCOM_WL" = 1 ] \ - && ko " pilote wl installé ? redémarre pour le charger" + && ko " $(t hardware.wifi_restart_for_wl)" fi fi echo -log "terminé" +log "$(t hardware.done)" exit 0