From 93faf07b6948074e9071faf75f96ff220714d5f9 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 21 Mar 2021 15:25:24 +0100 Subject: Moved the globalization of 'installation' variable. Since Profile() might be created before the installation instance, we need to move the global variable declaration after installation has begun and there's an installation instance. --- archinstall/lib/installer.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 2604e77d..8d7d6967 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -381,6 +381,15 @@ class Installer(): return self.pacstrap(*packages) def install_profile(self, profile): + # TODO: Replace this with a import archinstall.session instead in the profiles. + # The tricky thing with doing the import archinstall.session instead is that + # profiles might be run from a different chroot, and there's no way we can + # guarantee file-path safety when accessing the installer object that way. + # Doing the __builtins__ replacement, ensures that the global vriable "installation" + # is always kept up to date. It's considered a nasty hack - but it's a safe way + # of ensuring 100% accuracy of archinstall session variables. + __builtins__['installation'] = self.installer + if type(profile) == str: profile = Profile(self, profile) -- cgit v1.2.3-70-g09d2 From 35e774f5f60e09f5a9a4deb7fb6317d87c9a131f Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 21 Mar 2021 15:28:11 +0100 Subject: Spelling error on variable. --- 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 8d7d6967..db73d324 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -388,7 +388,7 @@ class Installer(): # Doing the __builtins__ replacement, ensures that the global vriable "installation" # is always kept up to date. It's considered a nasty hack - but it's a safe way # of ensuring 100% accuracy of archinstall session variables. - __builtins__['installation'] = self.installer + __builtins__['installation'] = self if type(profile) == str: profile = Profile(self, profile) -- cgit v1.2.3-70-g09d2 From 2fab088314d4d7e9f580376d035db1c2a96e043a Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 21 Mar 2021 16:48:22 +0100 Subject: Added some debugging to help identify why archinstall cannot find unencrypted devices when setting up the boot loader. --- archinstall/lib/installer.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index db73d324..4b964773 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -352,6 +352,7 @@ class Installer(): if self.partition.encrypted: + log(f"Identifying root partition {self.partition} to boot based on disk UUID, looking for '{os.path.basename(self.partition.real_device)}'.", level=LOG_LEVELS.Info) 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)) @@ -363,6 +364,7 @@ class Installer(): return True break else: + log(f"Identifying root partition {self.partition} to boot based on partition UUID, looking for '{os.path.basename(self.partition.path)}'.", level=LOG_LEVELS.Info) 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)) @@ -373,6 +375,7 @@ class Installer(): 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(f"Unknown (or not yet implemented) bootloader added to add_bootloader(): {bootloader}") -- cgit v1.2.3-70-g09d2 From dbe086024d5fc1ab25218f1ea0e063881e66efd6 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 21 Mar 2021 16:58:27 +0100 Subject: Moved some info logs into debug instead to minimize user splash. --- archinstall/lib/installer.py | 4 ++-- archinstall/lib/profiles.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'archinstall/lib/installer.py') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 4b964773..1c66f6ac 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -352,7 +352,7 @@ class Installer(): if self.partition.encrypted: - log(f"Identifying root partition {self.partition} to boot based on disk UUID, looking for '{os.path.basename(self.partition.real_device)}'.", level=LOG_LEVELS.Info) + log(f"Identifying root partition {self.partition} to boot based on disk UUID, looking for '{os.path.basename(self.partition.real_device)}'.", level=LOG_LEVELS.Debug) 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)) @@ -364,7 +364,7 @@ class Installer(): return True break else: - log(f"Identifying root partition {self.partition} to boot based on partition UUID, looking for '{os.path.basename(self.partition.path)}'.", level=LOG_LEVELS.Info) + log(f"Identifying root partition {self.partition} to boot based on partition UUID, looking for '{os.path.basename(self.partition.path)}'.", level=LOG_LEVELS.Debug) 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)) diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index e9639451..08b1d618 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -77,7 +77,7 @@ class Script(): self.examples = None self.namespace = os.path.splitext(os.path.basename(self.path))[0] self.original_namespace = self.namespace - log(f"Script {self} has been loaded with namespace '{self.namespace}'") + log(f"Script {self} has been loaded with namespace '{self.namespace}'", level=LOG_LEVELS.Debug) def __enter__(self, *args, **kwargs): self.execute() -- cgit v1.2.3-70-g09d2