Add --dracut-arg support to lorax
Use it to override the default dracut arguments (displayed as part of the --help output). If you want to extend the default arguments they all need to be passed in on the cmdline as well. eg. --dracut-arg='--xz' --dracut-arg='--install /.buildstamp' ... Resolves: rhbz#1452220
This commit is contained in:
parent
d5d3dd3be3
commit
d8ce013a2b
@ -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")
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user