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.
This commit is contained in:
parent
6081733422
commit
93faf07b69
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -142,7 +142,6 @@ class Script():
|
|||
if not self.namespace in sys.modules or self.spec is None:
|
||||
self.load_instructions()
|
||||
|
||||
__builtins__['installation'] = self.installer # TODO: Replace this with a import archinstall.session instead
|
||||
self.spec.loader.exec_module(sys.modules[self.namespace])
|
||||
|
||||
return sys.modules[self.namespace]
|
||||
|
|
|
|||
Loading…
Reference in New Issue