From 850fd2efa812508e2df67aa2b50cff8820389a0d Mon Sep 17 00:00:00 2001 From: advaithm Date: Fri, 12 Mar 2021 11:30:32 +0530 Subject: Started work on BIOS support --- archinstall/lib/installer.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 06bdd05a..ecc3c9c9 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -1,4 +1,4 @@ -import os, stat, time, shutil +import os, stat, time, shutil, subprocess from .exceptions import * from .disk import * @@ -53,6 +53,8 @@ class Installer(): } self.base_packages = base_packages.split(' ') + if not hasUEFI(): + base_packages.append('grub') # if it isn't uefi is must be bios therefore we need grub as systemd-boot is uefi only self.post_base_install = [] storage['session'] = self @@ -332,8 +334,10 @@ class Installer(): for uid in uids: real_path = os.path.realpath(os.path.join(root, uid)) if not os.path.basename(real_path) == os.path.basename(self.partition.real_device): continue - - entry.write(f'options cryptdevice=UUID={uid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n') + if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode(): # intel_paste is intel only, it's redudant on AMD systens + entry.write(f'options cryptdevice=UUID={uid}:luksdev root=/dev/mapper/luksdev rw\n') + else: + entry.write(f'options cryptdevice=UUID={uid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n') self.helper_flags['bootloader'] = bootloader return True @@ -343,13 +347,22 @@ class Installer(): for uid in uids: real_path = os.path.realpath(os.path.join(root, uid)) if not os.path.basename(real_path) == os.path.basename(self.partition.path): continue - - entry.write(f'options root=PARTUUID={uid} rw intel_pstate=no_hwp\n') + if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode(): + entry.write(f'options root=PARTUUID={uid} rw\n') + else: + entry.write(f'options root=PARTUUID={uid} rw intel_pstate=no_hwp\n') self.helper_flags['bootloader'] = bootloader return True break raise RequirementError(f"Could not identify the UUID of {self.partition}, there for {self.mountpoint}/boot/loader/entries/arch.conf will be broken until fixed.") + elif bootloader == 'grub-install': + if hasUEFI(): + o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB')) + sys_command('/usr/bin/arch-chroot grub-mkconfig -o /boot/grub/grub.cfg') + else: + o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} grub-install --target=--target=i386-pc {self}')) + sys_command('/usr/bin/arch-chroot grub-mkconfig -o /boot/grub/grub.cfg') else: raise RequirementError(f"Unknown (or not yet implemented) bootloader added to add_bootloader(): {bootloader}") -- cgit v1.2.3-54-g00ecf From ceadb59b26cd99f11480058c072a678dc8ae2476 Mon Sep 17 00:00:00 2001 From: advaithm Date: Fri, 12 Mar 2021 11:38:48 +0530 Subject: raise error if systemd-boot is used on a BIOS system --- archinstall/lib/installer.py | 89 +++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 43 deletions(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index ecc3c9c9..5ab560f4 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -313,49 +313,52 @@ class Installer(): self.log(f'Adding bootloader {bootloader} to {self.boot_partition}', level=LOG_LEVELS.Info) if bootloader == 'systemd-bootctl': - o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} bootctl --no-variables --path=/boot install')) - with open(f'{self.mountpoint}/boot/loader/loader.conf', 'w') as loader: - loader.write('default arch\n') - loader.write('timeout 5\n') - - ## For some reason, blkid and /dev/disk/by-uuid are not getting along well. - ## And blkid is wrong in terms of LUKS. - #UUID = sys_command('blkid -s PARTUUID -o value {drive}{partition_2}'.format(**args)).decode('UTF-8').strip() - with open(f'{self.mountpoint}/boot/loader/entries/arch.conf', 'w') as entry: - entry.write('title Arch Linux\n') - entry.write('linux /vmlinuz-linux\n') - entry.write('initrd /initramfs-linux.img\n') - ## blkid doesn't trigger on loopback devices really well, - ## so we'll use the old manual method until we get that sorted out. - - - if self.partition.encrypted: - for root, folders, uids in os.walk('/dev/disk/by-uuid'): - for uid in uids: - real_path = os.path.realpath(os.path.join(root, uid)) - if not os.path.basename(real_path) == os.path.basename(self.partition.real_device): continue - if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode(): # intel_paste is intel only, it's redudant on AMD systens - entry.write(f'options cryptdevice=UUID={uid}:luksdev root=/dev/mapper/luksdev rw\n') - else: - entry.write(f'options cryptdevice=UUID={uid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n') - - self.helper_flags['bootloader'] = bootloader - return True - break - else: - for root, folders, uids in os.walk('/dev/disk/by-partuuid'): - for uid in uids: - real_path = os.path.realpath(os.path.join(root, uid)) - if not os.path.basename(real_path) == os.path.basename(self.partition.path): continue - if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode(): - entry.write(f'options root=PARTUUID={uid} rw\n') - else: - entry.write(f'options root=PARTUUID={uid} rw intel_pstate=no_hwp\n') - - self.helper_flags['bootloader'] = bootloader - return True - break - raise RequirementError(f"Could not identify the UUID of {self.partition}, there for {self.mountpoint}/boot/loader/entries/arch.conf will be broken until fixed.") + if hasUEFI(): + o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} bootctl --no-variables --path=/boot install')) + with open(f'{self.mountpoint}/boot/loader/loader.conf', 'w') as loader: + loader.write('default arch\n') + loader.write('timeout 5\n') + + ## For some reason, blkid and /dev/disk/by-uuid are not getting along well. + ## And blkid is wrong in terms of LUKS. + #UUID = sys_command('blkid -s PARTUUID -o value {drive}{partition_2}'.format(**args)).decode('UTF-8').strip() + with open(f'{self.mountpoint}/boot/loader/entries/arch.conf', 'w') as entry: + entry.write('title Arch Linux\n') + entry.write('linux /vmlinuz-linux\n') + entry.write('initrd /initramfs-linux.img\n') + ## blkid doesn't trigger on loopback devices really well, + ## so we'll use the old manual method until we get that sorted out. + + + if self.partition.encrypted: + for root, folders, uids in os.walk('/dev/disk/by-uuid'): + for uid in uids: + real_path = os.path.realpath(os.path.join(root, uid)) + if not os.path.basename(real_path) == os.path.basename(self.partition.real_device): continue + if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode(): # intel_paste is intel only, it's redudant on AMD systens + entry.write(f'options cryptdevice=UUID={uid}:luksdev root=/dev/mapper/luksdev rw\n') + else: + entry.write(f'options cryptdevice=UUID={uid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n') + + self.helper_flags['bootloader'] = bootloader + return True + break + else: + for root, folders, uids in os.walk('/dev/disk/by-partuuid'): + for uid in uids: + real_path = os.path.realpath(os.path.join(root, uid)) + if not os.path.basename(real_path) == os.path.basename(self.partition.path): continue + if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode(): + entry.write(f'options root=PARTUUID={uid} rw\n') + else: + entry.write(f'options root=PARTUUID={uid} rw intel_pstate=no_hwp\n') + + self.helper_flags['bootloader'] = bootloader + return True + break + raise RequirementError(f"Could not identify the UUID of {self.partition}, there for {self.mountpoint}/boot/loader/entries/arch.conf will be broken until fixed.") + else: + raise RequirementError("Systemd boot is UEFI only it can not be installed or used on bios") elif bootloader == 'grub-install': if hasUEFI(): o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB')) -- cgit v1.2.3-54-g00ecf From 43a0134f2e59dd34252195ff4d5bae4ebaaa6117 Mon Sep 17 00:00:00 2001 From: advaithm Date: Fri, 12 Mar 2021 11:40:30 +0530 Subject: fixed typo --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 5ab560f4..e393d50e 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -358,7 +358,7 @@ class Installer(): break raise RequirementError(f"Could not identify the UUID of {self.partition}, there for {self.mountpoint}/boot/loader/entries/arch.conf will be broken until fixed.") else: - raise RequirementError("Systemd boot is UEFI only it can not be installed or used on bios") + raise RequirementError("Systemd-boot is UEFI only it can not be installed or used on bios") elif bootloader == 'grub-install': if hasUEFI(): o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB')) -- cgit v1.2.3-54-g00ecf From 94456bf8ba692fb33c819d416636b34d9b14f7af Mon Sep 17 00:00:00 2001 From: advaithm Date: Fri, 12 Mar 2021 11:57:02 +0530 Subject: add function to check cpu vendor to allow for cpu specific command line arguments --- archinstall/lib/hardware.py | 7 ++++++- archinstall/lib/installer.py | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index 93eb560f..3586ad09 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -1,4 +1,4 @@ -import os +import os, subprocess from .general import sys_command from .networking import list_interfaces, enrichIfaceTypes @@ -7,6 +7,11 @@ def hasWifi(): return True return False +def hasAMDCPU(): + if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode(): + return True + return False + def hasUEFI(): return os.path.isdir('/sys/firmware/efi') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index e393d50e..dbcfb973 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -9,6 +9,7 @@ from .mirrors import * from .systemd import Networkd from .output import log, LOG_LEVELS from .storage import storage +from .hardware import * class Installer(): """ @@ -335,7 +336,7 @@ class Installer(): for uid in uids: real_path = os.path.realpath(os.path.join(root, uid)) if not os.path.basename(real_path) == os.path.basename(self.partition.real_device): continue - if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode(): # intel_paste is intel only, it's redudant on AMD systens + if hasAMDCPU(): # intel_paste is intel only, it's redudant on AMD systens entry.write(f'options cryptdevice=UUID={uid}:luksdev root=/dev/mapper/luksdev rw\n') else: entry.write(f'options cryptdevice=UUID={uid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n') @@ -348,7 +349,7 @@ class Installer(): for uid in uids: real_path = os.path.realpath(os.path.join(root, uid)) if not os.path.basename(real_path) == os.path.basename(self.partition.path): continue - if subprocess.check_output("lscpu | grep AMD", shell=True).strip().decode(): + if hasAMDCPU(): entry.write(f'options root=PARTUUID={uid} rw\n') else: entry.write(f'options root=PARTUUID={uid} rw intel_pstate=no_hwp\n') -- cgit v1.2.3-54-g00ecf From f249476ea7c296459d175262f45c1f8273c6e8ea Mon Sep 17 00:00:00 2001 From: advaithm Date: Fri, 12 Mar 2021 13:40:54 +0530 Subject: figured out a way to get root device for installing grub --- archinstall/lib/disk.py | 18 ++++++++++-------- archinstall/lib/installer.py | 3 ++- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index cd740571..d05588a6 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -394,18 +394,20 @@ class Filesystem(): def use_entire_disk(self, root_filesystem_type='ext4', encrypt_root_partition=True): self.add_partition('primary', start='1MiB', end='513MiB', format='vfat') - self.set_name(0, 'EFI') - self.set(0, 'boot on') + #TODO: figure out what do for bios, we don't need a seprate partion for the bootloader + if hasUEFI(): + self.set_name(0, 'EFI') + self.set(0, 'boot on') # TODO: Probably redundant because in GPT mode 'esp on' is an alias for "boot on"? # https://www.gnu.org/software/parted/manual/html_node/set.html - self.set(0, 'esp on') - self.add_partition('primary', start='513MiB', end='100%') + self.set(0, 'esp on') + self.add_partition('primary', start='513MiB', end='100%') - self.blockdevice.partition[0].filesystem = 'vfat' - self.blockdevice.partition[1].filesystem = root_filesystem_type + self.blockdevice.partition[0].filesystem = 'vfat' + self.blockdevice.partition[1].filesystem = root_filesystem_type - self.blockdevice.partition[0].target_mountpoint = '/boot' - self.blockdevice.partition[1].target_mountpoint = '/' + self.blockdevice.partition[0].target_mountpoint = '/boot' + self.blockdevice.partition[1].target_mountpoint = '/' if encrypt_root_partition: self.blockdevice.partition[1].encrypted = True diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index dbcfb973..176b26f4 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -365,7 +365,8 @@ class Installer(): o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB')) sys_command('/usr/bin/arch-chroot grub-mkconfig -o /boot/grub/grub.cfg') else: - o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} grub-install --target=--target=i386-pc {self}')) + root_device = subprocess.check_output(f'basename "$(readlink -f "/sys/class/block/{self.partition.path}/..")',shell=True).decode().strip() + o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} grub-install --target=--target=i386-pc /dev/{root_device}')) sys_command('/usr/bin/arch-chroot grub-mkconfig -o /boot/grub/grub.cfg') else: raise RequirementError(f"Unknown (or not yet implemented) bootloader added to add_bootloader(): {bootloader}") -- cgit v1.2.3-54-g00ecf From 0a47dfe5d5bbc795366828fb7e453a8ef9d307cf Mon Sep 17 00:00:00 2001 From: advaithm Date: Fri, 12 Mar 2021 13:42:52 +0530 Subject: add a if statment to prevent a possible error --- archinstall/lib/installer.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 176b26f4..463f104a 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -366,6 +366,8 @@ class Installer(): sys_command('/usr/bin/arch-chroot grub-mkconfig -o /boot/grub/grub.cfg') else: root_device = subprocess.check_output(f'basename "$(readlink -f "/sys/class/block/{self.partition.path}/..")',shell=True).decode().strip() + if root_device == "block": + root_device = f"{self.partition.path}" o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} grub-install --target=--target=i386-pc /dev/{root_device}')) sys_command('/usr/bin/arch-chroot grub-mkconfig -o /boot/grub/grub.cfg') else: -- cgit v1.2.3-54-g00ecf From 72284e2b2a96f4c8c6603f3a900b956121253b92 Mon Sep 17 00:00:00 2001 From: advaithm Date: Fri, 12 Mar 2021 14:10:08 +0530 Subject: stip /dev/ since path is /dev/sdxN --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 463f104a..e8829296 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -365,7 +365,7 @@ class Installer(): o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB')) sys_command('/usr/bin/arch-chroot grub-mkconfig -o /boot/grub/grub.cfg') else: - root_device = subprocess.check_output(f'basename "$(readlink -f "/sys/class/block/{self.partition.path}/..")',shell=True).decode().strip() + root_device = subprocess.check_output(f'basename "$(readlink -f "/sys/class/block/{self.partition.path.strip("/dev/")}/..")',shell=True).decode().strip() if root_device == "block": root_device = f"{self.partition.path}" o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} grub-install --target=--target=i386-pc /dev/{root_device}')) -- cgit v1.2.3-54-g00ecf From 99dd9b1fb7856b864d816119f0742950941e97a8 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 25 Mar 2021 15:07:49 +0100 Subject: New feature: Profile() now supports .packages which returns any defined packages for that specific profile, as well as archinstall.__packages__ contain any packages that Installer() is responsible for. This can be used to quickly gather any required packages and dependencies by archinstall. Not all profiles have it yet, so .packages might return None. --- archinstall/__init__.py | 2 +- archinstall/lib/installer.py | 6 +++++- archinstall/lib/profiles.py | 22 ++++++++++++++++++++++ profiles/applications/awesome.py | 6 +++--- profiles/awesome.py | 10 ++-------- 5 files changed, 33 insertions(+), 13 deletions(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/__init__.py b/archinstall/__init__.py index d4452d38..91cf17be 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -2,7 +2,7 @@ from .lib.general import * from .lib.disk import * from .lib.user_interaction import * from .lib.exceptions import * -from .lib.installer import * +from .lib.installer import __packages__, __base_packages__, Installer from .lib.profiles import * from .lib.luks import * from .lib.mirrors import * diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 2200db8e..c31ade84 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -10,6 +10,10 @@ from .systemd import Networkd from .output import log, LOG_LEVELS from .storage import storage +# Any package that the Installer() is responsible for (optional and the default ones) +__packages__ = ["base", "base-devel", "linux", "linux-firmware", "efibootmgr", "nano", "ntp", "iwd"] +__base_packages__ = __packages__[:6] + class Installer(): """ `Installer()` is the wrapper for most basic installation steps. @@ -34,7 +38,7 @@ class Installer(): :type hostname: str, optional """ - def __init__(self, partition, boot_partition, *, base_packages='base base-devel linux linux-firmware efibootmgr nano', profile=None, mountpoint='/mnt', hostname='ArchInstalled', logdir=None, logfile=None): + def __init__(self, partition, boot_partition, *, base_packages=__base_packages__, profile=None, mountpoint='/mnt', hostname='ArchInstalled', logdir=None, logfile=None): self.profile = profile self.hostname = hostname self.mountpoint = mountpoint diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 08b1d618..8198ff11 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -178,6 +178,28 @@ class Profile(Script): return True return False + @property + def packages(self) -> list: + """ + Returns a list of packages baked into the profile definition. + If no package definition has been done, .packages() will return None. + """ + with open(self.path, 'r') as source: + source_data = source.read() + + # Some crude safety checks, make sure the imported profile has + # a __name__ check before importing. + # + # If the requirements are met, import with .py in the namespace to not + # trigger a traditional: + # if __name__ == 'moduleName' + if '__name__' in source_data and '__packages__' in source_data: + with self.load_instructions(namespace=f"{self.namespace}.py") as imported: + if hasattr(imported, '__packages__'): + return imported.__packages__ + return None + + class Application(Profile): def __repr__(self, *args, **kwargs): return f'Application({os.path.basename(self.profile)})' diff --git a/profiles/applications/awesome.py b/profiles/applications/awesome.py index 578f246e..b8d779c0 100644 --- a/profiles/applications/awesome.py +++ b/profiles/applications/awesome.py @@ -1,10 +1,10 @@ import archinstall +__packages__ = ["awesome", "xorg-xrandr", "xterm", "feh", "slock", "terminus-font", "gnu-free-fonts", "ttf-liberation", "xsel"] + installation.install_profile('xorg') -installation.add_additional_packages( - "awesome xorg-xrandr xterm feh slock terminus-font gnu-free-fonts ttf-liberation xsel" -) +installation.add_additional_packages(__packages__) with open(f'{installation.mountpoint}/etc/X11/xinit/xinitrc', 'r') as xinitrc: xinitrc_data = xinitrc.read() diff --git a/profiles/awesome.py b/profiles/awesome.py index b914b175..8004fc62 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -2,6 +2,7 @@ import archinstall +__packages__ = ['nano', 'nemo', 'gpicview-gtk3', 'chromium', 'openssh', 'sshfs', 'htop', 'scrot', 'wget'] def _prep_function(*args, **kwargs): """ @@ -28,14 +29,7 @@ if __name__ == 'awesome': awesome = archinstall.Application(installation, 'awesome') awesome.install() - # Then setup and configure the desktop environment: awesome - editor = "nano" - filebrowser = "nemo gpicview-gtk3" - webbrowser = "chromium" # TODO: Ask the user to select one instead - utils = "openssh sshfs htop scrot wget" - - - installation.add_additional_packages(f"{webbrowser} {utils} {filebrowser} {editor}") + installation.add_additional_packages(__packages__) alacritty = archinstall.Application(installation, 'alacritty') alacritty.install() -- cgit v1.2.3-54-g00ecf From b974b93004efa9912e404f5d3fca7c44a58dc0e3 Mon Sep 17 00:00:00 2001 From: advaithm Date: Fri, 2 Apr 2021 10:08:16 +0530 Subject: fixed some issues with the changes --- archinstall/lib/disk.py | 7 ++----- archinstall/lib/installer.py | 12 +++++++++++- examples/guided.py | 8 +++++++- 3 files changed, 20 insertions(+), 7 deletions(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index fbc11ca3..8e9e0234 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -390,12 +390,9 @@ class Filesystem(): # TODO: # When instance of a HDD is selected, check all usages and gracefully unmount them # as well as close any crypto handles. - def __init__(self, blockdevice): + def __init__(self, blockdevice,mode): self.blockdevice = blockdevice - if hasUEFI(): - self.mode = GPT - else: - self.mode = MBR + self.mode = mode def __enter__(self, *args, **kwargs): if self.blockdevice.keep_partitions is False: diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index d161c3b7..492d7715 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -1,4 +1,4 @@ -import os, stat, time, shutil, pathlib +import os, stat, time, shutil, pathlib, subprocess from .exceptions import * from .disk import * @@ -398,6 +398,16 @@ class Installer(): break raise RequirementError(f"Could not identify the UUID of {self.partition}, there for {self.mountpoint}/boot/loader/entries/arch.conf will be broken until fixed.") + elif bootloader == "grub-install": + if hasUEFI(): + o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB')) + sys_command('/usr/bin/arch-chroot grub-mkconfig -o /boot/grub/grub.cfg') + else: + root_device = subprocess.check_output(f'basename "$(readlink -f "/sys/class/block/{self.partition.path.strip("/dev/")}/..")',shell=True).decode().strip() + if root_device == "block": + root_device = f"{self.partition.path}" + o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} grub-install --target=--target=i386-pc /dev/{root_device}')) + sys_command('/usr/bin/arch-chroot grub-mkconfig -o /boot/grub/grub.cfg') else: raise RequirementError(f"Unknown (or not yet implemented) bootloader added to add_bootloader(): {bootloader}") diff --git a/examples/guided.py b/examples/guided.py index 71e1e01d..f374a41c 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -1,5 +1,6 @@ import getpass, time, json, sys, signal, os import archinstall +from archinstall.lib.hardware import hasUEFI """ This signal-handler chain (and global variable) @@ -244,7 +245,12 @@ def perform_installation_steps(): Setup the blockdevice, filesystem (and optionally encryption). Once that's done, we'll hand over to perform_installation() """ - with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) as fs: + # maybe we can ask the user what they would prefer on uefi systems? + if hasUEFI(): + mode = archinstall.GPT + else: + mode = archinstall.MBR + with archinstall.Filesystem(archinstall.arguments['harddrive'],mode) as fs: # Wipe the entire drive if the disk flag `keep_partitions`is False. if archinstall.arguments['harddrive'].keep_partitions is False: fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get('filesystem', 'btrfs')) -- cgit v1.2.3-54-g00ecf From 6b218e555be5860a00297be30da22a1c09944ed2 Mon Sep 17 00:00:00 2001 From: advaithm Date: Fri, 2 Apr 2021 10:16:48 +0530 Subject: changed __enter__ --- archinstall/lib/installer.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 492d7715..1411688c 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -67,9 +67,11 @@ class Installer(): log(*args, level=level, **kwargs) def __enter__(self, *args, **kwargs): - self.partition.mount(self.mountpoint) - os.makedirs(f'{self.mountpoint}/boot', exist_ok=True) - self.boot_partition.mount(f'{self.mountpoint}/boot') + if hasUEFI(): + # on bios we don't have a boot partition + self.partition.mount(self.mountpoint) + os.makedirs(f'{self.mountpoint}/boot', exist_ok=True) + self.boot_partition.mount(f'{self.mountpoint}/boot') return self def __exit__(self, *args, **kwargs): -- cgit v1.2.3-54-g00ecf From b5e32f980a27f272c1e3c42969323dff82617a84 Mon Sep 17 00:00:00 2001 From: advaithm Date: Fri, 2 Apr 2021 10:28:04 +0530 Subject: added hardwareincompatibilty erros and updated readme --- README.md | 4 ++-- archinstall/lib/installer.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'archinstall/lib/installer.py') diff --git a/README.md b/README.md index a65e92fa..9e611dd6 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,10 @@ with archinstall.Filesystem(harddrive, archinstall.GPT) as fs: This installer will perform the following: * Prompt the user to select a disk and disk-password - * Proceed to wipe the selected disk with a `GPT` partition table. + * Proceed to wipe the selected disk with a `GPT` partition table on a UEFI system and MBR on a bios system. * Sets up a default 100% used disk with encryption. * Installs a basic instance of Arch Linux *(base base-devel linux linux-firmware btrfs-progs efibootmgr)* - * Installs and configures a bootloader to partition 0. + * Installs and configures a bootloader to partition 0 on uefi. on bios it sets the root to partition 0. * Install additional packages *(nano, wget, git)* * Installs a network-profile called [workstation](https://github.com/Torxed/archinstall/blob/master/profiles/workstation.json) *(more on network profiles in the docs)* diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 1411688c..e38860d3 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -331,6 +331,8 @@ class Installer(): self.log(f'Adding bootloader {bootloader} to {self.boot_partition}', level=LOG_LEVELS.Info) if bootloader == 'systemd-bootctl': + if not hasUEFI(): + raise HardwareIncompatibilityError # TODO: Ideally we would want to check if another config # points towards the same disk and/or partition. # And in which case we should do some clean up. -- cgit v1.2.3-54-g00ecf From 0ba4e631efd5dc02390e6de0a309010be2dc08eb Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 2 Apr 2021 11:38:42 +0200 Subject: Fixing glitch in variable use after moving to __packages__ definition. --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 7f4f4104..2ffcb007 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -56,7 +56,7 @@ class Installer(): 'user' : False # Root counts as a user, if additional users are skipped. } - self.base_packages = base_packages.split(' ') + self.base_packages = base_packages.split(' ') if type(base_packages) is str else base_packages self.post_base_install = [] storage['session'] = self -- cgit v1.2.3-54-g00ecf From 81822e64443e4e43554ae4f891dfc8af79ea48d5 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 4 Apr 2021 15:13:06 +0200 Subject: Added error handling to sys_command's peak function. --- archinstall/lib/general.py | 10 ++++++++-- archinstall/lib/installer.py | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py index ded2c5a3..41a83651 100644 --- a/archinstall/lib/general.py +++ b/archinstall/lib/general.py @@ -159,10 +159,16 @@ class sys_command():#Thread): 'exit_code': self.exit_code } - def peak(self, output): + def peak(self, output :str): + if type(output) == bytes: + try: + output = output.decode('UTF-8') + except UnicodeDecodeError: + return None + if self.peak_output: from .user_interaction import get_terminal_width - + # Move back to the beginning of the terminal sys.stdout.flush() sys.stdout.write("\033[%dG" % 0) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index c0323c61..a99bc944 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -137,7 +137,7 @@ class Installer(): self.log(f'Installing packages: {packages}', level=LOG_LEVELS.Info) if (sync_mirrors := sys_command('/usr/bin/pacman -Syy')).exit_code == 0: - if (pacstrap := sys_command(f'/usr/bin/pacstrap {self.mountpoint} {" ".join(packages)}', **kwargs)).exit_code == 0: + if (pacstrap := sys_command(f'/usr/bin/pacstrap {self.mountpoint} {" ".join(packages)}', peak_output=True, **kwargs)).exit_code == 0: return True else: self.log(f'Could not strap in packages: {pacstrap.exit_code}', level=LOG_LEVELS.Info) -- cgit v1.2.3-54-g00ecf From 36bad8254f4097a080c29ef54cf98ee80620639e Mon Sep 17 00:00:00 2001 From: advaithm Date: Wed, 7 Apr 2021 17:21:31 +0530 Subject: added support to automatically add ucode to initrd --- archinstall/lib/installer.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index a99bc944..d9a36859 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -9,7 +9,7 @@ from .mirrors import * from .systemd import Networkd from .output import log, LOG_LEVELS from .storage import storage - +from .hardware import * # Any package that the Installer() is responsible for (optional and the default ones) __packages__ = ["base", "base-devel", "linux", "linux-firmware", "efibootmgr", "nano", "ntp", "iwd"] __base_packages__ = __packages__[:6] @@ -288,7 +288,14 @@ class Installer(): self.pacstrap(self.base_packages) self.helper_flags['base-strapped'] = True #self.genfstab() - + if not isVM(): + vendor = cpuVendor() + if vendor == "AuthenticAMD": + self.base_packages.append("amd-ucode") + elif vendor == "GenuineIntel": + self.base_packages.append("intel-ucode") + else: + self.log("unknown cpu vendor not installing ucode") with open(f"{self.mountpoint}/etc/fstab", "a") as fstab: fstab.write( "\ntmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0\n" @@ -364,13 +371,20 @@ class Installer(): ## For some reason, blkid and /dev/disk/by-uuid are not getting along well. ## And blkid is wrong in terms of LUKS. #UUID = sys_command('blkid -s PARTUUID -o value {drive}{partition_2}'.format(**args)).decode('UTF-8').strip() - # Setup the loader entry with open(f'{self.mountpoint}/boot/loader/entries/{self.init_time}.conf', 'w') as entry: entry.write(f'# Created by: archinstall\n') entry.write(f'# Created on: {self.init_time}\n') entry.write(f'title Arch Linux\n') entry.write(f'linux /vmlinuz-linux\n') + if not isVM(): + vendor = cpuVendor() + if vendor == "AuthenticAMD": + entry.write("initrd /amd-ucode.img") + elif vendor == "GenuineIntel": + entry.write("initrd /amd-ucode.img") + else: + self.log("unknow cpu vendor, not adding ucode to systemd-boot config") entry.write(f'initrd /initramfs-linux.img\n') ## blkid doesn't trigger on loopback devices really well, ## so we'll use the old manual method until we get that sorted out. -- cgit v1.2.3-54-g00ecf From d6a92df7896f850a3c7f36c9d299f15a70ee50f7 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 7 Apr 2021 14:52:15 +0200 Subject: Reverted a change with newline to open --- archinstall/lib/installer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index c99d0017..e02bbf75 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -153,11 +153,11 @@ class Installer(): self.log(f"Updating {self.mountpoint}/etc/fstab", level=LOG_LEVELS.Info) fstab = sys_command(f'/usr/bin/genfstab {flags} {self.mountpoint}').trace_log - with open(f"{self.mountpoint}/etc/fstab", 'ab',newline='\n') as fstab_fh: + with open(f"{self.mountpoint}/etc/fstab", 'ab') as fstab_fh: fstab_fh.write(fstab) if not os.path.isfile(f'{self.mountpoint}/etc/fstab'): - raise RequirementError(f'Could not generate fstab, strapping in packages most likely failed (disk out of space?)\n{b"".join(fstab)}') + raise RequirementError(f'Could not generate fstab, strapping in packages most likely failed (disk out of space?)\n{fstab}') return True -- cgit v1.2.3-54-g00ecf From 8ad22004414f141897bbfe959b4864ffc29070a1 Mon Sep 17 00:00:00 2001 From: nullrequest <30698906+advaithm@users.noreply.github.com> Date: Wed, 7 Apr 2021 21:12:43 +0530 Subject: Fixed typos --- archinstall/lib/installer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index d9a36859..8938b371 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -380,9 +380,9 @@ class Installer(): if not isVM(): vendor = cpuVendor() if vendor == "AuthenticAMD": - entry.write("initrd /amd-ucode.img") + entry.write("initrd /amd-ucode.img\n") elif vendor == "GenuineIntel": - entry.write("initrd /amd-ucode.img") + entry.write("initrd /intel-ucode.img\n") else: self.log("unknow cpu vendor, not adding ucode to systemd-boot config") entry.write(f'initrd /initramfs-linux.img\n') -- cgit v1.2.3-54-g00ecf From 78aba78db7a30a97550e4683d1ed33ced5b86205 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sat, 10 Apr 2021 12:09:02 -0400 Subject: Fix issue #263 --- archinstall/lib/installer.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index e9343cd1..5523b1e1 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -10,6 +10,8 @@ from .systemd import Networkd from .output import log, LOG_LEVELS from .storage import storage from .hardware import * +from .gfx_drivers import * + # Any package that the Installer() is responsible for (optional and the default ones) __packages__ = ["base", "base-devel", "linux", "linux-firmware", "efibootmgr", "nano", "ntp", "iwd"] __base_packages__ = __packages__[:6] -- cgit v1.2.3-54-g00ecf From 1292c07796b763b926fd5edb21905a663eaef8f0 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 11 Apr 2021 10:20:33 +0200 Subject: Fixed PR #273. Moved the graphic drivers into hardware since they are hardware specific, in the long run maybe we move them into 'drivers' or something. And moved the user interaction from gfx_drivers into user_interactions. And removed the import from installer.py to __init__.py since we don't want to import 'global functions' in extension imports. --- archinstall/lib/hardware.py | 19 +++++++++++ archinstall/lib/installer.py | 1 - archinstall/lib/user_interaction.py | 67 +++++++++++++++++++++++++++++++++++++ profiles/sway.py | 2 +- profiles/xorg.py | 2 +- 5 files changed, 88 insertions(+), 3 deletions(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index 3da333de..047b3491 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -2,6 +2,25 @@ import os, subprocess, json from .general import sys_command from .networking import list_interfaces, enrichIfaceTypes from typing import Optional + +AVAILABLE_GFX_DRIVERS = { + # Sub-dicts are layer-2 options to be selected + # and lists are a list of packages to be installed + 'AMD / ATI' : { + 'amd' : ['xf86-video-amdgpu'], + 'ati' : ['xf86-video-ati'] + }, + 'intel' : ['xf86-video-intel'], + 'nvidia' : { + 'open source' : ['xf86-video-nouveau'], + 'proprietary' : ['nvidia'] + }, + 'mesa' : ['mesa'], + 'fbdev' : ['xf86-video-fbdev'], + 'vesa' : ['xf86-video-vesa'], + 'vmware' : ['xf86-video-vmware'] +} + def hasWifi()->bool: return 'WIRELESS' in enrichIfaceTypes(list_interfaces().values()).values() diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 5523b1e1..484e7407 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -10,7 +10,6 @@ from .systemd import Networkd from .output import log, LOG_LEVELS from .storage import storage from .hardware import * -from .gfx_drivers import * # Any package that the Installer() is responsible for (optional and the default ones) __packages__ = ["base", "base-devel", "linux", "linux-firmware", "efibootmgr", "nano", "ntp", "iwd"] diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index b94bf3f5..d17691de 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -5,6 +5,8 @@ from .locale_helpers import search_keyboard_layout from .output import log, LOG_LEVELS from .storage import storage from .networking import list_interfaces +from .general import sys_command +from .hardware import AVAILABLE_GFX_DRIVERS ## TODO: Some inconsistencies between the selection processes. ## Some return the keys from the options, some the values? @@ -363,3 +365,68 @@ def select_mirror_regions(mirrors, show_top_mirrors=True): return selected_mirrors raise RequirementError("Selecting mirror region require a least one region to be given as an option.") + +def select_driver(options=AVAILABLE_GFX_DRIVERS): + """ + Some what convoluted function, which's job is simple. + Select a graphics driver from a pre-defined set of popular options. + + (The template xorg is for beginner users, not advanced, and should + there for appeal to the general public first and edge cases later) + """ + drivers = sorted(list(options)) + + if len(drivers) >= 1: + for index, driver in enumerate(drivers): + print(f"{index}: {driver}") + + print(' -- The above list are supported graphic card drivers. --') + print(' -- You need to select (and read about) which one you need. --') + + lspci = sys_command(f'/usr/bin/lspci') + for line in lspci.trace_log.split(b'\r\n'): + if b' vga ' in line.lower(): + if b'nvidia' in line.lower(): + print(' ** nvidia card detected, suggested driver: nvidia **') + elif b'amd' in line.lower(): + print(' ** AMD card detected, suggested driver: AMD / ATI **') + + selected_driver = input('Select your graphics card driver: ') + initial_option = selected_driver + + # Disabled search for now, only a few profiles exist anyway + # + #print(' -- You can enter ? or help to search for more drivers --') + #if selected_driver.lower() in ('?', 'help'): + # filter_string = input('Search for layout containing (example: "sv-"): ') + # new_options = search_keyboard_layout(filter_string) + # return select_language(new_options) + if selected_driver.isdigit() and (pos := int(selected_driver)) <= len(drivers)-1: + selected_driver = options[drivers[pos]] + elif selected_driver in options: + selected_driver = options[options.index(selected_driver)] + elif len(selected_driver) == 0: + raise RequirementError("At least one graphics driver is needed to support a graphical environment. Please restart the installer and try again.") + else: + raise RequirementError("Selected driver does not exist.") + + if type(selected_driver) == dict: + driver_options = sorted(list(selected_driver)) + for index, driver_package_group in enumerate(driver_options): + print(f"{index}: {driver_package_group}") + + selected_driver_package_group = input(f'Which driver-type do you want for {initial_option}: ') + if selected_driver_package_group.isdigit() and (pos := int(selected_driver_package_group)) <= len(driver_options)-1: + selected_driver_package_group = selected_driver[driver_options[pos]] + elif selected_driver_package_group in selected_driver: + selected_driver_package_group = selected_driver[selected_driver.index(selected_driver_package_group)] + elif len(selected_driver_package_group) == 0: + raise RequirementError(f"At least one driver package is required for a graphical environment using {selected_driver}. Please restart the installer and try again.") + else: + raise RequirementError(f"Selected driver-type does not exist for {initial_option}.") + + return selected_driver_package_group + + return selected_driver + + raise RequirementError("Selecting drivers require a least one profile to be given as an option.") \ No newline at end of file diff --git a/profiles/sway.py b/profiles/sway.py index 10e30753..f1d2c1f1 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -10,7 +10,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - __builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver() + __builtins__['_gfx_driver_packages'] = archinstall.select_driver() return True diff --git a/profiles/xorg.py b/profiles/xorg.py index 6ee72487..42597a37 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -12,7 +12,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - __builtins__['_gfx_driver_packages'] = archinstall.lib.gfx_drivers.select_driver() + __builtins__['_gfx_driver_packages'] = archinstall.select_driver() # TODO: Add language section and/or merge it with the locale selected # earlier in for instance guided.py installer. -- cgit v1.2.3-54-g00ecf From 77894df51c581d26c958f07524e576d3bc118efd Mon Sep 17 00:00:00 2001 From: Malccolm Haak Date: Sat, 17 Apr 2021 14:37:14 +1000 Subject: Whitespace needs to be tabs. Added test for UEFI, if not found add grub-install to pacstrap install --- archinstall/lib/installer.py | 20 +++++++++++--------- examples/guided.py | 8 ++++---- 2 files changed, 15 insertions(+), 13 deletions(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index a99bc944..70ff86f2 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -22,7 +22,7 @@ class Installer(): :param partition: Requires a partition as the first argument, this is so that the installer can mount to `mountpoint` and strap packages there. :type partition: class:`archinstall.Partition` - + :param boot_partition: There's two reasons for needing a boot partition argument, The first being so that `mkinitcpio` can place the `vmlinuz` kernel at the right place during the `pacstrap` or `linux` and the base packages for a minimal installation. @@ -33,7 +33,7 @@ class Installer(): :param profile: A profile to install, this is optional and can be called later manually. This just simplifies the process by not having to call :py:func:`~archinstall.Installer.install_profile` later on. :type profile: str, optional - + :param hostname: The given /etc/hostname for the machine. :type hostname: str, optional @@ -118,7 +118,7 @@ class Installer(): if not os.path.isdir(f"{self.mountpoint}/{os.path.dirname(absolute_logfile)}"): os.makedirs(f"{self.mountpoint}/{os.path.dirname(absolute_logfile)}") - + shutil.copy2(absolute_logfile, f"{self.mountpoint}/{absolute_logfile}") return True @@ -126,7 +126,7 @@ class Installer(): def mount(self, partition, mountpoint, create_mountpoint=True): if create_mountpoint and not os.path.isdir(f'{self.mountpoint}{mountpoint}'): os.makedirs(f'{self.mountpoint}{mountpoint}') - + partition.mount(f'{self.mountpoint}{mountpoint}') def post_install_check(self, *args, **kwargs): @@ -149,14 +149,14 @@ class Installer(): def genfstab(self, flags='-pU'): self.log(f"Updating {self.mountpoint}/etc/fstab", level=LOG_LEVELS.Info) - + fstab = sys_command(f'/usr/bin/genfstab {flags} {self.mountpoint}').trace_log with open(f"{self.mountpoint}/etc/fstab", 'ab') as fstab_fh: fstab_fh.write(fstab) if not os.path.isfile(f'{self.mountpoint}/etc/fstab'): raise RequirementError(f'Could not generate fstab, strapping in packages most likely failed (disk out of space?)\n{o}') - + return True def set_hostname(self, hostname=None, *args, **kwargs): @@ -219,7 +219,7 @@ class Installer(): network["DNS"] = dns conf = Networkd(Match={"Name": nic}, Network=network) - + with open(f"{self.mountpoint}/etc/systemd/network/10-{nic}.network", "a") as netconf: netconf.write(str(conf)) @@ -234,7 +234,7 @@ class Installer(): # If we haven't installed the base yet (function called pre-maturely) if self.helper_flags.get('base', False) is False: self.base_packages.append('iwd') - # This function will be called after minimal_installation() + # This function will be called after minimal_installation() # as a hook for post-installs. This hook is only needed if # base is not installed yet. def post_install_enable_iwd_service(*args, **kwargs): @@ -285,6 +285,8 @@ class Installer(): self.base_packages.append('xfsprogs') if self.partition.filesystem == 'f2fs': self.base_packages.append('f2fs-tools') + if not(hasUEFI()): + self.base_packages.append('grub-install') self.pacstrap(self.base_packages) self.helper_flags['base-strapped'] = True #self.genfstab() @@ -353,7 +355,7 @@ class Installer(): f"default {self.init_time}", f"timeout 5" ] - + with open(f'{self.mountpoint}/boot/loader/loader.conf', 'w') as loader: for line in loader_data: if line[:8] == 'default ': diff --git a/examples/guided.py b/examples/guided.py index dfc2da07..38d5d653 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -314,10 +314,10 @@ def perform_installation(device, boot_partition, language, mirrors): if installation.minimal_installation(): installation.set_mirrors(mirrors) # Set the mirrors in the installation medium installation.set_keyboard_language(language) - if hasUEFI(): - installation.add_bootloader() - else: - installation.add_bootloader(bootloder='grub-install') + if hasUEFI(): + installation.add_bootloader() + else: + installation.add_bootloader(bootloder='grub-install') # If user selected to copy the current ISO network configuration -- cgit v1.2.3-54-g00ecf From e32dbfbd108e9b8598e148a0873d20384c573034 Mon Sep 17 00:00:00 2001 From: Malccolm Haak Date: Sat, 17 Apr 2021 14:38:00 +1000 Subject: Package called grub not grub-install --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 70ff86f2..2122ebd9 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -286,7 +286,7 @@ class Installer(): if self.partition.filesystem == 'f2fs': self.base_packages.append('f2fs-tools') if not(hasUEFI()): - self.base_packages.append('grub-install') + self.base_packages.append('grub') self.pacstrap(self.base_packages) self.helper_flags['base-strapped'] = True #self.genfstab() -- cgit v1.2.3-54-g00ecf