Refactor ISO check (#4264)
This commit is contained in:
parent
d413c01fde
commit
390b4959bd
|
|
@ -1,7 +1,7 @@
|
||||||
from archinstall.lib.command import SysCommand
|
from archinstall.lib.command import SysCommand
|
||||||
from archinstall.lib.exceptions import ServiceException, SysCallError
|
from archinstall.lib.exceptions import ServiceException, SysCallError
|
||||||
from archinstall.lib.output import error
|
from archinstall.lib.output import error
|
||||||
from archinstall.lib.utils.util import running_from_host
|
from archinstall.lib.utils.util import running_from_iso
|
||||||
|
|
||||||
|
|
||||||
def list_keyboard_languages() -> list[str]:
|
def list_keyboard_languages() -> list[str]:
|
||||||
|
|
@ -80,7 +80,7 @@ def get_kb_layout() -> str:
|
||||||
|
|
||||||
|
|
||||||
def set_kb_layout(locale: str) -> bool:
|
def set_kb_layout(locale: str) -> bool:
|
||||||
if running_from_host():
|
if not running_from_iso():
|
||||||
# Skip when running from host - no need to change host keymap
|
# Skip when running from host - no need to change host keymap
|
||||||
# The target installation keymap is set via installer.set_keyboard_language()
|
# The target installation keymap is set via installer.set_keyboard_language()
|
||||||
return True
|
return True
|
||||||
|
|
|
||||||
|
|
@ -5,15 +5,14 @@ from pathlib import Path
|
||||||
from archinstall.lib.output import FormattedOutput
|
from archinstall.lib.output import FormattedOutput
|
||||||
|
|
||||||
|
|
||||||
def running_from_host() -> bool:
|
def running_from_iso() -> bool:
|
||||||
"""
|
"""
|
||||||
Check if running from an installed system.
|
Check if running from the archiso environment.
|
||||||
|
|
||||||
Returns True if running from installed system (host mode) for host-to-target install.
|
Returns True if /run/archiso/airootfs is a mount point (ISO mode).
|
||||||
Returns False if /run/archiso exists (ISO mode).
|
Returns False if running from installed system (host mode) for host-to-target install.
|
||||||
"""
|
"""
|
||||||
is_host = not Path('/run/archiso').exists()
|
return Path('/run/archiso/airootfs').is_mount()
|
||||||
return is_host
|
|
||||||
|
|
||||||
|
|
||||||
def generate_password(length: int = 64) -> str:
|
def generate_password(length: int = 64) -> str:
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ from archinstall.lib.output import debug, error, info, warn
|
||||||
from archinstall.lib.packages.util import check_version_upgrade
|
from archinstall.lib.packages.util import check_version_upgrade
|
||||||
from archinstall.lib.pacman.pacman import Pacman
|
from archinstall.lib.pacman.pacman import Pacman
|
||||||
from archinstall.lib.translationhandler import tr
|
from archinstall.lib.translationhandler import tr
|
||||||
from archinstall.lib.utils.util import running_from_host
|
from archinstall.lib.utils.util import running_from_iso
|
||||||
|
|
||||||
|
|
||||||
def _log_sys_info() -> None:
|
def _log_sys_info() -> None:
|
||||||
|
|
@ -114,11 +114,10 @@ def run() -> int:
|
||||||
info(text)
|
info(text)
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
if running_from_host():
|
if running_from_iso():
|
||||||
# log which mode we are using
|
|
||||||
debug('Running from Host (H2T Mode)...')
|
|
||||||
else:
|
|
||||||
debug('Running from ISO (Live Mode)...')
|
debug('Running from ISO (Live Mode)...')
|
||||||
|
else:
|
||||||
|
debug('Running from Host (H2T Mode)...')
|
||||||
|
|
||||||
mod_name = f'archinstall.scripts.{script}'
|
mod_name = f'archinstall.scripts.{script}'
|
||||||
# by loading the module we'll automatically run the script
|
# by loading the module we'll automatically run the script
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue