Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/profiles.py
diff options
context:
space:
mode:
authoradvaithm <advaith.madhukar@gmail.com>2021-04-06 07:21:11 +0530
committeradvaithm <advaith.madhukar@gmail.com>2021-04-06 07:21:11 +0530
commitf0e40f56765156aff22cb270b28aa15c5547534f (patch)
tree60df3796db57fd3fee53fac779165fd706a664b4 /archinstall/lib/profiles.py
parentb56f7d0515d7dc3b31f2c255c20bc514df9155b1 (diff)
added _post_install hook.
Diffstat (limited to 'archinstall/lib/profiles.py')
-rw-r--r--archinstall/lib/profiles.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py
index 08b1d618..77c9c6b2 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):