Added the option to set keyboard layout of installation. Not only on the live medium

This commit is contained in:
Anton Hvornum 2020-09-01 10:33:18 +02:00
parent 8f35f44939
commit 677533f765
2 changed files with 14 additions and 5 deletions

View File

@ -242,6 +242,12 @@ class Installer():
o = b''.join(sys_command(f"/usr/bin/arch-chroot {self.mountpoint} sh -c \"echo '{user}:{password}' | chpasswd\""))
pass
def set_keyboard_language(language):
with open(f'{self.mountpoint}/etc/vconsole.conf', 'w') as vconsole:
vconsole.write(f'KEYMAP={language}\n')
vconsole.write(f'FONT=lat9w-16\n')
return True
def add_AUR_support(self):
log(f'Building and installing yay support into {self.mountpoint}')
self.add_additional_packages(['git', 'base-devel']) # TODO: Remove if not explicitly added at one point
@ -250,6 +256,8 @@ class Installer():
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} sh -c "su - aibuilder -c \\"(cd /home/aibuilder; git clone https://aur.archlinux.org/yay.git)\\""'))
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} sh -c "chown -R aibuilder.aibuilder /home/aibuilder/yay"'))
log(f'Building and installing yay.')
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} sh -c "su - aibuilder -c \\"(cd /home/aibuilder/yay; makepkg -si --noconfirm)\\" >/dev/null"'))
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} sh -c "userdel aibuilder; rm -rf /hoem/aibuilder"'))

View File

@ -1,6 +1,6 @@
import archinstall, getpass, time
def perform_installation(device, boot_partition):
def perform_installation(device, boot_partition, language):
"""
Performs the installation steps on a block device.
Only requirement is that the block devices are
@ -8,6 +8,7 @@ def perform_installation(device, boot_partition):
"""
with archinstall.Installer(device, boot_partition=boot_partition, hostname=hostname) as installation:
if installation.minimal_installation():
installation.set_keyboard_language(language)
installation.add_bootloader()
if len(packages) and packages[0] != '':
@ -26,7 +27,7 @@ def perform_installation(device, boot_partition):
if root_pw:
installation.user_set_pw('root', root_pw)
if len(aur.strip()):
if len(aur.strip()) and aur.strip().lower() != 'no':
installation.add_AUR_support()
# Unmount and close previous runs (in case the installer is restarted)
@ -82,7 +83,7 @@ while 1:
break
aur = input('Would you like AUR support? (leave blank for no): ')
if len(aur.strip()):
if len(aur.strip()) and aur.lower() != 'no':
archinstall.log(' - AUR support provided by yay (https://aur.archlinux.org/packages/yay/)', bg='black', fg='white')
profile = input('Any particular profile you want to install: ')
@ -125,7 +126,7 @@ with archinstall.Filesystem(harddrive, archinstall.GPT) as fs:
with archinstall.luks2(harddrive.partition[1], 'luksloop', disk_password) as unlocked_device:
unlocked_device.format('btrfs')
perform_installation(unlocked_device, harddrive.partition[0])
perform_installation(unlocked_device, harddrive.partition[0], keyboard_language)
else:
harddrive.partition[1].format('ext4')
perform_installation(harddrive.partition[1], harddrive.partition[0])
perform_installation(harddrive.partition[1], harddrive.partition[0], keyboard_language)