index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton@hvornum.se> | 2021-04-06 07:57:02 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-06 07:57:02 +0000 |
commit | 610d630863b949723431c230c4de8973dad8f60b (patch) | |
tree | d066f14065660c085d64d41e68e5029a3b06c0be /archinstall | |
parent | dc522b74b92cac38446501b8bb4fefc006ffda32 (diff) | |
parent | 4af3bbac2306146ce038666f2911690c655bcb63 (diff) |
-rw-r--r-- | archinstall/lib/profiles.py | 15 |
diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 8198ff11..70c21a67 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -177,6 +177,21 @@ class Profile(Script): if hasattr(imported, '_prep_function'): return True return False + def has_post_install(self): + with open(self.path, 'r') as source: + source_data = source.read() + + # Some crude safety checks, make sure the imported profile has + # a __name__ check and if so, check if it's got a _prep_function() + # we can call to ask for more user input. + # + # 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 '_post_install' in source_data: + with self.load_instructions(namespace=f"{self.namespace}.py") as imported: + if hasattr(imported, '_post_install'): + return True @property def packages(self) -> list: |