feat(installer): simple network picker screen after language selection

Replace the complex anaconda NetworkStandaloneSpoke with a minimal
post-language "Connexion à Internet" screen: one list of detected
Wi-Fi networks plus Ethernet, click a network, enter the password,
done. Hostname typed there is kept (written to /tmp/fws-hostname and
prefilled into the User spoke via the anaconda PKGBUILD patch), and
the chosen Wi-Fi profile is copied to the installed system so it
works at first boot without re-entering the password.
This commit is contained in:
BlackAngelTV committed 2026-09-03 21:56:58 +02:00
1 parent d024df2bae
commit 7f603979cc
4 files changed
+745 -5

No files matched your search

@@ -0,0 +1,452 @@
# FWS — Écran « Connexion Internet » juste après le choix de la langue.
#
# POURQUOI ICI (airootfs, pas dans le paquet anaconda) : même mécanisme que
# fws_desktop.py / fws_recap.py — Anaconda découvre les spokes au RUNTIME dans
# ce dossier → l'overlay airootfs suffit, AUCUN rebuild du paquet anaconda.
# Le glade associé est dans /usr/share/anaconda/ui/spokes/fws_network.glade.
#
# SIMPLICITÉ (demande utilisateur) : l'écran réseau complet d'Anaconda
# (NetworkControlBox — onglets, options avancées, champ hostname…) a été jugé
# illisible. On le remplace par un sélecteur minimal, façon téléphone :
# 1. une liste « Réseaux détectés » (Ethernet branché + Wi-Fi triés par
# puissance),
# 2. on clique sur un réseau Wi-Fi,
# 3. si le Wi-Fi est sécurisé : on tape le mot de passe, « Se connecter »,
# 4. « Connecté ✓ » → « Continuer ».
# Les réseaux Wi-Fi ouverts se connectent au clic ; le câble Ethernet aussi.
# Le bouton « Continuer » reste toujours disponible (pas de réseau = on peut
# passer outre, le récap + le rattrapage fws-desktop-finalize gèrent le hors
# ligne).
#
# PLACEMENT DANS LE FLUX (inchangé) : standalone spoke « preForHub » —
# WelcomeLanguageSpoke (preForHub=SummaryHub, priority=0)
# → CE spoke (preForHub=SummaryHub, priority=10)
# → SummaryHub → fws_recap (postForHub, -10) → installation
# « completed » reste False : _instantiateAction SAUTE tout standalone
# « completed » (prévu pour les installs kickstart) — il doit s'afficher.
#
# PERSISTANCE DU Wi-Fi CHOISI : la connexion est faite par NetworkManager sur
# le LIVE → son profil est écrit dans /etc/NetworkManager/system-connections/
# du live (overlay temporaire — PAS recopié par le payload LiveOS, qui copie
# le squashfs). apply() pose donc /tmp/fws-keep-wifi ; le %post --nochroot du
# kickstart copie alors les profils live vers la CIBLE → au 1er démarrage du
# système installé (et pendant le %post chrooté, qui tourne sur la pile réseau
# du live), le Wi-Fi fonctionne sans ressaisie.
#
# ⚠ Chemin couplé à la version de Python d'Arch (3.14), comme fws_desktop.py.
# ⚠ importlib inutile ici : plus de sous-classe du spoke réseau d'anaconda, on
# hérite directement de StandaloneSpoke (aucune classe parente dans le
# namespace → collect() ne découvre que la nôtre).
import subprocess
import threading
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import GLib, Gtk
from pyanaconda.anaconda_loggers import get_module_logger
from pyanaconda.ui.gui.hubs.summary import SummaryHub
from pyanaconda.ui.gui.spokes import StandaloneSpoke
log = get_module_logger(__name__)
__all__ = ["FWSNetworkStandaloneSpoke"]
_NMCLI = "/usr/bin/nmcli"
_KEEP_WIFI = "/tmp/fws-keep-wifi"
# Couleurs des messages de retour (markup Pango).
_GREEN = "#1e7145"
_RED = "#b3261e"
_GREY = "#555555"
def _nm(args, timeout=30):
"""`nmcli` → (code retour, stdout). Jamais d'exception vers l'UI."""
try:
proc = subprocess.run(
[_NMCLI] + args, capture_output=True, text=True, timeout=timeout)
return proc.returncode, proc.stdout or ""
except Exception: # pylint: disable=broad-except
return -1, ""
def _split_escaped(line):
"""Découpe une ligne `nmcli -t` (séparateur ':', '\\:' et '\\\\' échappés)."""
fields, cur, i = [], "", 0
while i < len(line):
c = line[i]
if c == "\\" and i + 1 < len(line) and line[i + 1] in (":", "\\"):
cur += line[i + 1]
i += 2
elif c == ":":
fields.append(cur)
cur = ""
i += 1
else:
cur += c
i += 1
fields.append(cur)
return fields
class FWSNetworkStandaloneSpoke(StandaloneSpoke):
"""Choix simple du réseau (Ethernet / Wi-Fi + mot de passe) avant le hub."""
builderObjects = ["fwsNetworkWindow", "netTitle", "netList", "netFeedback",
"pwPanel", "pwTitle", "pwEntry", "pwShow", "pwConnect",
"refreshButton"]
mainWidgetName = "fwsNetworkWindow"
uiFile = "spokes/fws_network.glade"
preForHub = SummaryHub
priority = 10
@staticmethod
def get_screen_id():
"""Identifiant unique de cet écran."""
return "fws-network-pre-configuration"
def __init__(self, *args):
StandaloneSpoke.__init__(self, *args)
self._wifi_connected = False # un Wi-Fi a été connecté ici
self._busy = False
self._current_ssid = None
self._networks = [] # refs des rangées pour re-sélection
# ------------------------------------------------------------------ UI --
@property
def completed(self):
# Toujours demander (jamais auto-sauté) ; continuer reste possible
# sans réseau.
return False
def initialize(self):
StandaloneSpoke.initialize(self)
self._title = self.builder.get_object("netTitle")
self._title.set_markup(
'<span size="x-large"><b>Connexion à Internet</b></span>')
self._list = self.builder.get_object("netList")
self._list.connect("row-selected", self._on_row_selected)
self._feedback = self.builder.get_object("netFeedback")
self._panel = self.builder.get_object("pwPanel")
self._pw_title = self.builder.get_object("pwTitle")
self._entry = self.builder.get_object("pwEntry")
self._entry.connect("activate", lambda _w: self._connect_selected())
self.builder.get_object("pwShow").connect(
"toggled", self._on_show_toggled)
self.builder.get_object("pwConnect").connect(
"clicked", lambda _b: self._connect_selected())
self.builder.get_object("refreshButton").connect(
"clicked", lambda _b: self._refresh_clicked())
self._panel.hide()
self._show_feedback("", _GREY)
# L'UI écoute « continue-clicked » en connect_after : on pose notre
# apply() AVANT la transition (marqueur Wi-Fi vers la cible).
self.window.connect("continue-clicked", self._on_continue_clicked)
def _on_continue_clicked(self, *_args):
self.apply()
def refresh(self):
# À chaque entrée sur l'écran : liste à jour + état courant.
self._build_list(rescan=False)
# Cache Wi-Fi souvent vide au tout premier affichage (NM n'a pas
# encore scanné) → un rescan automatique si rien n'est listé.
if not self._networks and not getattr(self, "_rescanning", False):
self._rescanning = True
threading.Thread(target=self._refresh_worker, daemon=True).start()
def apply(self):
# Persistance du Wi-Fi vers le système installé (cf. en-tête).
if self._wifi_connected or self._active_wifi_ssid():
try:
with open(_KEEP_WIFI, "w") as fh:
fh.write("1")
except OSError:
pass
# ------------------------------------------------------------ données --
def _scan(self, rescan):
"""(wifi, ethernet) : wifi = liste de dicts, ethernet = liste de
(interface, état). Sans jamais bloquer l'UI plus d'un instant."""
wifi = []
if rescan:
_nm(["-w", "12", "dev", "wifi", "rescan"])
rc, out = _nm(["-t", "-f", "IN-USE,SSID,SIGNAL,SECURITY",
"dev", "wifi", "list"])
if rc == 0:
for line in out.splitlines():
f = _split_escaped(line)
if len(f) < 4:
continue
ssid = f[1].strip()
if not ssid:
continue
try:
signal = int(f[2] or 0)
except ValueError:
signal = 0
wifi.append({
"inuse": f[0].strip() == "*",
"ssid": ssid,
"signal": signal,
"secured": bool(f[3].strip()),
})
# Tri : connecté d'abord, puis puissance décroissante.
wifi.sort(key=lambda n: (not n["inuse"], -n["signal"]))
eth = []
rc, out = _nm(["-t", "-f", "DEVICE,TYPE,STATE", "device", "status"])
if rc == 0:
for line in out.splitlines():
f = _split_escaped(line)
if len(f) >= 3 and f[1] == "ethernet":
eth.append((f[0], f[2].strip()))
return wifi, eth
def _active_wifi_ssid(self):
rc, out = _nm(["-t", "-f", "NAME,TYPE", "connection", "show",
"--active"])
if rc == 0:
for line in out.splitlines():
f = _split_escaped(line)
if len(f) >= 2 and f[1] == "wifi":
return f[0]
return ""
def _build_list(self, rescan):
wifi, eth = self._scan(rescan)
for row in self._list.get_children():
self._list.remove(row)
self._networks = []
had_conn = False
def add_row(kind, main, detail, meta, inuse=False):
row = Gtk.ListBoxRow()
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=12)
hbox.set_margin_start(10)
hbox.set_margin_end(10)
hbox.set_margin_top(8)
hbox.set_margin_bottom(8)
name = Gtk.Label(label=main, xalign=0.0, hexpand=True,
wrap=True)
name.set_markup(f"<b>{GLib.markup_escape_text(main)}</b>")
hbox.pack_start(name, True, True, 0)
right = Gtk.Label(label=detail, xalign=1.0)
right.set_markup(
f'<span color="{_GREY}">{GLib.markup_escape_text(detail)}</span>')
hbox.pack_start(right, False, False, 0)
row.add(hbox)
row._meta = dict(meta)
row._meta["inuse"] = inuse
row.show_all()
self._list.add(row)
self._networks.append(row)
for iface, state in eth:
if state == "connected":
had_conn = True
add_row("eth", "Ethernet (câble)", "Connecté ✓",
{"kind": "eth", "iface": iface, "state": state},
inuse=True)
elif state == "disconnected":
add_row("eth", "Ethernet (câble)", "Cliquer pour se connecter",
{"kind": "eth", "iface": iface, "state": state})
# "unavailable" = pas de câble : inutile de l'afficher.
for n in wifi:
if n["inuse"]:
had_conn = True
detail = "Connecté ✓"
elif n["secured"]:
detail = f"{n['signal']} % · sécurisé"
else:
detail = f"{n['signal']} % · ouvert"
add_row("wifi", n["ssid"], detail,
{"kind": "wifi", "ssid": n["ssid"],
"secured": n["secured"]}, inuse=n["inuse"])
# Message d'état global.
active_wifi = self._active_wifi_ssid()
if active_wifi:
self._show_feedback(f"Connecté au Wi-Fi « {active_wifi} » ✓ — "
"vous pouvez continuer.", _GREEN)
elif had_conn:
self._show_feedback("Connecté à Internet (Ethernet) ✓ — "
"vous pouvez continuer.", _GREEN)
elif not self._networks:
self._show_feedback(
"Aucun réseau détecté. Vérifiez que le Wi-Fi est activé, "
"branchez un câble Ethernet, ou cliquez « Rafraîchir ».", _RED)
else:
self._show_feedback(
"Cliquez sur un réseau Wi-Fi pour vous connecter "
"(ou branchez un câble Ethernet).", _GREY)
self._hide_password_panel()
def _show_feedback(self, text, color=_GREY):
if text:
self._feedback.set_markup(
f'<span color="{color}">{GLib.markup_escape_text(text)}</span>')
else:
self._feedback.set_text("")
# ------------------------------------------------------------ actions --
def _on_row_selected(self, _listbox, row):
if row is None or self._busy:
return
meta = row._meta
self._hide_password_panel()
if meta["kind"] == "eth":
if meta["state"] == "connected":
self._show_feedback(
"Ethernet déjà connecté — vous pouvez continuer.", _GREEN)
else:
self._connect_eth(meta["iface"])
return
# Wi-Fi
if meta["inuse"]:
self._show_feedback(
f"Vous êtes déjà connecté au Wi-Fi « {meta['ssid']} ».",
_GREEN)
return
self._current_ssid = meta["ssid"]
if meta["secured"]:
self._pw_title.set_markup(
f'Mot de passe du réseau Wi-Fi « '
f'<b>{GLib.markup_escape_text(meta["ssid"])}</b> » :')
self._entry.set_text("")
self._entry.set_editable(True)
self._entry.set_visibility(
self.builder.get_object("pwShow").get_active())
self._panel.show()
self._entry.grab_focus()
self._show_feedback(
f"Tapez le mot de passe de « {meta['ssid']} » puis cliquez "
"« Se connecter ».", _GREY)
else:
self._connect_wifi(meta["ssid"], None)
def _refresh_clicked(self):
if self._busy:
return
self._show_feedback("Recherche des réseaux…", _GREY)
self._set_busy(True, list_only=True)
threading.Thread(target=self._refresh_worker, daemon=True).start()
def _refresh_worker(self):
# Le rescan prend quelques secondes : on le fait hors UI.
_nm(["-w", "15", "dev", "wifi", "rescan"])
GLib.idle_add(self._refresh_done)
def _refresh_done(self):
self._rescanning = False
self._set_busy(False)
self._build_list(rescan=False)
return False
def _connect_selected(self):
if self._busy or not self._current_ssid:
return
password = self._entry.get_text()
if not password:
self._show_feedback("Tapez d'abord le mot de passe.", _RED)
return
self._connect_wifi(self._current_ssid, password)
def _connect_eth(self, iface):
self._show_feedback(f"Connexion Ethernet ({iface})…", _GREY)
self._set_busy(True)
threading.Thread(target=self._eth_worker, args=(iface,),
daemon=True).start()
def _connect_wifi(self, ssid, password):
self._show_feedback(f"Connexion au Wi-Fi « {ssid} »…", _GREY)
self._set_busy(True)
threading.Thread(target=self._wifi_worker, args=(ssid, password),
daemon=True).start()
def _eth_worker(self, iface):
rc, _out = _nm(["-w", "25", "device", "connect", iface])
GLib.idle_add(self._connect_done,
rc == 0, "Ethernet", iface, None)
def _wifi_worker(self, ssid, password):
args = ["-w", "25", "dev", "wifi", "connect", ssid]
if password:
args += ["password", password]
rc, _out = _nm(args)
ok = rc == 0
if not ok:
# Profil déjà actif (déjà connecté) → nmcli renvoie une erreur
# alors que le réseau est bien là.
ok = self._active_wifi_ssid() == ssid
GLib.idle_add(self._connect_done, ok, "wifi", ssid, password)
def _connect_done(self, ok, kind, name, password):
self._set_busy(False)
if ok:
if kind == "wifi":
self._wifi_connected = True
self._current_ssid = None
self._hide_password_panel()
self._show_feedback(
f"Connecté au Wi-Fi « {name} » ✓ — vous pouvez "
"continuer.", _GREEN)
# Marqueur pour le %post (profils NM vers la cible).
try:
with open(_KEEP_WIFI, "w") as fh:
fh.write("1")
except OSError:
pass
else:
self._show_feedback(
"Ethernet connecté ✓ — vous pouvez continuer.", _GREEN)
self._build_list(rescan=False) # marque « Connecté ✓ » + état
else:
if kind == "wifi":
self._show_feedback(
f"Connexion à « {name} » impossible : mot de passe "
"incorrect, ou réseau hors de portée. Réessayez.", _RED)
if password is not None:
# On garde la main sur le champ pour corriger.
self._current_ssid = name
self._entry.set_text("")
self._entry.set_editable(True)
self._entry.set_visibility(
self.builder.get_object("pwShow").get_active())
self._panel.show()
self._entry.grab_focus()
else:
self._show_feedback(
"Connexion Ethernet impossible (câble débranché ?).",
_RED)
return False
# ------------------------------------------------------------ helpers --
def _set_busy(self, busy, list_only=False):
self._busy = busy
self._list.set_sensitive(not busy)
if not list_only:
self.builder.get_object("pwConnect").set_sensitive(not busy)
# curseur « occupé » léger
window = self.window
if window and hasattr(window, "set_busy_cursor"):
try:
if busy:
window.set_busy_cursor()
else:
window.unset_busy_cursor()
except Exception: # pylint: disable=broad-except
pass
def _hide_password_panel(self):
self._panel.hide()
self._current_ssid = None
self._entry.set_text("")
def _on_show_toggled(self, check):
self._entry.set_visibility(check.get_active())
if check.get_active():
self._entry.grab_focus()
@@ -0,0 +1,254 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- FWS — écran « Connexion Internet » (cf. fws_network.py).
Squelette calqué sur fws_recap.glade (AnacondaStandaloneWindow + boutons
Continuer/Quitter fournis automatiquement par le widget). -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="AnacondaWidgets" version="3.0"/>
<object class="AnacondaStandaloneWindow" id="fwsNetworkWindow">
<property name="can_focus">False</property>
<property name="window_name" translatable="yes">CONNEXION INTERNET</property>
<child internal-child="main_box">
<object class="GtkBox" id="AnacondaStandaloneWindow-main_box1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child internal-child="nav_box">
<object class="GtkEventBox" id="AnacondaStandaloneWindow-nav_box1">
<property name="can_focus">False</property>
<child internal-child="nav_area">
<object class="GtkGrid" id="AnacondaStandaloneWindow-nav_area1">
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="alignment">
<object class="GtkAlignment" id="AnacondaStandaloneWindow-alignment1">
<property name="can_focus">False</property>
<property name="yalign">0</property>
<property name="left_padding">12</property>
<property name="right_padding">6</property>
<child internal-child="action_area">
<object class="GtkBox" id="fwsNetworkWindow-actionArea">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkBox" id="netContent">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<property name="margin_top">8</property>
<property name="margin_bottom">8</property>
<child>
<object class="GtkLabel" id="netTitle">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Connexion à Internet</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="netHint">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Choisissez votre réseau Wi-Fi dans la liste, ou branchez un câble Ethernet. (Vous pourrez continuer sans réseau si besoin.)</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="listHeader">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="listTitle">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Réseaux détectés :</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="refreshButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Rafraîchir</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="netScroll">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<property name="min-content-height">120</property>
<child>
<object class="GtkListBox" id="netList">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selection_mode">browse</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="netFeedback">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes"></property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkBox" id="pwPanel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="pwTitle">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Mot de passe du réseau Wi-Fi :</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="pwEntryRow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkEntry" id="pwEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="visibility">False</property>
<property name="activates_default">True</property>
<property name="placeholder_text" translatable="yes">Mot de passe</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="pwShow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Afficher</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="pwConnect">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Se connecter</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
@@ -136,6 +136,21 @@ if [ -n "$SRC_KERN" ]; then
else
echo "[FWS] AVERTISSEMENT : noyau vmlinuz-linux introuvable sur le média"
fi
# --- Wi-Fi choisi sur l'écran « Connexion Internet » → système installé -----
# La connexion est faite par NetworkManager sur le LIVE (spoke fws_network) :
# son profil vit dans /etc/NetworkManager/system-connections du live — un
# overlay TEMPORAIRE que le payload LiveOS (copie du squashfs) ne recopie PAS.
# Si l'utilisateur s'est connecté à un Wi-Fi (marqueur /tmp/fws-keep-wifi posé
# par le spoke), on copie donc les profils NM du live vers la cible : le Wi-Fi
# fonctionnera au 1er démarrage du système installé SANS ressaisie du mot de
# passe (et le %post chrooté, qui tourne sur la pile réseau du live, a déjà pu
# installer le bureau).
if [ -f /tmp/fws-keep-wifi ]; then
install -d -m 700 "$SYSROOT/etc/NetworkManager/system-connections"
cp -a /etc/NetworkManager/system-connections/. \
"$SYSROOT/etc/NetworkManager/system-connections/" 2>/dev/null || true
fi
%end
+24 -5
View File
@@ -25,7 +25,7 @@
# ============================================================================
pkgname=anaconda
pkgver=45.8
pkgrel=4
pkgrel=5
pkgdesc="The Anaconda installer (porté sur Arch pour FWS, payload liveimg)"
arch=('x86_64')
url="https://github.com/rhinstaller/anaconda"
@@ -75,9 +75,13 @@ prepare() {
# ── FWS : champ « Nom de machine » dans le spoke Utilisateur ───────────────
# Anaconda ne propage PAS le hostname (le champ du spoke Réseau est perdu chez
# nous → /etc/hostname vide). On ajoute donc un champ Hostname à l'onglet de
# création de compte (ligne 2 de la grille, libre) ; user.py écrit la valeur
# dans /tmp/fws-hostname, que le %post du kickstart applique à /etc/hostname.
# nous → /etc/hostname vide). Le nom de machine est désormais demandé PLUS TÔT,
# à l'écran « Réseau » (spoke fws_network.py de l'airootfs, qui écrit
# /tmp/fws-hostname). Le champ ci-dessous sert de RE-DEMANDE au moment de la
# création de compte : il est PRÉ-REMPLI depuis /tmp/fws-hostname (pour ne pas
# écraser le nom choisi à l'écran Réseau par une valeur vide) et user.py écrit
# la valeur (éventuellement modifiée) dans /tmp/fws-hostname, que le %post du
# kickstart applique à /etc/hostname.
python3 - <<'PYEOF'
import glob
@@ -136,7 +140,22 @@ s = open(p, encoding='utf-8').read()
anchor = 'self._username_entry = self.builder.get_object("username_entry")'
assert anchor in s, "FWS: ancre username_entry absente"
s = s.replace(anchor,
anchor + '\n self._hostname_entry = self.builder.get_object("hostname_entry")',
anchor + '\n self._hostname_entry = self.builder.get_object("hostname_entry")' + '''
# FWS : pré-remplir depuis l'écran Réseau (fws_network.py) si un nom y a
# déjà été saisi — sinon apply() ci-dessous écraserait ce nom par une
# valeur vide (le champ démarre vide). initialize() relit le fichier à
# chaque entrée dans le spoke.
try:
with open("/tmp/fws-hostname") as _fh:
_hn0 = _fh.read().strip()
except OSError:
_hn0 = ""
if _hn0:
try:
self._hostname_entry.set_text(_hn0)
except Exception:
pass''',
1)
ap = 'set_user_list(self._users_module, self._user_list, remove_unset=True)'
assert ap in s, "FWS: ancre apply() absente"