Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-04-06 07:57:02 +0000
committerGitHub <noreply@github.com>2021-04-06 07:57:02 +0000
commit610d630863b949723431c230c4de8973dad8f60b (patch)
treed066f14065660c085d64d41e68e5029a3b06c0be /archinstall/lib
parentdc522b74b92cac38446501b8bb4fefc006ffda32 (diff)
parent4af3bbac2306146ce038666f2911690c655bcb63 (diff)
Merge pull request #190 from advaithm/master
post install hook
Diffstat (limited to 'archinstall/lib')
-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 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: