feat(installer): require a user account and follow the language's keyboard
Upstream Anaconda lets the user screen be left empty, which would install a system whose login screen nobody can get past, since root is meant for repairs only. Going back to pick another language also kept the first language's keyboard: with the keyboard screen hidden, the layouts now always come from the language.
This commit is contained in:
1 file changed
+43
-5
+43
-5
@@ -117,6 +117,14 @@ def _apply_live_keyboard():
|
||||
# faisait → XLayouts vide, et /root/anaconda-ks.cfg sans « --xlayouts= »
|
||||
# pour le %post du kickstart.
|
||||
try:
|
||||
# SetXKeyboardDefaults() keeps layouts already set, as if they came
|
||||
# from a kickstart: coming back to pick another language would keep
|
||||
# the first language's keyboard. With the keyboard screen hidden, the
|
||||
# layouts only ever come from the language, so they are recomputed.
|
||||
if not proxy.KeyboardKickstarted:
|
||||
proxy.XLayouts = []
|
||||
proxy.LayoutSwitchOptions = []
|
||||
proxy.VirtualConsoleKeymap = ""
|
||||
proxy.SetXKeyboardDefaults()
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.debug("FWS: SetXKeyboardDefaults indisponible", exc_info=True)
|
||||
@@ -192,12 +200,20 @@ def _hook_welcome_spoke():
|
||||
|
||||
|
||||
def _hook_user_spoke():
|
||||
"""Translates the host name field that the FWS anaconda package adds.
|
||||
"""User screen: a user account is required, and the host name field that
|
||||
the FWS anaconda package adds is translated.
|
||||
|
||||
That field comes from a patch of user.glade in the anaconda package, so its
|
||||
texts are in none of Anaconda's catalogs: they come from ours, set on each
|
||||
display like the FWS screens.
|
||||
Upstream Anaconda lets the screen be left empty ("No user will be
|
||||
created"): FWS would then install a system whose login screen nobody can
|
||||
get past, since root is meant for repairs only. "Next" is refused until a
|
||||
user name is typed (the password rules stay Anaconda's), and the screen is
|
||||
mandatory so the summary cannot start the installation without it.
|
||||
|
||||
The host name field comes from a patch of user.glade in the anaconda
|
||||
package, so its texts are in none of Anaconda's catalogs: they come from
|
||||
ours, set on each display like the FWS screens.
|
||||
"""
|
||||
from pyanaconda.core.i18n import _
|
||||
from pyanaconda.ui.gui.spokes import user as user_module
|
||||
|
||||
spoke_class = user_module.UserSpoke
|
||||
@@ -216,7 +232,29 @@ def _hook_user_spoke():
|
||||
entry.get_accessible().set_name(t("user.hostname_accessible"))
|
||||
return result
|
||||
|
||||
original_back = spoke_class.on_back_clicked
|
||||
|
||||
def on_back_clicked(self, button):
|
||||
if not self.username.strip():
|
||||
# Anaconda's own message: already translated in all its languages.
|
||||
self.show_warning_message(_("User name not set!"))
|
||||
return
|
||||
original_back(self, button)
|
||||
|
||||
# Second lock, looked up on every check run rather than bound when the
|
||||
# screen is built: Anaconda's own exit rule lets an all-empty screen go.
|
||||
original_exit_conditions = spoke_class._check_spoke_exit_conditions
|
||||
|
||||
def _check_spoke_exit_conditions(self, unwaivable_check_failed):
|
||||
original_exit_conditions(self, unwaivable_check_failed)
|
||||
if not self.username.strip():
|
||||
self.can_go_back = False
|
||||
self.needs_waiver = False
|
||||
|
||||
spoke_class.refresh = refresh
|
||||
spoke_class.on_back_clicked = on_back_clicked
|
||||
spoke_class._check_spoke_exit_conditions = _check_spoke_exit_conditions
|
||||
spoke_class.mandatory = property(lambda self: True)
|
||||
spoke_class._fws_i18n_hooked = True
|
||||
|
||||
|
||||
@@ -704,7 +742,7 @@ except Exception: # pylint: disable=broad-except
|
||||
try:
|
||||
_hook_user_spoke()
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.exception("FWS: champ « nom de machine » laissé non traduit.")
|
||||
log.exception("FWS: écran utilisateur laissé tel quel (compte facultatif, nom de machine non traduit).")
|
||||
|
||||
try:
|
||||
_patch_main_window()
|
||||
|
||||
Reference in new issue
Block a user