Support FONT environment variable for console font override
When FONT env var is set, use it as the console font instead of the language-specific font mapping from languages.json. The font is applied at startup and preserved across language switches. On exit (success or failure), restore the console font to default8x16.
This commit is contained in:
parent
f6f6b4fbf1
commit
e45995fa71
|
|
@ -34,6 +34,7 @@ class Language:
|
|||
|
||||
|
||||
_DEFAULT_FONT = 'default8x16'
|
||||
_ENV_FONT = os.environ.get('FONT')
|
||||
|
||||
|
||||
def _set_console_font(font_name: str | None) -> None:
|
||||
|
|
@ -158,7 +159,8 @@ class TranslationHandler:
|
|||
"""
|
||||
# The install() call has the side effect of assigning GNUTranslations.gettext to builtins._
|
||||
language.translation.install()
|
||||
_set_console_font(language.console_font)
|
||||
|
||||
_set_console_font(_ENV_FONT if _ENV_FONT else language.console_font)
|
||||
|
||||
def _get_locales_dir(self) -> Path:
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ from archinstall.lib.networking import ping
|
|||
from archinstall.lib.output import debug, error, info, warn
|
||||
from archinstall.lib.packages.util import check_version_upgrade
|
||||
from archinstall.lib.pacman.pacman import Pacman
|
||||
from archinstall.lib.translationhandler import tr
|
||||
from archinstall.lib.translationhandler import _ENV_FONT, _set_console_font, tr
|
||||
from archinstall.lib.utils.util import running_from_iso
|
||||
from archinstall.tui.ui.components import tui
|
||||
|
||||
|
|
@ -79,6 +79,9 @@ def run() -> int:
|
|||
OR straight as a module: python -m archinstall
|
||||
In any case we will be attempting to load the provided script to be run from the scripts/ folder
|
||||
"""
|
||||
if _ENV_FONT:
|
||||
_set_console_font(_ENV_FONT)
|
||||
|
||||
arch_config_handler = ArchConfigHandler()
|
||||
|
||||
if '--help' in sys.argv or '-h' in sys.argv:
|
||||
|
|
@ -159,6 +162,8 @@ def main() -> int:
|
|||
_error_message(exc)
|
||||
rc = 1
|
||||
|
||||
_set_console_font(None)
|
||||
|
||||
return rc
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue