diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index ffef6c3e..c70e959f 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -58,6 +58,8 @@ except ImportError: else: vernum = pylorax.version.num +DRACUT_DEFAULT = ["--xz", "--install", "/.buildstamp", "--no-early-microcode", "--add", "fips"] + # List of drivers to remove on ppc64 arch to keep initrd < 32MiB REMOVE_PPC64_DRIVERS = "floppy scsi_debug nouveau radeon cirrus mgag200" REMOVE_PPC64_MODULES = "drm plymouth" @@ -180,7 +182,8 @@ class Lorax(BaseLoraxClass): add_template_vars=None, add_arch_templates=None, add_arch_template_vars=None, - verify=True): + verify=True, + user_dracut_args=None): assert self._configured @@ -342,7 +345,13 @@ class Lorax(BaseLoraxClass): workdir=self.workdir) logger.info("rebuilding initramfs images") - dracut_args = ["--xz", "--install", "/.buildstamp", "--no-early-microcode", "--add", "fips"] + if not user_dracut_args: + dracut_args = DRACUT_DEFAULT + else: + dracut_args = [] + for arg in user_dracut_args: + dracut_args += arg.split(" ", 1) + anaconda_args = dracut_args + ["--add", "anaconda pollcdrom qemu qemu-net"] # ppc64 cannot boot an initrd > 32MiB so remove some drivers @@ -353,6 +362,8 @@ class Lorax(BaseLoraxClass): # upgrade.img anaconda_args.extend(["--omit", REMOVE_PPC64_MODULES]) + logger.info("dracut args = %s", dracut_args) + logger.info("anaconda args = %s", anaconda_args) treebuilder.rebuild_initrds(add_args=anaconda_args) logger.info("populating output tree and building boot images") diff --git a/src/pylorax/cmdline.py b/src/pylorax/cmdline.py index 49e1f280..03461b44 100644 --- a/src/pylorax/cmdline.py +++ b/src/pylorax/cmdline.py @@ -26,7 +26,7 @@ from pylorax import vernum version = "{0}-{1}".format(os.path.basename(sys.argv[0]), vernum) -def lorax_parser(): +def lorax_parser(dracut_default=""): """ Return the ArgumentParser for lorax""" parser = argparse.ArgumentParser(description="Create the Anaconda boot.iso") @@ -108,6 +108,14 @@ def lorax_parser(): optional.add_argument("--noverifyssl", action="store_true", default=False, help="Do not verify SSL certificates") + # dracut arguments + dracut_group = parser.add_argument_group("dracut arguments") + dracut_group.add_argument("--dracut-arg", action="append", dest="dracut_args", + help="Argument to pass to dracut when " + "rebuilding the initramfs. Pass this " + "once for each argument. NOTE: this " + "overrides the default. (default: %s)" % dracut_default) + # add the show version option parser.add_argument("-V", help="show program's version number and exit", action="version", version=version) diff --git a/src/sbin/livemedia-creator b/src/sbin/livemedia-creator index e43436f0..fb7c80aa 100755 --- a/src/sbin/livemedia-creator +++ b/src/sbin/livemedia-creator @@ -29,13 +29,13 @@ import tempfile # Use the Lorax treebuilder branch for iso creation from pylorax import setup_logging, find_templates, vernum from pylorax.cmdline import lmc_parser -from pylorax.creator import run_creator +from pylorax.creator import run_creator, DRACUT_DEFAULT from pylorax.imgutils import default_image_name from pylorax.sysutils import joinpaths def main(): - parser = lmc_parser() + parser = lmc_parser(DRACUT_DEFAULT) opts = parser.parse_args() setup_logging(opts.logfile, log) diff --git a/src/sbin/lorax b/src/sbin/lorax index f3d0b8e9..e3bb3e35 100755 --- a/src/sbin/lorax +++ b/src/sbin/lorax @@ -33,6 +33,7 @@ import dnf import dnf.logging import librepo import pylorax +from pylorax import DRACUT_DEFAULT from pylorax.cmdline import lorax_parser import selinux @@ -52,7 +53,7 @@ def setup_logging(opts): def main(): - parser = lorax_parser() + parser = lorax_parser(DRACUT_DEFAULT) opts = parser.parse_args() log.info("Lorax v%s", pylorax.vernum) @@ -138,7 +139,8 @@ def main(): add_template_vars=parsed_add_template_vars, add_arch_templates=opts.add_arch_templates, add_arch_template_vars=parsed_add_arch_template_vars, - remove_temp=True, verify=opts.verify) + remove_temp=True, verify=opts.verify, + user_dracut_args=opts.dracut_args) def get_dnf_base_object(installroot, sources, mirrorlists=None, repos=None,