55import sys
66import time
77import traceback
8- from typing import TYPE_CHECKING
98
109from archinstall .lib .args import arch_config_handler
1110from archinstall .lib .disk .utils import disk_layouts
1413from .lib .output import FormattedOutput , debug , error , info , log , warn
1514from .lib .pacman import Pacman
1615from .lib .plugins import load_plugin , plugins
17- from .lib .translationhandler import DeferredTranslation , Language , translation_handler
16+ from .lib .translationhandler import Language , tr , translation_handler
1817from .tui .curses_menu import Tui
1918
20- if TYPE_CHECKING :
21- from collections .abc import Callable
22-
23- _ : Callable [[str ], DeferredTranslation ]
24-
2519
2620# @archinstall.plugin decorator hook to programmatically add
2721# plugins in runtime. Useful in profiles_bck and other things.
@@ -31,31 +25,36 @@ def plugin(f, *args, **kwargs) -> None: # type: ignore[no-untyped-def]
3125
3226def _log_sys_info () -> None :
3327 # Log various information about hardware before starting the installation. This might assist in troubleshooting
34- debug (f" Hardware model detected: { SysInfo .sys_vendor ()} { SysInfo .product_name ()} ; UEFI mode: { SysInfo .has_uefi ()} " )
35- debug (f" Processor model detected: { SysInfo .cpu_model ()} " )
36- debug (f" Memory statistics: { SysInfo .mem_available ()} available out of { SysInfo .mem_total ()} total installed" )
37- debug (f" Virtualization detected: { SysInfo .virtualization ()} ; is VM: { SysInfo .is_vm ()} " )
38- debug (f" Graphics devices detected: { SysInfo ._graphics_devices ().keys ()} " )
28+ debug (f' Hardware model detected: { SysInfo .sys_vendor ()} { SysInfo .product_name ()} ; UEFI mode: { SysInfo .has_uefi ()} ' )
29+ debug (f' Processor model detected: { SysInfo .cpu_model ()} ' )
30+ debug (f' Memory statistics: { SysInfo .mem_available ()} available out of { SysInfo .mem_total ()} total installed' )
31+ debug (f' Virtualization detected: { SysInfo .virtualization ()} ; is VM: { SysInfo .is_vm ()} ' )
32+ debug (f' Graphics devices detected: { SysInfo ._graphics_devices ().keys ()} ' )
3933
4034 # For support reasons, we'll log the disk layout pre installation to match against post-installation layout
41- debug (f" Disk states before installing:\n { disk_layouts ()} " )
35+ debug (f' Disk states before installing:\n { disk_layouts ()} ' )
4236
4337
4438def _fetch_arch_db () -> None :
45- info (" Fetching Arch Linux package database..." )
39+ info (' Fetching Arch Linux package database...' )
4640 try :
47- Pacman .run (" -Sy" )
41+ Pacman .run (' -Sy' )
4842 except Exception as e :
43+ error ('Failed to sync Arch Linux package database.' )
44+ if 'could not resolve host' in str (e ).lower ():
45+ error ('Most likely due to a missing network connection or DNS issue.' )
46+ error ('Run archinstall --debug and check /var/log/archinstall/install.log for details.' )
47+
4948 debug (f'Failed to sync Arch Linux package database: { e } ' )
5049 exit (1 )
5150
5251
5352def _check_new_version () -> None :
54- info (" Checking version..." )
53+ info (' Checking version...' )
5554 upgrade = None
5655
5756 try :
58- upgrade = Pacman .run (" -Qu archinstall" ).decode ()
57+ upgrade = Pacman .run (' -Qu archinstall' ).decode ()
5958 except Exception as e :
6059 debug (f'Failed determine pacman version: { e } ' )
6160
@@ -76,7 +75,7 @@ def main() -> int:
7675 return 0
7776
7877 if os .getuid () != 0 :
79- print (_ ( " Archinstall requires root privileges to run. See --help for more." ))
78+ print (tr ( ' Archinstall requires root privileges to run. See --help for more.' ))
8079 return 1
8180
8281 _log_sys_info ()
@@ -115,7 +114,7 @@ def run_as_a_module() -> None:
115114 text = (
116115 'Archinstall experienced the above error. If you think this is a bug, please report it to\n '
117116 'https://github.com/archlinux/archinstall and include the log file "/var/log/archinstall/install.log".\n \n '
118- ' Hint: To extract the log from a live ISO \n curl -F\ ' file=@/var/log/archinstall/install.log\ ' https://0x0.st\n '
117+ " Hint: To extract the log from a live ISO \n curl -F'file=@/var/log/archinstall/install.log' https://0x0.st\n "
119118 )
120119
121120 warn (text )
@@ -125,7 +124,6 @@ def run_as_a_module() -> None:
125124
126125
127126__all__ = [
128- 'DeferredTranslation' ,
129127 'FormattedOutput' ,
130128 'Language' ,
131129 'Pacman' ,
0 commit comments