4848from archinstall .lib .models .locale import LocaleConfiguration
4949from archinstall .lib .models .mirrors import MirrorConfiguration
5050from archinstall .lib .models .network import Nic
51+ from archinstall .lib .models .package_types import DEFAULT_KERNEL , Kernel
5152from archinstall .lib .models .packages import Repository
5253from archinstall .lib .models .pacman import PacmanConfiguration
5354from archinstall .lib .models .users import User
6566# pacman picks the first initramfs provider from the host's pacman.conf, which on non-Arch
6667# hosts (EndeavourOS prefers dracut, etc.) breaks the installer's mkinitcpio() and
6768# _config_uki() methods that assume mkinitcpio is present in the chroot.
68- __packages__ = ['base' , 'sudo' , 'linux-firmware' , 'mkinitcpio' , 'linux' , 'linux-lts' , 'linux-zen' , 'linux-hardened' ]
69+ __packages__ = ['base' , 'sudo' , 'linux-firmware' , 'mkinitcpio' ] + [ k . value for k in Kernel ]
6970
7071# Additional packages that are installed if the user is running the Live ISO with accessibility tools enabled
7172__accessibility_packages__ = ['brltty' , 'espeakup' , 'alsa-utils' ]
@@ -85,7 +86,7 @@ def __init__(
8586 It also wraps :py:func:`~archinstall.Installer.pacstrap` among other things.
8687 """
8788 self ._base_packages = base_packages or __packages__ [:4 ]
88- self .kernels = kernels or ['linux' ]
89+ self .kernels = kernels or [DEFAULT_KERNEL . value ]
8990 self ._disk_config = disk_config
9091
9192 self ._disk_encryption = disk_config .disk_encryption or DiskEncryption (EncryptionType .NO_ENCRYPTION )
@@ -744,6 +745,9 @@ def arch_chroot(self, cmd: str, run_as: str | None = None, peek_output: bool = F
744745
745746 return self .run_command (cmd , peek_output = peek_output )
746747
748+ def _chroot_argv (self , * args : str ) -> list [str ]:
749+ return ['arch-chroot' , '-S' , str (self .target ), * args ]
750+
747751 def drop_to_shell (self ) -> None :
748752 subprocess .check_call (f'arch-chroot { self .target } ' , shell = True )
749753
@@ -992,17 +996,7 @@ def setup_btrfs_snapshot(
992996 }
993997
994998 for config_name , mountpoint in snapper .items ():
995- command = [
996- 'arch-chroot' ,
997- '-S' ,
998- str (self .target ),
999- 'snapper' ,
1000- '--no-dbus' ,
1001- '-c' ,
1002- config_name ,
1003- 'create-config' ,
1004- mountpoint ,
1005- ]
999+ command = self ._chroot_argv ('snapper' , '--no-dbus' , '-c' , config_name , 'create-config' , mountpoint )
10061000
10071001 try :
10081002 SysCommand (command , peek_output = True )
@@ -1341,13 +1335,7 @@ def _add_grub_bootloader(
13411335
13421336 boot_dir = Path ('/boot' )
13431337
1344- command = [
1345- 'arch-chroot' ,
1346- '-S' ,
1347- str (self .target ),
1348- 'grub-install' ,
1349- '--debug' ,
1350- ]
1338+ command = self ._chroot_argv ('grub-install' , '--debug' )
13511339
13521340 if SysInfo .has_uefi ():
13531341 if not efi_partition :
@@ -1927,16 +1915,17 @@ def _create_user(self, user: User) -> None:
19271915 if not handled_by_plugin :
19281916 info (f'Creating user { user .username } ' )
19291917
1930- cmd = 'useradd -m'
1918+ cmd = self . _chroot_argv ( 'useradd' , ' -m')
19311919
19321920 if user .sudo :
1933- cmd += ' -G wheel'
1921+ cmd += [ '-G' , ' wheel']
19341922
1935- cmd += f' { user .username } '
1923+ cmd += [ '--' , user .username ]
19361924
19371925 try :
1938- self .arch_chroot (cmd )
1939- except SysCallError as err :
1926+ run (cmd )
1927+ except CalledProcessError as err :
1928+ debug (f'Error creating user { user .username } : { err } ' )
19401929 raise SystemError (f'Could not create user inside installation: { err } ' )
19411930
19421931 for plugin in plugins .values ():
@@ -1947,7 +1936,11 @@ def _create_user(self, user: User) -> None:
19471936 self .set_user_password (user )
19481937
19491938 for group in user .groups :
1950- self .arch_chroot (f'gpasswd -a { user .username } { group } ' )
1939+ cmd = self ._chroot_argv ('gpasswd' , '-a' , user .username , group )
1940+ try :
1941+ run (cmd )
1942+ except CalledProcessError as err :
1943+ warn (f'Failed to add { user .username } to group { group } : { err } ' )
19511944
19521945 if user .sudo :
19531946 self .enable_sudo (user )
@@ -1962,7 +1955,7 @@ def set_user_password(self, user: User) -> bool:
19621955 return False
19631956
19641957 input_data = f'{ user .username } :{ enc_password } ' .encode ()
1965- cmd = [ 'arch-chroot' , '-S' , str ( self .target ), 'chpasswd' , '--encrypted' ]
1958+ cmd = self ._chroot_argv ( 'chpasswd' , '--encrypted' )
19661959
19671960 try :
19681961 run (cmd , input_data = input_data )
@@ -1974,7 +1967,7 @@ def set_user_password(self, user: User) -> bool:
19741967 def user_set_shell (self , user : str , shell : str ) -> bool :
19751968 info (f'Setting shell for { user } to { shell } ' )
19761969
1977- cmd = [ 'arch-chroot' , '-S' , str ( self .target ), 'chsh' , '-s' , shell , user ]
1970+ cmd = self ._chroot_argv ( 'chsh' , '-s' , shell , user )
19781971 try :
19791972 run (cmd )
19801973 return True
@@ -1984,7 +1977,7 @@ def user_set_shell(self, user: str, shell: str) -> bool:
19841977
19851978 def chown (self , owner : str , path : str , options : list [str ] | None = None ) -> bool :
19861979 options = options or []
1987- cmd = [ 'arch-chroot' , '-S' , str ( self .target ), 'chown' , * options , owner , path ]
1980+ cmd = self ._chroot_argv ( 'chown' , * options , '--' , owner , path )
19881981 try :
19891982 run (cmd )
19901983 return True
@@ -1995,12 +1988,10 @@ def chown(self, owner: str, path: str, options: list[str] | None = None) -> bool
19951988 def set_vconsole (self , locale_config : LocaleConfiguration ) -> None :
19961989 # use the already set kb layout
19971990 kb_vconsole : str = locale_config .kb_layout
1998- # this is the default used in ISO other option for hdpi screens TER16x32
1999- # can be checked using
2000- # zgrep "CONFIG_FONT" /proc/config.gz
2001- # https://wiki.archlinux.org/title/Linux_console#Fonts
1991+ font_vconsole = locale_config .console_font
20021992
2003- font_vconsole = 'default8x16'
1993+ if font_vconsole .startswith ('ter-' ):
1994+ self .pacman .strap (['terminus-font' ])
20041995
20051996 # Ensure /etc exists
20061997 vconsole_dir : Path = self .target / 'etc'
0 commit comments