diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index cc5a7e77..b22a8ef4 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -143,6 +143,7 @@ class Lorax(BaseLoraxClass): def run(self, ybo, product, version, release, variant="", bugurl="", isfinal=False, workdir=None, outputdir=None, buildarch=None, volid=None, domacboot=False, doupgrade=True, remove_temp=False, + installpkgs=None, size=2, add_templates=None, add_template_vars=None, @@ -152,6 +153,8 @@ class Lorax(BaseLoraxClass): assert self._configured + installpkgs = installpkgs or [] + # get lorax version try: import pylorax.version @@ -247,6 +250,7 @@ class Lorax(BaseLoraxClass): # NOTE: rb.root = ybo.conf.installroot (== self.inroot) rb = RuntimeBuilder(product=self.product, arch=self.arch, yum=ybo, templatedir=templatedir, + installpkgs=installpkgs, add_templates=add_templates, add_template_vars=add_template_vars) diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py index 85a7fe91..73e02e65 100644 --- a/src/pylorax/treebuilder.py +++ b/src/pylorax/treebuilder.py @@ -68,6 +68,7 @@ def generate_module_info(moddir, outfile=None): class RuntimeBuilder(object): '''Builds the anaconda runtime image.''' def __init__(self, product, arch, yum, templatedir=None, + installpkgs=None, add_templates=None, add_template_vars=None): root = yum.conf.installroot @@ -81,6 +82,7 @@ class RuntimeBuilder(object): yum=yum, templatedir=templatedir) self.add_templates = add_templates or [] self.add_template_vars = add_template_vars or {} + self._installpkgs = installpkgs or [] self._runner.defaults = self.vars def _install_branding(self): @@ -107,6 +109,8 @@ class RuntimeBuilder(object): def install(self): '''Install packages and do initial setup with runtime-install.tmpl''' self._install_branding() + if len(self._installpkgs) > 0: + self._runner.installpkg(*self._installpkgs) self._runner.run("runtime-install.tmpl") for tmpl in self.add_templates: self._runner.run(tmpl, **self.add_template_vars) diff --git a/src/sbin/lorax b/src/sbin/lorax index 543cae20..d100ba9f 100755 --- a/src/sbin/lorax +++ b/src/sbin/lorax @@ -119,6 +119,9 @@ def main(args): optional.add_option("-e", "--excludepkgs", default=[], action="append", metavar="STRING", help="package glob to exclude (may be listed multiple times)") + optional.add_option("-i", "--installpkgs", default=[], + action="append", metavar="STRING", + help="package glob to install before runtime-install.tmpl runs. (may be listed multiple times)") optional.add_option("--buildarch", default=None, help="build architecture", metavar="STRING") optional.add_option("--volid", default=None, @@ -218,6 +221,7 @@ def main(args): opts.variant, opts.bugurl, opts.isfinal, workdir=tempdir, outputdir=outputdir, buildarch=opts.buildarch, volid=opts.volid, domacboot=opts.domacboot, doupgrade=opts.doupgrade, + installpkgs=opts.installpkgs, add_templates=opts.add_templates, add_template_vars=parsed_add_template_vars, add_arch_templates=opts.add_arch_templates,