index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | advaithm <advaith.madhukar@gmail.com> | 2021-04-06 07:21:11 +0530 |
---|---|---|
committer | Dylan Taylor <dylan@dylanmtaylor.com> | 2021-04-08 09:51:11 -0400 |
commit | 44df0f6046ac0d010641801a413e7839ca234e97 (patch) | |
tree | 2caa3ec6a0e61aa975b644702b3b4905158a95d2 /archinstall/lib/profiles.py | |
parent | a16723abdec6442eeb70999c3cb92ab3a2b465e3 (diff) |
-rw-r--r-- | archinstall/lib/profiles.py | 15 |
diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 4ef6c533..b56304c5 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 class Application(Profile): def __repr__(self, *args, **kwargs): |