From 5729b0bb4da4ce9361e0fe55b3fe8f20d8d747e4 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 28 May 2021 13:52:01 -0400 Subject: Make this template usable to users of more platforms In case someone is trying to edit this as a template, this will work for more people. --- examples/custom-command-sample.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/custom-command-sample.json b/examples/custom-command-sample.json index f38bcca1..980541de 100644 --- a/examples/custom-command-sample.json +++ b/examples/custom-command-sample.json @@ -8,7 +8,7 @@ ], "!encryption-password": "supersecret", "filesystem": "btrfs", - "gfx_driver": "VMware / VirtualBox (open-source)", + "gfx_driver": "All open-source (default)", "harddrive": { "path": "/dev/nvme0n1" }, -- cgit v1.2.3-70-g09d2 From 630045f4a6c4c845f75ce9af18754d4dd1648519 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 29 May 2021 11:43:35 +0200 Subject: Added Libera information --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c430ac0e..d4fdc5de 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ + drawing -- cgit v1.2.3-70-g09d2 From f60cd10afbd8a0981ee0d59b7044b00be8acd8b7 Mon Sep 17 00:00:00 2001 From: Csonka Mihaly Date: Sun, 30 May 2021 17:37:44 +0200 Subject: Fix typo in error msg --- archinstall/lib/disk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 8f67111a..f4936d73 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -456,7 +456,7 @@ class Filesystem: if SysCommand(f'/usr/bin/parted -s {self.blockdevice.device} mklabel msdos').exit_code == 0: return self else: - raise DiskError('Problem setting the partition format to GPT:', f'/usr/bin/parted -s {self.blockdevice.device} mklabel msdos') + raise DiskError('Problem setting the partition format to MBR:', f'/usr/bin/parted -s {self.blockdevice.device} mklabel msdos') else: raise DiskError(f'Unknown mode selected to format in: {self.mode}') -- cgit v1.2.3-70-g09d2 From baca0cc51456c6129f3cb13b508e66687023f64c Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Mon, 31 May 2021 10:09:03 +0200 Subject: Creating PR --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index c5e77b7e..47e858c9 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -468,7 +468,7 @@ class Installer: entry.write('# Created by: archinstall\n') entry.write(f'# Created on: {self.init_time}\n') entry.write('title Arch Linux\n') - entry.write('linux /vmlinuz-linux\n') + entry.write('linux /vmlinuz-linux\n') # Issue: hardcoded if not is_vm(): vendor = cpu_vendor() if vendor == "AuthenticAMD": -- cgit v1.2.3-70-g09d2 From 3006e5b4c3594ac21714e54d7751b8fec03ae9c2 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Mon, 31 May 2021 11:15:01 +0200 Subject: Creating multiple boot configs, based on the selected kernels. Not 100% sure both initramfs and vmlinuz will have the trailing definitions, but made both {kernel} --- archinstall/lib/installer.py | 62 ++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 47e858c9..fc6bb821 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -40,6 +40,7 @@ class Installer: base_packages = __packages__[:3] if kernels is None: kernels = ['linux'] + self.kernels = kernels self.target = target self.init_time = time.strftime('%Y-%m-%d_%H-%M-%S') self.milliseconds = int(str(time.time()).split('.')[1]) @@ -53,6 +54,7 @@ class Installer: for kernel in kernels: self.base_packages.append(kernel) + self.post_base_install = [] storage['session'] = self @@ -453,45 +455,43 @@ class Installer: with open(f'{self.target}/boot/loader/loader.conf', 'w') as loader: for line in loader_data: if line[:8] == 'default ': - loader.write(f'default {self.init_time}\n') + loader.write(f'default {self.init_time}_{self.kernels[0]}\n') elif line[:8] == '#timeout' and 'timeout 5' not in loader_data: # We add in the default timeout to support dual-boot loader.write(f"{line[1:]}\n") else: loader.write(f"{line}\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() - # Setup the loader entry - with open(f'{self.target}/boot/loader/entries/{self.init_time}.conf', 'w') as entry: - entry.write('# Created by: archinstall\n') - entry.write(f'# Created on: {self.init_time}\n') - entry.write('title Arch Linux\n') - entry.write('linux /vmlinuz-linux\n') # Issue: hardcoded - if not is_vm(): - vendor = cpu_vendor() - if vendor == "AuthenticAMD": - entry.write("initrd /amd-ucode.img\n") - elif vendor == "GenuineIntel": - entry.write("initrd /intel-ucode.img\n") + for kernel in self.kernels: + # Setup the loader entry + with open(f'{self.target}/boot/loader/entries/{self.init_time}_{kernel}.conf', 'w') as entry: + entry.write('# Created by: archinstall\n') + entry.write(f'# Created on: {self.init_time}\n') + entry.write('title Arch Linux\n') + entry.write(f"linux /vmlinuz-{kernel}\n") # Issue: hardcoded + if not is_vm(): + vendor = cpu_vendor() + if vendor == "AuthenticAMD": + entry.write("initrd /amd-ucode.img\n") + elif vendor == "GenuineIntel": + 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-{kernel}.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 real_device := self.detect_encryption(root_partition): + # TODO: We need to detect if the encrypted device is a whole disk encryption, + # or simply a partition encryption. Right now we assume it's a partition (and we always have) + log(f"Identifying root partition by PART-UUID on {real_device}: '{real_device.uuid}'.", level=logging.DEBUG) + entry.write(f'options cryptdevice=PARTUUID={real_device.uuid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp {" ".join(self.KERNEL_PARAMS)}\n') else: - self.log("unknow cpu vendor, not adding ucode to systemd-boot config") - 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 real_device := self.detect_encryption(root_partition): - # TODO: We need to detect if the encrypted device is a whole disk encryption, - # or simply a partition encryption. Right now we assume it's a partition (and we always have) - log(f"Identifying root partition by PART-UUID on {real_device}: '{real_device.uuid}'.", level=logging.DEBUG) - entry.write(f'options cryptdevice=PARTUUID={real_device.uuid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp {" ".join(self.KERNEL_PARAMS)}\n') - else: - log(f"Identifying root partition by PART-UUID on {root_partition}, looking for '{root_partition.uuid}'.", level=logging.DEBUG) - entry.write(f'options root=PARTUUID={root_partition.uuid} rw intel_pstate=no_hwp {" ".join(self.KERNEL_PARAMS)}\n') + log(f"Identifying root partition by PART-UUID on {root_partition}, looking for '{root_partition.uuid}'.", level=logging.DEBUG) + entry.write(f'options root=PARTUUID={root_partition.uuid} rw intel_pstate=no_hwp {" ".join(self.KERNEL_PARAMS)}\n') - self.helper_flags['bootloader'] = bootloader - return True + self.helper_flags['bootloader'] = bootloader + return True elif bootloader == "grub-install": self.pacstrap('grub') -- cgit v1.2.3-70-g09d2 From 7b1bb4af97e9a1bf1d14b0f4e60e8a87c043e832 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Mon, 31 May 2021 12:17:18 +0200 Subject: Fixed a plugin issue where there are no plugins found. --- archinstall/lib/plugins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/plugins.py b/archinstall/lib/plugins.py index a61be30b..24fbd8ee 100644 --- a/archinstall/lib/plugins.py +++ b/archinstall/lib/plugins.py @@ -16,7 +16,7 @@ plugins = {} # 1: List archinstall.plugin definitions # 2: Load the plugin entrypoint # 3: Initiate the plugin and store it as .name in plugins -for plugin_definition in metadata.entry_points()['archinstall.plugin']: +for plugin_definition in metadata.entry_points().get('archinstall.plugin', []): plugin_entrypoint = plugin_definition.load() try: plugins[plugin_definition.name] = plugin_entrypoint() -- cgit v1.2.3-70-g09d2 From 62c22f78b17621a70ed5839a6c3ea728cc03a791 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Mon, 31 May 2021 12:26:49 +0200 Subject: Moved return logic to not abort the iteration of kernels. --- archinstall/lib/installer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index fc6bb821..b752e86e 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -491,7 +491,6 @@ class Installer: entry.write(f'options root=PARTUUID={root_partition.uuid} rw intel_pstate=no_hwp {" ".join(self.KERNEL_PARAMS)}\n') self.helper_flags['bootloader'] = bootloader - return True elif bootloader == "grub-install": self.pacstrap('grub') @@ -509,10 +508,11 @@ class Installer: o = b''.join(SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --target=i386-pc /dev/{root_device}')) SysCommand('/usr/bin/arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg') self.helper_flags['bootloader'] = True - return True else: raise RequirementError(f"Unknown (or not yet implemented) bootloader requested: {bootloader}") + return True + def add_additional_packages(self, *packages): return self.pacstrap(*packages) -- cgit v1.2.3-70-g09d2 From fca6eba86c4c93dbc12c317eb11bf4bc7ab0b074 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Mon, 31 May 2021 12:49:45 +0200 Subject: Removed Libera chat challenge as per request --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index d4fdc5de..c430ac0e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ - drawing -- cgit v1.2.3-70-g09d2 From ec2b00c117edff0cd6da6a9fb7b99bd1b7fa84c5 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Mon, 31 May 2021 19:45:49 -0400 Subject: Remove comment that no longer applies --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index b752e86e..c2db8337 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -468,7 +468,7 @@ class Installer: entry.write('# Created by: archinstall\n') entry.write(f'# Created on: {self.init_time}\n') entry.write('title Arch Linux\n') - entry.write(f"linux /vmlinuz-{kernel}\n") # Issue: hardcoded + entry.write(f"linux /vmlinuz-{kernel}\n") if not is_vm(): vendor = cpu_vendor() if vendor == "AuthenticAMD": -- cgit v1.2.3-70-g09d2 From 7b0863f2899812607f064c0b76c9347410302726 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 1 Jun 2021 22:24:26 +0200 Subject: Added a tribute logo Used in discord and other social gatherings. --- docs/_static/logo.pride.png | Bin 0 -> 66199 bytes docs/_static/logo.pride.psd | Bin 0 -> 759002 bytes docs/_static/logo.psd | Bin 0 -> 603666 bytes docs/logo.psd | Bin 603666 -> 0 bytes 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/_static/logo.pride.png create mode 100644 docs/_static/logo.pride.psd create mode 100644 docs/_static/logo.psd delete mode 100644 docs/logo.psd diff --git a/docs/_static/logo.pride.png b/docs/_static/logo.pride.png new file mode 100644 index 00000000..82e8f427 Binary files /dev/null and b/docs/_static/logo.pride.png differ diff --git a/docs/_static/logo.pride.psd b/docs/_static/logo.pride.psd new file mode 100644 index 00000000..37bc6676 Binary files /dev/null and b/docs/_static/logo.pride.psd differ diff --git a/docs/_static/logo.psd b/docs/_static/logo.psd new file mode 100644 index 00000000..d23965b9 Binary files /dev/null and b/docs/_static/logo.psd differ diff --git a/docs/logo.psd b/docs/logo.psd deleted file mode 100644 index d23965b9..00000000 Binary files a/docs/logo.psd and /dev/null differ -- cgit v1.2.3-70-g09d2 From 6a0f6b161c69a465529e13f061c83e5609bdfaf3 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 2 Jun 2021 21:31:28 +0200 Subject: Adding more granular debugging --- archinstall/__init__.py | 4 ++++ archinstall/lib/general.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/archinstall/__init__.py b/archinstall/__init__.py index fcd9a706..0b799d5b 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -61,6 +61,10 @@ def initialize_arguments(): arguments = initialize_arguments() +storage['arguments'] = arguments +if arguments.get('debug'): + log(f"Warning: --debug mode will write certain credentials to {storage['LOG_PATH']}/{storage['LOG_FILE']}!", fg="red", level=logging.WARNING) + from .lib.plugins import plugins, load_plugin # This initiates the plugin loading ceremony if arguments.get('plugin', None): diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py index 3b62c891..7aa307a6 100644 --- a/archinstall/lib/general.py +++ b/archinstall/lib/general.py @@ -13,7 +13,7 @@ from typing import Union from .exceptions import * from .output import log - +from .storage import storage def gen_uid(entropy_length=256): return hashlib.sha512(os.urandom(entropy_length)).hexdigest() @@ -265,6 +265,8 @@ class SysCommandWorker: if not self.pid: try: os.execve(self.cmd[0], self.cmd, {**os.environ, **self.environment_vars}) + if storage.arguments.get('debug'): + log(f"Executing: {self.cmd}", level=logging.DEBUG) except FileNotFoundError: log(f"{self.cmd[0]} does not exist.", level=logging.ERROR, fg="red") self.exit_code = 1 -- cgit v1.2.3-70-g09d2 From f88da816456af4c2516c678cca74a85072d8d5f1 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 2 Jun 2021 16:51:57 -0400 Subject: Add description to profile listing --- archinstall/lib/profiles.py | 12 ++++++++++++ archinstall/lib/user_interaction.py | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index d4913e7e..8434a0ab 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -228,6 +228,18 @@ class Profile(Script): # since developers like less code - omitting it should assume they want to present it. return True + def get_profile_description(self): + with open(self.path, 'r') as source: + source_data = source.read() + + if '__description__' in source_data: + with self.load_instructions(namespace=f"{self.namespace}.py") as imported: + if hasattr(imported, '__description__'): + return imported.__description__ + + # Default to this string if the profile does not have a description. + return "This profile does not have the __description__ attribute set." + @property def packages(self) -> Optional[list]: """ diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 79919658..004d81be 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -575,7 +575,8 @@ def select_profile(): if len(shown_profiles) >= 1: for index, profile in enumerate(shown_profiles): - print(f"{index}: {profile}") + description = Profile(None, profile).get_profile_description() + print(f"{index}: {profile}: {description}") print(' -- The above list is a set of pre-programmed profiles. --') print(' -- They might make it easier to install things like desktop environments. --') -- cgit v1.2.3-70-g09d2 From 81269b972c07fefe7cc7bcc923b5f8189bc757df Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 2 Jun 2021 16:56:39 -0400 Subject: Remove line explaining desktop profile --- archinstall/lib/user_interaction.py | 1 - 1 file changed, 1 deletion(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 004d81be..b52267d9 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -580,7 +580,6 @@ def select_profile(): print(' -- The above list is a set of pre-programmed profiles. --') print(' -- They might make it easier to install things like desktop environments. --') - print(' -- The desktop profile will let you select a DE/WM profile, e.g gnome, kde, sway --') print(' -- (Leave blank and hit enter to skip this step and continue) --') selected_profile = generic_select(actual_profiles_raw, 'Enter a pre-programmed profile name if you want to install one: ', options_output=False) -- cgit v1.2.3-70-g09d2 From abcf3ea88a363d0d7055634b28e5b00e1323e6bb Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 2 Jun 2021 23:53:13 +0200 Subject: Wrong variable name --- archinstall/lib/general.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py index 7aa307a6..f72311c9 100644 --- a/archinstall/lib/general.py +++ b/archinstall/lib/general.py @@ -265,7 +265,7 @@ class SysCommandWorker: if not self.pid: try: os.execve(self.cmd[0], self.cmd, {**os.environ, **self.environment_vars}) - if storage.arguments.get('debug'): + if storage['arguments'].get('debug'): log(f"Executing: {self.cmd}", level=logging.DEBUG) except FileNotFoundError: log(f"{self.cmd[0]} does not exist.", level=logging.ERROR, fg="red") -- cgit v1.2.3-70-g09d2 From c851a38a9e3e14e8cc9dee63d6531ba33b6bb262 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 2 Jun 2021 21:00:42 -0400 Subject: Add additional hardware functions --- archinstall/lib/hardware.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index 6a3b166d..6f05f620 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -107,6 +107,43 @@ def cpu_vendor() -> Optional[str]: return None +def cpu_model() -> Optional[str]: + cpu_info_raw = SysCommand("lscpu -J") + cpu_info = json.loads(b"".join(cpu_info_raw).decode('UTF-8'))['lscpu'] + + for info in cpu_info: + if info.get('field', None) == "Model name:": + return info.get('data', None) + return None + + +def sys_vendor() -> Optional[str]: + with open(f"/sys/devices/virtual/dmi/id/sys_vendor") as vendor: + return vendor.read() + + +def product_name() -> Optional[str]: + with open(f"/sys/devices/virtual/dmi/id/product_name") as product: + return product.read() + + +def mem_info(): + # This implementation is from https://stackoverflow.com/a/28161352 + return dict((i.split()[0].rstrip(':'), int(i.split()[1])) for i in open('/proc/meminfo').readlines()) + + +def mem_available() -> Optional[str]: + return mem_info()['MemAvailable'] + + +def mem_free() -> Optional[str]: + return mem_info()['MemFree'] + + +def mem_total() -> Optional[str]: + return mem_info()['MemTotal'] + + def is_vm() -> bool: try: # systemd-detect-virt issues a non-zero exit code if it is not on a virtual machine -- cgit v1.2.3-70-g09d2 From e90b17ca1cab9287529eac7576c4e031d18a1f04 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 2 Jun 2021 21:10:41 -0400 Subject: Add hardware logging to beginning of installation --- archinstall/lib/hardware.py | 8 ++++++-- examples/guided.py | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index 6f05f620..180d0b75 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -119,12 +119,12 @@ def cpu_model() -> Optional[str]: def sys_vendor() -> Optional[str]: with open(f"/sys/devices/virtual/dmi/id/sys_vendor") as vendor: - return vendor.read() + return vendor.read().strip() def product_name() -> Optional[str]: with open(f"/sys/devices/virtual/dmi/id/product_name") as product: - return product.read() + return product.read().strip() def mem_info(): @@ -144,6 +144,10 @@ def mem_total() -> Optional[str]: return mem_info()['MemTotal'] +def virtualization() -> Optional[str]: + return str(SysCommand("systemd-detect-virt")).strip('\r\n') + + def is_vm() -> bool: try: # systemd-detect-virt issues a non-zero exit code if it is not on a virtual machine diff --git a/examples/guided.py b/examples/guided.py index 42429370..a842e6ff 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -5,7 +5,7 @@ import time import archinstall from archinstall.lib.general import run_custom_user_commands -from archinstall.lib.hardware import has_uefi, AVAILABLE_GFX_DRIVERS +from archinstall.lib.hardware import * from archinstall.lib.networking import check_mirror_reachable from archinstall.lib.profiles import Profile @@ -16,6 +16,12 @@ if os.getuid() != 0: print("Archinstall requires root privileges to run. See --help for more.") exit(1) +# Log various information about hardware before starting the installation. This might assist in troubleshooting +archinstall.log(f"Hardware model detected: {archinstall.sys_vendor()} {archinstall.product_name()}; UEFI mode: {archinstall.has_uefi()}", level=logging.DEBUG) +archinstall.log(f"Processor model detected: {archinstall.cpu_model()}", level=logging.DEBUG) +archinstall.log(f"Memory statistics: {archinstall.mem_available()} available out of {archinstall.mem_total()} total installed", level=logging.DEBUG) +archinstall.log(f"Virtualization detected: {archinstall.virtualization()}; is VM: {archinstall.is_vm()}", level=logging.DEBUG) + # For support reasons, we'll log the disk layout pre installation to match against post-installation layout archinstall.log(f"Disk states before installing: {archinstall.disk_layouts()}", level=logging.DEBUG) -- cgit v1.2.3-70-g09d2 From 5f4a24d5cc0ebfdb48898b677fe1a9f3a5c93d05 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 2 Jun 2021 21:23:56 -0400 Subject: Add graphics device listing --- examples/guided.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/guided.py b/examples/guided.py index a842e6ff..18b2e768 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -21,6 +21,7 @@ archinstall.log(f"Hardware model detected: {archinstall.sys_vendor()} {archinsta archinstall.log(f"Processor model detected: {archinstall.cpu_model()}", level=logging.DEBUG) archinstall.log(f"Memory statistics: {archinstall.mem_available()} available out of {archinstall.mem_total()} total installed", level=logging.DEBUG) archinstall.log(f"Virtualization detected: {archinstall.virtualization()}; is VM: {archinstall.is_vm()}", level=logging.DEBUG) +archinstall.log(f"Graphics devices detected: {archinstall.graphics_devices()}", level=logging.DEBUG) # For support reasons, we'll log the disk layout pre installation to match against post-installation layout archinstall.log(f"Disk states before installing: {archinstall.disk_layouts()}", level=logging.DEBUG) -- cgit v1.2.3-70-g09d2 From 118cc17eb210a29b61406f6a5bd7d68cbc0744eb Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 2 Jun 2021 21:26:24 -0400 Subject: Fix my Quadro T1000 not being detected --- archinstall/lib/hardware.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index 180d0b75..66dfd3d0 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -79,7 +79,7 @@ def has_uefi() -> bool: def graphics_devices() -> dict: cards = {} for line in SysCommand("lspci"): - if b' VGA ' in line: + if b' VGA ' in line or b' 3D ' in line: _, identifier = line.split(b': ', 1) cards[identifier.strip().lower().decode('UTF-8')] = line return cards -- cgit v1.2.3-70-g09d2 From 3e505d4321a6593574bfbcb468803ae5266ffb01 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 2 Jun 2021 21:43:46 -0400 Subject: Clean up graphics driver output --- archinstall/lib/hardware.py | 8 ++++---- examples/guided.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index 66dfd3d0..45e042db 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -81,20 +81,20 @@ def graphics_devices() -> dict: for line in SysCommand("lspci"): if b' VGA ' in line or b' 3D ' in line: _, identifier = line.split(b': ', 1) - cards[identifier.strip().lower().decode('UTF-8')] = line + cards[identifier.strip().decode('UTF-8')] = line return cards def has_nvidia_graphics() -> bool: - return any('nvidia' in x for x in graphics_devices()) + return any('nvidia' in x.lower() for x in graphics_devices()) def has_amd_graphics() -> bool: - return any('amd' in x for x in graphics_devices()) + return any('amd' in x.lower() for x in graphics_devices()) def has_intel_graphics() -> bool: - return any('intel' in x for x in graphics_devices()) + return any('intel' in x.lower() for x in graphics_devices()) def cpu_vendor() -> Optional[str]: diff --git a/examples/guided.py b/examples/guided.py index 18b2e768..56c054fc 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -21,7 +21,7 @@ archinstall.log(f"Hardware model detected: {archinstall.sys_vendor()} {archinsta archinstall.log(f"Processor model detected: {archinstall.cpu_model()}", level=logging.DEBUG) archinstall.log(f"Memory statistics: {archinstall.mem_available()} available out of {archinstall.mem_total()} total installed", level=logging.DEBUG) archinstall.log(f"Virtualization detected: {archinstall.virtualization()}; is VM: {archinstall.is_vm()}", level=logging.DEBUG) -archinstall.log(f"Graphics devices detected: {archinstall.graphics_devices()}", level=logging.DEBUG) +archinstall.log(f"Graphics devices detected: {archinstall.graphics_devices().keys()}", level=logging.DEBUG) # For support reasons, we'll log the disk layout pre installation to match against post-installation layout archinstall.log(f"Disk states before installing: {archinstall.disk_layouts()}", level=logging.DEBUG) -- cgit v1.2.3-70-g09d2 From dcf178c7e8ae733fa46d680dee392fb4815ba2d9 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Thu, 3 Jun 2021 07:20:16 -0400 Subject: Add some safeguards to create directories before writing files --- archinstall/lib/installer.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index c2db8337..da6f6a9b 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -2,8 +2,8 @@ from .disk import * from .hardware import * from .locale_helpers import verify_keyboard_layout, verify_x11_keyboard_layout from .mirrors import * -from .storage import storage from .plugins import plugins +from .storage import storage from .user_interaction import * # Any package that the Installer() is responsible for (optional and the default ones) @@ -54,7 +54,6 @@ class Installer: for kernel in kernels: self.base_packages.append(kernel) - self.post_base_install = [] storage['session'] = self @@ -442,6 +441,10 @@ class Installer: # Fallback, try creating the boot loader without touching the EFI variables SysCommand(f'/usr/bin/arch-chroot {self.target} bootctl --no-variables --path=/boot install') + # Ensure that the /boot/loader directory exists before we try to create files in it + if not os.path.exists(f'{self.target}/boot/loader'): + os.makedirs(f'{self.target}/boot/loader') + # Modify or create a loader.conf if os.path.isfile(f'{self.target}/boot/loader/loader.conf'): with open(f'{self.target}/boot/loader/loader.conf', 'r') as loader: @@ -462,6 +465,10 @@ class Installer: else: loader.write(f"{line}\n") + # Ensure that the /boot/loader/entries directory exists before we try to create files in it + if not os.path.exists(f'{self.target}/boot/loader/entries'): + os.makedirs(f'{self.target}/boot/loader/entries') + for kernel in self.kernels: # Setup the loader entry with open(f'{self.target}/boot/loader/entries/{self.init_time}_{kernel}.conf', 'w') as entry: -- cgit v1.2.3-70-g09d2 From f1503349dabaef1d2ec721a11e997949a1959f30 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 3 Jun 2021 08:25:36 -0400 Subject: Attempt to avoid crashing when encountering swap partitions in has_content() --- archinstall/lib/disk.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index f4936d73..d0e3f6a2 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -254,7 +254,8 @@ class Partition: return None def has_content(self): - if not get_filesystem_type(self.path): + fs_type = get_filesystem_type(self.path) + if not fs_type or "swap" in fs_type: return False temporary_mountpoint = '/tmp/' + hashlib.md5(bytes(f"{time.time()}", 'UTF-8') + os.urandom(12)).hexdigest() -- cgit v1.2.3-70-g09d2