Adding on_pacstrap hook for installation. As well as a plugins listing that plugins can hook in to in order to be called during specific on_<event> calls.
This commit is contained in:
parent
fb56fa3c5f
commit
b59a406069
|
|
@ -14,6 +14,7 @@ from .lib.packages import *
|
|||
from .lib.output import *
|
||||
from .lib.storage import *
|
||||
from .lib.hardware import *
|
||||
from .lin.plugins import plugins
|
||||
|
||||
__version__ = "2.2.0"
|
||||
|
||||
|
|
@ -32,7 +33,6 @@ for arg in sys.argv[1:]:
|
|||
else:
|
||||
positionals.append(arg)
|
||||
|
||||
|
||||
# TODO: Learn the dark arts of argparse...
|
||||
# (I summon thee dark spawn of cPython)
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ from .systemd import Networkd
|
|||
from .output import log
|
||||
from .storage import storage
|
||||
from .hardware import *
|
||||
from .plugins import plugins
|
||||
|
||||
# Any package that the Installer() is responsible for (optional and the default ones)
|
||||
__packages__ = ["base", "base-devel", "linux-firmware", "linux", "linux-lts", "linux-zen", "linux-hardened"]
|
||||
|
|
@ -126,6 +127,12 @@ class Installer():
|
|||
|
||||
def pacstrap(self, *packages, **kwargs):
|
||||
if type(packages[0]) in (list, tuple): packages = packages[0]
|
||||
|
||||
for plugin in plugins.values():
|
||||
if hasattr(plugin, 'on_pacstrap'):
|
||||
if (result := plugin.on_pacstrap(packages)):
|
||||
packages = result
|
||||
|
||||
self.log(f'Installing packages: {packages}', level=logging.INFO)
|
||||
|
||||
if (sync_mirrors := sys_command('/usr/bin/pacman -Syy')).exit_code == 0:
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
plugins = {}
|
||||
Loading…
Reference in New Issue