Commit Graph

138 Commits

Author SHA1 Message Date
Brian C. Lane 0485ef22f2 Add a context manager for dracut
dracut needs a reasonable chroot environment in order to run correctly.
This adds the DracutChroot context manager that sets up and tears down
mounts inside the root directory tree.

Switch to using it in creator.rebuild_initrds_for_live() and
TreeBuilder.rebuild_initrds()

(cherry picked from commit 322a810403)

Resolves: rhbz#1982271
2021-07-14 11:40:00 -07:00
Brian C. Lane 980e628835 treebuilder: Add branding package to template variables
The branding package name doesn't always match the product name.  This
saves the branding package names as discovered in the enabled repos and
exposes it to the templates as branding.release and branding.logos --
which could potentially be None so the template needs to take that into
account.

Related: rhbz#1956205
2021-05-05 11:19:09 -07:00
Brian C. Lane be2c9333fc Add log entry about dracut and /proc 2020-07-17 09:38:13 -07:00
Brian C. Lane 68c26bf87b Skip creating empty /proc/modules for dracut
Creating /proc/modules just quiets one dracut warning, it doesn't
actually effect the initrd that is created.

Now that mock is being run with netsharedpath set to exclude /proc is
causes problems for running lorax inside a mock, so just remove this to
prevent a crash when it doesn't exist.

Related: rhbz#1848201
2020-07-17 09:38:13 -07:00
Brian C. Lane f83ae2fed3 mksquashfs: Catch errors with mksquashfs and report them
The host system can run out of space while running mksquashfs, and while
this is logged to program.log it isn't detected by lorax or
livemedia-creator so it will continue running, possibly reporting
unrelated errors and causing confusion.

This adds checks for the return status when calling mksquashfs, logs it
to the log, and either exits or raises an error immediately.
2020-05-07 14:35:55 -07:00
Brian C. Lane c9c1283c56 lorax: Add --skip-branding cmdline argument
Also document how branding currently works. See docs/lorax.rst

Resolves: rhbz#1826479
2020-04-21 15:57:54 -07:00
Brian C. Lane 91d71b09a4 lorax: Update how the release package is chosen
Previously the release package was chosen by picking the first package
that provides 'system-release' that isn't named generic. This can cause
branding issues with repos containing multiple system-release packages.

This patch changes _install_branding so that it will give preference to
a system-release package that ends with lowercase --variant name. If
there isn't one it will fall back to the previous behavior.

Resolves: rhbz#1472622
2020-03-20 08:28:11 -07:00
Brian C. Lane fe45fa3610 lorax: Catch rootfs out of space failures
It isn't always obvious what happened when the rootfs runs out of space,
especially when using lorax via pungi. So this checks for the out of
space error string when building the runtime image and logs it to the
primary logfile and console as an error with the rootfs size.

eg.
2020-01-20 18:52:58,920: The rootfs ran out of space with size=1
2020-02-05 15:27:41 -08:00
Brian C. Lane 235813212f Add extra boot args to the livemedia-creator iso templates
This adds a new livemedia-creator argument, --extra-boot-args, which can
be used to add arguments to the kernel command-line in the templates.
2019-03-26 11:06:57 -07:00
Dan Horák a477db33d6 drop big endian ppc/ppc64 support 2019-01-07 13:52:46 -08:00
Dan Horák d34acfc14c don't reduce initrd size on ppc64/ppc64le 2019-01-07 13:52:46 -08:00
Marek Marczykowski-Górecki 27e611629f Add --squashfs-only option to drop inner rootfs.img layer
Make runtime directly into squashfs image. This reduces largely
unreproducible ext4 layer, but requires anaconda's dracut module
modification to properly mount the image.
2018-10-29 13:16:38 -07:00
Brian C. Lane 07acd2e780 lorax: Only run depmod on the installed kernels
In the near-future there may be /lib/modules/ directories for older
kernels with weak dependencies listed. These may not match the installed
kernel(s) so we cannot depend on them to drive generate_module_data.

Instead use the existing findkernels() function to get the list of
installed kernels and iterate those, running depmod on them.

Resolves: rhbz#1622213
2018-08-28 16:56:50 -07:00
Brian C. Lane e1c839de1c Fix _install_branding
filter(provides=...) doesn't work with paths. The release packages
provide system-release so just look for that instead of a file.

Now it finds the release package and selects it along with the
corresponding logos package.

Note, this has been broken since commit 431ca6ce
2018-02-23 12:50:07 -08:00
Pat Riehecky 7ca356845b Added option to remove packages (parallel to installpkgs) 2016-11-14 09:06:10 -08:00
Brian C. Lane 50b15d72b5 Rebuild initramfs if it is missing
There's no reason to require the initramfs when we can rebuild it using
the version from the kernel. This adds handling of missing initramfs so
that lmc kickstarts can remove it from the squashfs, saving about 40M on
the iso.
2016-05-05 08:22:52 -07:00
David Shea 04d170bb09 Add a verification step to Lorax.run.
After the cleanup step, check that everything in /usr/bin and /usr/sbin
can still run. Currently, this just checks that ELF files have
everything they need to link, and scripts have an interpreter.

Verifying is on by default but can be skipped with --noverify
2015-07-20 16:18:20 -04:00
Brian C. Lane eb22c69f29 Additional python3 changes
Add a 'lower' filter to the templates to replace string.lower which no
longer exists. Fix udev_escape, the strings are already unicode, and
drop --chdir from runcmd. It wasn't ever used, and passing cwd to the
new runcmd isn't supported.
2015-05-15 17:11:20 -07:00
Brian C. Lane de0e662f51 Convert pylorax to python3
Fix up 2to3 complaints. I've decided to do with wrapping list
comprehension inside list() to get the generators to run in several
places instead of list(map( or list(filter( which seem less readable to
me.
2015-05-15 17:11:20 -07:00
Colin Walters 67217f5642 Add ability for external templates to graft content into boot.iso
I originally added --add-template to support doing something similar
to pungi, which injects content into the system to be used by default.
However, this causes the content to be part of the squashfs, which
means PXE installations have to download significantly more data that
they may not need (if they actually want to pull the tree data from
the network, which is not an unusual case).

What I actually need is to be able to modify *both* the runtime image
and the arch-specific content.  For the runtime, I need to change
/usr/share/anaconda/interactive-defaults.ks to point to the new
content.  (Although, potentially we could patch Anaconda itself to
auto-detect an ostree repository configured in disk image, similar to
what it does for yum repositories)

For the arch-specfic image, I want to drop my content into the ISO
root.

So this patch adds --add-arch-template and --add-arch-template-var
in order to do the latter, while preserving the --add-template
to affect the runtime image.

Further, the templates will automatically graft in a directory named
"iso-graft/" from the working directory (if it exists).

(I suggest that external templates create a subdirectory named
 "content" to avoid clashes with any future lorax work)

Thus, this will be used by the Atomic Host lorax templates to inject
content/repo, but could be used by e.g. pungi to add content/rpms as
well.

I tried to avoid code deduplication by creating a new template for the
product.img bits and this, but that broke because the parent boot.iso
code needs access to the `${imggraft}` variable.  I think a real fix
here would involve turning the product.img, content/, *and* boot.iso
into a new template.
2015-03-19 16:48:16 -04:00
Brian C. Lane 345cc89ee0 dnf: remove files from installed packages
This is a workaround for a current dnf bug, it doesn't update the state
of the packages after they are installed so we tear down the base dnf
object and create a new one pointing to the installroot.

There is an additional issue with the list of files returned, hawkey and
dnf don't appear to make a distinction between files, dirs and ghosted
dirs like yum did, this can result in too much being removed (eg. all of
/etc/selinux/) so we only remove files not directories.
2015-02-16 08:47:30 -08:00
Brian C. Lane 431ca6cea4 Switch lorax to use dnf instead of yum
pylorax users will need to change to using dnf and pass a dnf.Base()
object as the dbo argument instead of a yum object as the yum or ybo
argument. See the lorax script for an example of how to do this.

The lorax cmdline argument --excludepkgs has been removed since dnf
doesn't appear to have any way to support it and packages should be
controlled using templates anyway.
2015-02-16 08:47:30 -08:00
Radek Vykydal a19c509430 Add --make-pxe-live and --make-ostree-live (for Atomic) targets.
--make-pxe-live target generate live squashfs and initrd for pxe boot.
Also generates pxe config template.

--make-ostree-live is used for installations of Atomic Host. Additionally to
--make-pxe-live it ensures using deployment root instead of physical root of
installed disk image where needed. Atomic installation needs to be virt
installation with /boot on separate partition (the only way supported by
Anaconda currently). Content of boot partition is added to live root fs so that
ostree can find deployment by boot configuration.
2015-01-13 12:45:06 +01:00
Colin Walters 52d962d613 Add --includepkg argument
Recently, Fedora has been trying to do a 3 product split.  As part of
that, lorax was changed to do "installpkg lorax-product-*" via
provides.

I think that approach is awkward; a much simpler approach is to simply
specify the product package as input to lorax on the command line, via
external rel-eng scripts.

This patch therefore adds --includepkg (and we should probably add an
option to remove the implicit lorax-product-* glob).
2014-12-05 15:58:58 -08:00
Brian C. Lane 364ce363f7 Add ppc64le arch (#1136490)
basearch is ppc64le so we needs to check for that in addition to ppc64.

Resolves:rhbz#1136490
2014-09-03 10:41:42 -07:00
Colin Walters 66359415be Add --add-template{,-var}
What I need is to make something like the traditional DVD which also
includes packages.  At present this is apparently handled by the
entirely separate pungi tool.

At the moment for me, it's the least bad option to modify lorax to
inject data from an external source than to create a new tool, or
attempt to also modify pungi to do this.

This would also allow pungi's DVD creation to eventually be a set of
external templates for Lorax.
2014-05-12 16:04:28 -07:00
Brian C. Lane d25c0b0594 Update copyright statements 2014-05-09 15:13:39 -07:00
Brian C. Lane 6d47689a33 Cleanup pylorax pylint warnings 2014-05-09 08:10:41 -07:00
Mark Hamzy cc2f98bfc5 support ppc64le in lorax
Add support for the ppc64le architecture in lorax.

Signed-off-by: Brian C. Lane <bcl@redhat.com>
2014-03-27 10:06:41 -07:00
Brian C. Lane d89f01af21 Check initrd size on ppc64 and warn (#1060691)
ppc64 initrd cannot be larger than 32MiB, so log a warning if it is too
large.

Related: rhbz#1060691
2014-02-13 13:20:16 -08:00
d.marlin f0d1c76ea4 Add initial 64-bit ARM (aarch64) support (#1034432)
Signed-off-by: Brian C. Lane <bcl@redhat.com>

Resolves: rhbz#1034432
2013-12-17 10:07:32 -08:00
Dennis Gilmore 8d84e9d25a ARM: Don't install or deal with in templates, no longer existing kernels
remove no longer used kernel variants from templates
dont try to install no longer existing kernel-tegra variant
2013-10-16 18:06:20 -05:00
Dennis Gilmore 7d3fafedf3 kernel changed seperator for flavours from . to + update regular expression 2013-10-16 18:05:56 -05:00
Brian C. Lane abf27add37 Bump image size up to 2G (#967556) 2013-05-28 16:29:48 -07:00
Dennis Gilmore d751ac82db remove no longer supported arm kernel variants add the new lpae one 2013-04-17 16:21:23 -07:00
Will Woods ad3d1e6278 treebuilder: fix "Can't stat exclude path "/selinux"..." message
/selinux has been gone for *years*. Drop the exclude.
2013-03-19 00:47:58 -04:00
Brian C. Lane 93c4a8b830 Raise an error when there are no initrds 2013-03-12 15:39:25 -07:00
Dennis Gilmore a4cf3c3c7c remove sparc support
Signed-off-by: Dennis Gilmore <dennis@ausil.us>
2013-03-04 14:18:45 +01:00
Martin Gracik a0791d3074 Only run installupgradeinitrd if upgrade 2012-12-18 14:31:45 +01:00
Will Woods 1c91eab12b treebuilder: improve findkernels() initrd search
This makes findkernels() look for any image named something like:

  $PREFIX-$KERNELVER.img

and adds a corresponding entry to its returned data like:

  kernel.$PREFIX.path = [path]

As a special backwards-compatibility case we use 'initrd' for the
attribute name if $PREFIX is 'initramfs'.

This gives us any extra initramfs images that may have been built using
the 'prefix' argument to rebuild_initrds().
2012-11-30 13:28:38 -06:00
Will Woods 5b48574d5e treebuilder: add 'prefix' to rebuild_initrds()
If 'prefix' is passed to rebuild_initrds(), it will build a *new*
initramfs with a name like $PREFIX-$KERNELVER.img, rather than
overwriting the existing initramfs.
2012-11-30 13:28:38 -06:00
Brian C. Lane 2b8075af3a use /var/tmp instead of /tmp
Also add a --tmp option so users can specify a top level tmp dir.
2012-10-02 11:35:16 -07:00
Martin Gracik fb69670ea8 There's no lang-table in anaconda anymore (#857925) 2012-09-17 11:41:39 -07:00
Brian C. Lane 43bd549480 add convienience functions for running commands
Adds runcmd() and runcmd_output() which set raise_err=True
2012-09-17 11:26:53 -07:00
Brian C. Lane 12ad7d0d99 restore CalledProcessError handling
When I switched execution over to execWith* functions I failed to
account for the use of CalledProcessError in various places. This
patch restores that behavior. All places that used check_call or
check_output now pass raise_err=True to the execWith* call.
2012-09-17 11:26:50 -07:00
Brian C. Lane 134eec24d5 clean up command execution
Switch to using execWith* so that the command and its output can be
logged. To capture the output setup a logger named "program"

livemedia-creator captures all of this into program.log
2012-07-30 09:22:10 -07:00
d.marlin f170b6dc49 Add 'mvebu' to list of recognized ARM kernels.
Signed-off-by: David A. Marlin <dmarlin@redhat.com>
2012-07-25 12:43:23 +02:00
Will Woods 8e71bb045a don't use --prefix with dracut anymore
systemd in F18 doesn't work with --prefix anymore, so drop it.

(patch from haraldh - thanks Harald!)
2012-07-06 00:19:48 -04:00
Martin Gracik 30cb18a9ec Add initial support for ARM based systems (dmarlin) 2012-06-21 09:33:53 +02:00
Martin Gracik 910c54e394 Install proper branding packages from repo (#813969)
The product string is not the best source for package names.
2012-05-25 08:48:14 +02:00