Skip to content

Commit aa90624

Browse files
committed
Refactor ISO check
1 parent d413c01 commit aa90624

3 files changed

Lines changed: 11 additions & 13 deletions

File tree

archinstall/lib/locale/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from archinstall.lib.command import SysCommand
22
from archinstall.lib.exceptions import ServiceException, SysCallError
33
from archinstall.lib.output import error
4-
from archinstall.lib.utils.util import running_from_host
4+
from archinstall.lib.utils.util import running_from_iso
55

66

77
def list_keyboard_languages() -> list[str]:
@@ -80,7 +80,7 @@ def get_kb_layout() -> str:
8080

8181

8282
def set_kb_layout(locale: str) -> bool:
83-
if running_from_host():
83+
if not running_from_iso():
8484
# Skip when running from host - no need to change host keymap
8585
# The target installation keymap is set via installer.set_keyboard_language()
8686
return True

archinstall/lib/utils/util.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
from archinstall.lib.output import FormattedOutput
66

77

8-
def running_from_host() -> bool:
8+
def running_from_iso() -> bool:
99
"""
10-
Check if running from an installed system.
10+
Check if running from the archiso environment.
1111
12-
Returns True if running from installed system (host mode) for host-to-target install.
13-
Returns False if /run/archiso exists (ISO mode).
12+
Returns True if /run/archiso/airootfs is a mount point (ISO mode).
13+
Returns False if running from installed system (host mode) for host-to-target install.
1414
"""
15-
is_host = not Path('/run/archiso').exists()
16-
return is_host
15+
return Path('/run/archiso/airootfs').is_mount()
1716

1817

1918
def generate_password(length: int = 64) -> str:

archinstall/main.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from archinstall.lib.packages.util import check_version_upgrade
1818
from archinstall.lib.pacman.pacman import Pacman
1919
from archinstall.lib.translationhandler import tr
20-
from archinstall.lib.utils.util import running_from_host
20+
from archinstall.lib.utils.util import running_from_iso
2121

2222

2323
def _log_sys_info() -> None:
@@ -114,11 +114,10 @@ def run() -> int:
114114
info(text)
115115
time.sleep(3)
116116

117-
if running_from_host():
118-
# log which mode we are using
119-
debug('Running from Host (H2T Mode)...')
120-
else:
117+
if running_from_iso():
121118
debug('Running from ISO (Live Mode)...')
119+
else:
120+
debug('Running from Host (H2T Mode)...')
122121

123122
mod_name = f'archinstall.scripts.{script}'
124123
# by loading the module we'll automatically run the script

0 commit comments

Comments
 (0)