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
(cherry picked from commit d8ce013a2b
)
This commit is contained in:
parent
b9fe90000e
commit
a1905c3b4b
@ -58,6 +58,8 @@ except ImportError:
|
|||||||
else:
|
else:
|
||||||
vernum = pylorax.version.num
|
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
|
# List of drivers to remove on ppc64 arch to keep initrd < 32MiB
|
||||||
REMOVE_PPC64_DRIVERS = "floppy scsi_debug nouveau radeon cirrus mgag200"
|
REMOVE_PPC64_DRIVERS = "floppy scsi_debug nouveau radeon cirrus mgag200"
|
||||||
REMOVE_PPC64_MODULES = "drm plymouth"
|
REMOVE_PPC64_MODULES = "drm plymouth"
|
||||||
@ -180,7 +182,8 @@ class Lorax(BaseLoraxClass):
|
|||||||
add_template_vars=None,
|
add_template_vars=None,
|
||||||
add_arch_templates=None,
|
add_arch_templates=None,
|
||||||
add_arch_template_vars=None,
|
add_arch_template_vars=None,
|
||||||
verify=True):
|
verify=True,
|
||||||
|
user_dracut_args=None):
|
||||||
|
|
||||||
assert self._configured
|
assert self._configured
|
||||||
|
|
||||||
@ -342,7 +345,13 @@ class Lorax(BaseLoraxClass):
|
|||||||
workdir=self.workdir)
|
workdir=self.workdir)
|
||||||
|
|
||||||
logger.info("rebuilding initramfs images")
|
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"]
|
anaconda_args = dracut_args + ["--add", "anaconda pollcdrom qemu qemu-net"]
|
||||||
|
|
||||||
# ppc64 cannot boot an initrd > 32MiB so remove some drivers
|
# ppc64 cannot boot an initrd > 32MiB so remove some drivers
|
||||||
@ -353,6 +362,8 @@ class Lorax(BaseLoraxClass):
|
|||||||
# upgrade.img
|
# upgrade.img
|
||||||
anaconda_args.extend(["--omit", REMOVE_PPC64_MODULES])
|
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)
|
treebuilder.rebuild_initrds(add_args=anaconda_args)
|
||||||
|
|
||||||
logger.info("populating output tree and building boot images")
|
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)
|
version = "{0}-{1}".format(os.path.basename(sys.argv[0]), vernum)
|
||||||
|
|
||||||
def lorax_parser():
|
def lorax_parser(dracut_default=""):
|
||||||
""" Return the ArgumentParser for lorax"""
|
""" Return the ArgumentParser for lorax"""
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="Create the Anaconda boot.iso")
|
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,
|
optional.add_argument("--noverifyssl", action="store_true", default=False,
|
||||||
help="Do not verify SSL certificates")
|
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
|
# add the show version option
|
||||||
parser.add_argument("-V", help="show program's version number and exit",
|
parser.add_argument("-V", help="show program's version number and exit",
|
||||||
action="version", version=version)
|
action="version", version=version)
|
||||||
|
@ -29,13 +29,13 @@ import tempfile
|
|||||||
# Use the Lorax treebuilder branch for iso creation
|
# Use the Lorax treebuilder branch for iso creation
|
||||||
from pylorax import setup_logging, find_templates, vernum
|
from pylorax import setup_logging, find_templates, vernum
|
||||||
from pylorax.cmdline import lmc_parser
|
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.imgutils import default_image_name
|
||||||
from pylorax.sysutils import joinpaths
|
from pylorax.sysutils import joinpaths
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = lmc_parser()
|
parser = lmc_parser(DRACUT_DEFAULT)
|
||||||
opts = parser.parse_args()
|
opts = parser.parse_args()
|
||||||
|
|
||||||
setup_logging(opts.logfile, log)
|
setup_logging(opts.logfile, log)
|
||||||
|
@ -33,6 +33,7 @@ import dnf
|
|||||||
import dnf.logging
|
import dnf.logging
|
||||||
import librepo
|
import librepo
|
||||||
import pylorax
|
import pylorax
|
||||||
|
from pylorax import DRACUT_DEFAULT
|
||||||
from pylorax.cmdline import lorax_parser
|
from pylorax.cmdline import lorax_parser
|
||||||
import selinux
|
import selinux
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ def setup_logging(opts):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = lorax_parser()
|
parser = lorax_parser(DRACUT_DEFAULT)
|
||||||
opts = parser.parse_args()
|
opts = parser.parse_args()
|
||||||
|
|
||||||
log.info("Lorax v%s", pylorax.vernum)
|
log.info("Lorax v%s", pylorax.vernum)
|
||||||
@ -138,7 +139,8 @@ def main():
|
|||||||
add_template_vars=parsed_add_template_vars,
|
add_template_vars=parsed_add_template_vars,
|
||||||
add_arch_templates=opts.add_arch_templates,
|
add_arch_templates=opts.add_arch_templates,
|
||||||
add_arch_template_vars=parsed_add_arch_template_vars,
|
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,
|
def get_dnf_base_object(installroot, sources, mirrorlists=None, repos=None,
|
||||||
|
Loading…
Reference in New Issue
Block a user