From c4dd0e75ed6899d1066e30e6c1727a2bd3e3e4f6 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 8 Dec 2014 15:04:12 -0800 Subject: [PATCH] Add support for --installpkgs This allows the user to add specific packages, or package globs, to the installer's root via lorax. For example, to build a server product with the correct product.img you would pass --installpkgs fedora-productimg-server This removes the need for the kickstart to use --exclude on the repo lines and makes it more explicit as to what is being built. This command mirrors the same command in lorax. --- pungi.spec | 2 +- src/bin/pungi.py | 5 +++++ src/pypungi/__init__.py | 7 ++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pungi.spec b/pungi.spec index 33a9d300..b242db82 100644 --- a/pungi.spec +++ b/pungi.spec @@ -11,7 +11,7 @@ URL: https://fedorahosted.org/pungi Source0: https://fedorahosted.org/pungi/attachment/wiki/%{version}/%{name}-%{version}.tar.bz2 Requires: createrepo >= 0.4.11 Requires: yum => 3.4.3-28 -Requires: lorax +Requires: lorax >= 22.1 Requires: repoview Requires: python-lockfile diff --git a/src/bin/pungi.py b/src/bin/pungi.py index 8a7ddd64..954a7061 100755 --- a/src/bin/pungi.py +++ b/src/bin/pungi.py @@ -115,6 +115,8 @@ def main(): if opts.lorax_conf: config.set("lorax", "conf_file", opts.lorax_conf) + if opts.installpkgs: + config.set("lorax", "installpkgs", " ".join(opts.installpkgs)) # Actually do work. mypungi = pypungi.Pungi(config, ksparser) @@ -265,6 +267,9 @@ if __name__ == '__main__': help='Do not make a install DVD/CD only the netinstall image and the tree') parser.add_option("--lorax-conf", type="string", help='Path to lorax.conf file (optional)') + parser.add_option("-i", "--installpkgs", default=[], + action="append", metavar="STRING", + help="Package glob for lorax to install before runtime-install.tmpl runs. (may be listed multiple times)") parser.add_option("-c", "--config", dest="config", help='Path to kickstart config file') diff --git a/src/pypungi/__init__.py b/src/pypungi/__init__.py index 5bf0e7b6..b4fe2c83 100644 --- a/src/pypungi/__init__.py +++ b/src/pypungi/__init__.py @@ -1413,9 +1413,14 @@ class Pungi(pypungi.PungiBase): except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): lorax.configure() + try: + installpkgs = self.config.get('lorax', 'installpkgs').split(" ") + except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): + installpkgs = None + lorax.run(self.ayum, product=product, version=version, release=release, variant=variant, bugurl=bugurl, isfinal=isfinal, domacboot=domacboot, - workdir=workdir, outputdir=outputdir, volid=volid) + workdir=workdir, outputdir=outputdir, volid=volid, installpkgs=installpkgs) # write out the tree data for snake self.writeinfo('tree: %s' % self.mkrelative(self.topdir))