Commit Graph

216 Commits

Author SHA1 Message Date
Brian C. Lane 56926baaec Add the ability to enable DNF plugins for lorax
Pass --dnfplugin='*' to enable all of them.
Pass --dnfplugin='plugin-name' to enable one fo them. You can use it
multiple times to enable multiple plugins. Globs work as well.
2018-06-22 09:07:01 -07:00
Brian C. Lane d8ce013a2b 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
2018-06-06 17:10:35 -07:00
Brian C. Lane c9ca451568 gevent has deprecated .wsgi, should use .pywsgi instead
https://github.com/gevent/gevent/blob/master/doc/api/gevent.wsgi.rst
2018-06-05 14:57:21 -07:00
Brian C. Lane 48e318b391 Add support for systemd socket activation
Instead of enabling lorax-composer.service enable lorax-composer.socket
and it will start lorax-composer on first access to
/run/weldr/api.socket
2018-05-14 13:57:44 -07:00
Brian C. Lane db67c1267a Move lorax-composer and composer-cli argument parsing into modules
This allows sphinx-argparse to document them automatically.
2018-05-14 13:00:15 -07:00
Brian C. Lane 0455a5d740 Add --proxy to lorax-composer cmdline
Overrides the [dnf] proxy setting in the config file.
2018-05-14 13:00:15 -07:00
Brian C. Lane 12cb2736ac Pass the --tmp value into run_creator and cleanup after a crash
Crashing can sometimes leave directories in /var/tmp/lmc-* so clean
those up after run_creator is finished.
2018-05-14 13:00:15 -07:00
Brian C. Lane 3c31e52b3c Add --tmp to lorax-composer and set default tempdir
It was using /tmp/ which can fill up quickly when building images.
Default to /var/tmp unless the user passes --tmp /tmp/
2018-05-14 13:00:15 -07:00
Brian C. Lane 5e0246d4a9 Add selinux check to lorax-composer
anaconda needs to have SELinux set to disabled or permissive in order to
run correctly. Check at startup and exit with an error.
2018-05-14 13:00:15 -07:00
Brian C. Lane 2fa1da0f5e Add lorax-composer and the composer kickstart templates 2018-05-14 13:00:15 -07:00
Brian C. Lane 06c227598c Move core of livemedia-creator into pylorax.creator
This moves everything except the cmdline checking into run_creator in
pylorax.creator

It also rearranges some functions to prevent import loops, and adds a
utility function to imgutils (mkfsimage_from_disk for copying a
partition into a filesystem image).
2018-05-14 13:00:14 -07:00
Brian C. Lane 89050f068d livemedia-creator: Move core functions into pylorax modules
This reduces the amount of code in livemedia-creator to the cmdline
parsing and calling of the installer functions. Moving them into other
modules will allow them to be used by other projects, like the
lorax-composer API server.
2018-05-14 13:00:14 -07:00
Brian C. Lane dc348fac25 Check selinux state before creating output directory
This closes issue #163
2018-04-26 11:12:24 -07:00
Jiri Konecny 2f3de6060b Update default releasever to Fedora 29 (rawhide)
There was Fedora 25 which is now unsupported.
2018-03-15 12:07:34 -07:00
Yuval Turgeman 68d1f4208d LMC: Make the QEMU RNG device optional
Added a new QEMU argument '--with-rng' to specify a RNG device other
than /dev/random or "none".

Signed-off-by: Yuval Turgeman <yturgema@redhat.com>
2018-01-23 08:22:38 -08:00
Brian C. Lane e3dcb1e329 Add version output (#1335456)
Add -V to livemedia-creator, and log the running version when lorax or
lmc is started.
2017-08-14 13:54:02 -07:00
Brian C. Lane cc56a5b5c9 Add --noverifyssl to lorax (#1430483)
Previously lorax had no way to use repos with self-signed certificates.
This adds the --noverifyssl cmdline option which will ignore certificate
errors.

Resolves: rhbz#1430483
2017-03-08 13:27:22 -08:00
Yuval Turgeman 46277f36db Fixed NameError on result_dir when calling with --image-only
Signed-off-by: Brian C. Lane <bcl@redhat.com>
2017-01-13 13:38:33 -08:00
Pat Riehecky 7ca356845b Added option to remove packages (parallel to installpkgs) 2016-11-14 09:06:10 -08:00
Igor Gnatenko ef5475e552 adapt to DNF 2.0 API changes
References: https://bugzilla.redhat.com/show_bug.cgi?id=1380566
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-09-30 09:09:41 -07:00
Brian C. Lane 37d36daa9c lorax: Add --rootfs-size (#1368743)
This controls how big the root filesystem is for the squashfs used in
the boot.iso, the default is 2GiB.

Note that larger rootfs sizes will require more memory and may cause the
build to fail.
2016-08-22 17:20:48 -07:00
Friedrich Schöller c60338464b Allow supplying a disk image for PXE live systems
Fixes that the combination of command line arguments
"--make-ostree-live" and "--disk-image" lead to a program error.
2016-08-12 13:12:54 -07:00
Brian C. Lane 748259619b Make sure cmdline config file exists (#1348304)
If the --config file doesn't exist lorax will fall back to its defaults,
which are probably not what you want. Now it will exit if it doesn't
exist.
2016-06-20 16:13:45 -07:00
Brian C. Lane 5ef7c093b1 Stop using undocumented DNF logging API
DNF doesn't want users to access base.logging anymore.

Lorax already takes over the "dnf" logger and directs it to ./dnf.log,
so it wasn't really being used.

This raises the debug level to DNF's custom DDEBUG, and sets it up so
that dnf.librepo.log and hawkey.log are next to dnf.log
2016-06-03 16:44:30 -07:00
Brian C. Lane 3485fe462c livemedia-creator: Always copy novirt logs before cleanup
Before attempting to cleanup any dangling anaconda mounts copy the
anaconda logs to their final location.

Also, catch failures to cleanup the mounts, log it, and continue trying
the other mountpoints. A cleanup failure will result in an InstallError
instead of a CalledProcessError.
2016-06-01 11:48:41 -07:00
Brian C. Lane 551b27a8fa Update lmc UEFI support to use the edk2-ovmf package
Fedora now has a edk2 package so use the OVMF code from there. This also
adds using a copy of OVMF_VARS for each boot instead of reusing the one
provided by the package.
2016-05-17 16:44:22 -07:00
Brian C. Lane 2f66212c0f livemedia-creator: Update make-pxe-live to support missing initramfs
In some cases the initramfs may not be present in /boot to save space.
Use it if present, otherwise use the kernel version to recreate the name
of it.

This also fixes problems with dracut running out of space when not using
--live-rootfs-keep-size
2016-05-05 08:22:59 -07:00
Brian C. Lane 9b151ec2bd Update ostree boot handling
This makes sure the contents of /boot are at the expected locations in
/boot and in sys_root. For partitioned images it mounts the separate
/boot partition on /boot. For both fsimage and partitioned images ir
binf mounts it to sys_root so that the kernel+initrd can be found.

The boot directory isn't always named boot.0, so wildcard it and let the
count check handle failure if there is more than 1.
2016-04-29 16:09:03 -07:00
Brian C. Lane 6ed2aaed69 Refactor PXE live creation code
This moves the mounting inside make_live_images so that it isn't trying
to copy the fsimage while having it mounted.
2016-04-29 16:08:57 -07:00
Brian C. Lane efb0cce9b8 Change --make-pxe-live --no-virt use a fsimage
Instead of a partitioned disk image. This will allow a single pass
of lmc to be used to create an ostree live PXE image.
2016-04-29 16:08:54 -07:00
Brian C. Lane b72b41e690 Allow ostreesetup kickstart
Also make sure that a --make_pxe_live --no-virt doesn't use autopart or
other mountpoints.
2016-04-29 16:08:50 -07:00
Brian C. Lane 607d7c1eeb livemedia-creator: Make sure make-iso kickstart includes dracut-live
iso creation requires the dracut-live package, otherwise rebuilding the
initrd will crash. Since it takes a long time to discover let's fail
early.
2016-04-06 17:10:58 -07:00
Brian C. Lane bae111d5a3 livemedia-creator: Simplify cleanup for no-virt
If an anaconda no-virt run crashes it can leave things mounted under
/mnt/sysimage. Previously anaconda-cleanup was used to handle this, but
it will also try to cleanup host mountpoints which isn't desired.
2016-04-06 17:04:42 -07:00
Brian C. Lane f753a064b8 livemedia-creator: Use correct suffix on default image names (#1318958)
When an image name hasn't been passed, and the compression type is
something other than xz, the default image name should use the user
specified compression suffix.

Resolves: rhbz#1318958
2016-03-29 09:56:32 -07:00
Brian C. Lane 3740df3756 livemedia-creator: Pass -Xbcj to mksquashfs
Some cases of mksquashfs were not using -Xbcj when it is available for
the arch. This adds a function to return the correct args based on the
arch and the cmdline args.
2016-03-29 09:48:33 -07:00
Brian C. Lane b91e79d9bc livemedia-creator: Check selinux state and exit
lmc --no-virt was switching selinux to permissive if it was enforcing
and restore it when done. This works fine when it is the only session
running, but would cause problems if it was run in parallel.

It now only checks the state and exits with an error if it isn't already
disabled or in Permissive mode.

Users will need to run setenforce 0 before running lmc.
2016-03-28 16:40:16 -07:00
Brian C. Lane 0b9077ceaa Move argument parsers into pylorax.cmdline
This will make it possible to use sphinx-argparse to generate all the
documentation and manual pages.
2016-03-21 14:21:55 -07:00
Brian C. Lane 6798f7c5ec livemedia-creator: Fix off by 1024 error
commit 4699c88109 changed how the disk
size is estimated and not all users took into account that the return
value is in MiB.

This would result in qemu based iso installations having a rootfs.img
that was 1024x too large.
2016-03-21 12:14:28 -07:00
Brian C. Lane 3e9efdcf48 livemedia-creator: Change fsck.ext4 discard failures to errors
Something is causing problems with the ext4 rootfs.img when running with
no-virt inside koji. This results in a failed image that looks good
until you try to boot it.

make_squashfs will now return False if it fails, and make_live_image
will return None (instead of the result path). lmc will exit with a 1
and log an error.
2016-03-09 16:41:11 -08:00
Brian C. Lane 4699c88109 livemedia-creator: Create runtime using kickstart partition size
When using no-virt the runtime filesystem size comes from the kickstart.
For virt installs lmc was creating a runtime filesystem that was just
slightly larger than the space used by the files installed by anaconda.
This can run into problems with larger filesystem. It is also
inconsistent behavior between virt and no-virt installations.

With this commit the virt runtime filesystem will also come from the
kickstart.
2016-03-09 16:41:11 -08:00
Brian C. Lane a72e9aed0c livemedia-creator: Bump default releasever to 25 2016-03-04 08:57:55 -08:00
Brian C. Lane f8316a7b89 livemedia-creator: Use qemu instead of virt-install
Switching to using qemu directly allows lmc to be more flexible. It can
now run from inside a mock chroot for creation of all image types,
inculding disk images, and can take advantage of KVM on the host system
if /dev/kvm device is present inside the mock.

It should also be possible to create cross-arch images, but without kvm
available this is likely to be a very slow option.
2016-03-03 17:22:50 -08:00
Brian C. Lane 7c0a6dffd6 livemedia-creator: Stop passing --repo to anaconda (#1304802)
When running a no-virt installation it was parsing the kickstart url
method and passing it to anaconda using --repo which prevents it from
working with url --mirrorlist method. There is no good reason to do
this, anaconda gets the method directly from the kickstart when it isn't
on the cmdline.
2016-02-12 10:22:52 -08:00
Brian C. Lane c15349c3da livemedia-creator: Add /usr/share/lorax/templates.d/ support 2016-02-11 10:54:54 -08:00
Brian C. Lane 87d941b81a livemedia-creator: Add kernel-modules and kernel-modules-extra to examples
If you don't do this DNF will add the debug kernel to the package set to
satisfy kmod() requirements.

Also bump the default releasever for lmc to 24.
2016-01-13 14:31:40 -08:00
Brian C. Lane ba4218ea98 livemedia-creator: Make sure the rootfs.img can be compressed
Use 4k blocks for the ext4 filesystem. Run fsck on the filesystem to
make sure deleted blocks are actually zeroed, and pass -Xbcj to
mksquashfs.

4k blocks and -Xbcj decreases the size by 2-6% depending on the
filesystem size. Zeroing the blocks of the ext4 fs improves things
dramatically. The problem is that DNF downloads the rpms before
installing them. In addition to forcing us to use a larger filesystem
than we would like it leaves data that is difficult to compress on the
image. The downloaded files are removed, but need to be zeroed out so
that mksquashfs can compress it.
2016-01-13 08:09:01 -08:00
Brian C. Lane b138b27bd8 Add --iso-name to use with --iso-only
Instead of reusing --image-name add a new argument to name the iso. This
way the disk image can be given a unique name with --image-name and the
iso can be named something different.
2016-01-11 09:54:40 -08:00
Brian C. Lane a39ed39313 Prefix temporary files and directories with lmc-
This makes it easier to spot things leftover from a crash.
2016-01-08 08:53:55 -08:00
Brian C. Lane 059e40a64b Add --iso-only option to --make-iso
This option removes all the extra build artifacts from --make-iso,
leaving only the boot.iso

It also supports naming of the final iso with --image-name
2016-01-08 08:53:55 -08:00
Scott K Logan 33d008d9f2 livemedia-creator: Fix calculation of disk_size in some cases
If the kickstart includes multiple definitions for the same mount point,
the last one defined is used. The current code includes all of them in
size calculation, and the image file that livemedia-creator makes is big
enough to hold all of the partitions, even though the duplicates are
ignored by Anaconda.
2015-12-22 12:44:30 -08:00