added _post_install hook.
This commit is contained in:
parent
a16723abde
commit
44df0f6046
|
|
@ -177,6 +177,21 @@ class Profile(Script):
|
||||||
if hasattr(imported, '_prep_function'):
|
if hasattr(imported, '_prep_function'):
|
||||||
return True
|
return True
|
||||||
return False
|
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):
|
class Application(Profile):
|
||||||
def __repr__(self, *args, **kwargs):
|
def __repr__(self, *args, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import getpass, time, json, sys, signal, os, subprocess
|
import getpass, time, json, sys, signal, os
|
||||||
import archinstall
|
import archinstall
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue