lorax: Add --skip-branding cmdline argument

Also document how branding currently works. See docs/lorax.rst

Resolves: rhbz#1826479
This commit is contained in:
Brian C. Lane 2020-04-21 15:31:00 -07:00
parent 1b636636c6
commit db8f198304
5 changed files with 43 additions and 4 deletions

View File

@ -54,6 +54,29 @@ Under ``./results/`` will be the release tree files: .discinfo, .treeinfo, every
goes onto the boot.iso, the pxeboot directory, and the boot.iso under ``./images/``.
Branding
--------
By default lorax will search for the first package that provides ``system-release``
that doesn't start with ``generic-`` and will install it. It then selects a
corresponding logo package by using the first part of the system-release package and
appending ``-logos`` to it. eg. fedora-release and fedora-logos.
Custom Branding
~~~~~~~~~~~~~~~
If ``--skip-branding`` is passed to lorax it will skip selecting the
``system-release``, and logos packages and leave it up to the user to pass any
branding related packages to lorax using ``--installpkgs``. When using
``skip-branding`` you must make sure that you provide all of the expected files,
otherwise Anaconda may not work as expected. See the contents of ``fedora-release``
and ``fedora-logos`` for examples of what to include.
Note that this does not prevent something else in the dependency tree from
causing these packages to be included. Using ``--excludepkgs`` may help if they
are unexpectedly included.
Running inside of mock
----------------------

View File

@ -186,7 +186,8 @@ class Lorax(BaseLoraxClass):
add_arch_templates=None,
add_arch_template_vars=None,
verify=True,
user_dracut_args=None):
user_dracut_args=None,
skip_branding=False):
assert self._configured
@ -266,7 +267,8 @@ class Lorax(BaseLoraxClass):
installpkgs=installpkgs,
excludepkgs=excludepkgs,
add_templates=add_templates,
add_template_vars=add_template_vars)
add_template_vars=add_template_vars,
skip_branding=skip_branding)
logger.info("installing runtime packages")
rb.install()

View File

@ -107,6 +107,8 @@ def lorax_parser(dracut_default=""):
help="Size of root filesystem in GiB. Defaults to 3.")
optional.add_argument("--noverifyssl", action="store_true", default=False,
help="Do not verify SSL certificates")
optional.add_argument("--skip-branding", action="store_true", default=False,
help="Disable automatic branding package selection. Use --installpkgs to add custom branding.")
# dracut arguments
dracut_group = parser.add_argument_group("dracut arguments")

View File

@ -72,7 +72,8 @@ class RuntimeBuilder(object):
def __init__(self, product, arch, dbo, templatedir=None,
installpkgs=None, excludepkgs=None,
add_templates=None,
add_template_vars=None):
add_template_vars=None,
skip_branding=False):
root = dbo.conf.installroot
# use a copy of product so we can modify it locally
product = product.copy()
@ -88,8 +89,18 @@ class RuntimeBuilder(object):
self._excludepkgs = excludepkgs or []
self._runner.defaults = self.vars
self.dbo.reset()
self._skip_branding = skip_branding
def _install_branding(self):
"""Select the branding from the available 'system-release' packages
The *best* way to control this is to have a single package in the repo provide 'system-release'
When there are more than 1 package it will:
- Make a list of the available packages
- If there are one or more non-generic packages, use the first one after sorting
"""
if self._skip_branding:
return
release = None
q = self.dbo.sack.query()
a = q.available()

View File

@ -192,7 +192,8 @@ def main():
add_arch_templates=opts.add_arch_templates,
add_arch_template_vars=parsed_add_arch_template_vars,
remove_temp=True, verify=opts.verify,
user_dracut_args=opts.dracut_args)
user_dracut_args=opts.dracut_args,
skip_branding=opts.skip_branding)
# Release the lock on the tempdir
os.close(dir_fd)