Commit Graph

645 Commits

Author SHA1 Message Date
Brian C. Lane
d282f1fa8c Reduce the size of macboot.img (#952747)
The size estimate was counting the /EFI/BOOT/ contents twice and then
doubling that. Only count things once, then double it for the
System/Library/CoreServices/ copy.

hard-links don't work. With CoreServices hardlinked to /EFI/BOOT/ the
Mac won't boot. With /EFI/BOOT/ hardlinked to CoreServices grub2 cannot
read the config file so there are 2 real copies.

This reduces the image size from 21M to about 12M
2015-10-02 13:34:12 -07:00
David Shea
21b7654659 Look for crashes from the anaconda signal handler. 2015-09-24 16:53:02 -04:00
Brian C. Lane
1c928080f2 Do not install weak deps in boot.iso 2015-09-11 14:04:34 -07:00
Brian C. Lane
b3bf61bfdd Drop multiprocessing for do_transaction (#1208296)
When running the transaction in a separate process it crashes if you use
a https repo source. There's really no need for threads or processes in
lorax so drop it.

Also switched to using the DNF TransactionProgress API for progress
reporting.
2015-09-09 15:58:57 -07:00
Brian C. Lane
bf255a41a5 Don't include early microcode in initramfs (#1258498)
The system the image boots on will likely not match the host where lorax
was run, and in some cases this can cause systems to hang.

Resolves: rhbz#1258498
2015-09-01 09:51:47 -07:00
Will Woods
a3e1a275ff don't build upgrade.img anymore
fedup is deprecated and abandoned. Let's save time and disk by not
building `upgrade.img` when nothing is going to use it anymore.

For the record, performing upgrades using an initramfs from the new
system turns out to be fragile and hard to support:

* dracut initramfs isn't generic enough to handle booting all systems
  (e.g. missing vconsole.conf means you get keymaps wrong, so users
  can't unlock encrypted disks)

* The ABI differences between the two versions of plymouth, systemd,
  etc. requires nasty workarounds at best and causes nightmarish
  systemd crashes at worst

This patch removes all the code that built and installed `upgrade.img`.

For backwards compatibility, the API retains the `doupgrade` keyword
argument, and the `--noupgrade` flag is still accepted.
2015-08-31 16:24:39 -07:00
Brian C. Lane
394d37fbb5 livemedia-creator: no-virt fsimage should only use / size from ks
The amount of free space for / should be consistent between installation
types, otherwise some may have enough space, and others won't.
2015-08-28 11:37:05 -07:00
Brian C. Lane
522ec34360 Return the output from failed commands in CalledProcessError
Some callers expect CalledProcessError.output to have the output, so
pass up the stdout + stderr output.

This means failed runcmd template commands will log to program.log and
lorax.log
2015-08-04 10:50:37 -07:00
Brian C. Lane
9f702f5624 Use execReadlines in livemedia-creator
Log output from anaconda as it is received so that progress can be
monitored.
2015-07-30 09:05:31 -07:00
Brian C. Lane
cfe4777042 Add execReadlines to executils.
Returns output in realtime instead of buffering it.
2015-07-30 09:02:48 -07:00
Brian C. Lane
11b8eb8b97 Add reset_lang argument to everything in executils.
Running anaconda from lmc needs to override the language reset,
otherwise libuser crashes because it cannot support "C".
2015-07-27 11:27:43 -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
8a8b4e1a45 Add a bit more overhead to the root filesystem size
When this is too small the rootfs can run into problems when used with a
live system. Doubling it leaves enough space for the system to run
properly during the installation and since it's all compresses it
doesn't make the image noticeably bigger.
2015-07-01 08:32:33 -07:00
Chris Lumens
c3743c54bc Pass setup_logging the log file, not the whole opts structure. 2015-06-03 08:55:34 -04:00
Chris Lumens
ffa25dd609 Move IsoMountpoint into its own module. 2015-06-01 14:27:32 -04:00
Chris Lumens
d23605d3cc Move setup_logging into pylorax/__init__.py. 2015-06-01 14:27:29 -04:00
Chris Lumens
893791cf7d Break all the log monitoring stuff from LMC out into its own module. 2015-05-29 13:53:07 -04:00
Brian C. Lane
7cd329a065 Fix bug with product DataHolder overwriting product string. 2015-05-18 08:24:23 -07:00
Brian C. Lane
3560d12608 Update execWith* docstrings 2015-05-15 17:11:21 -07:00
Brian C. Lane
1305d4d0f9 livemedia-creator: Catch missing package errors 2015-05-15 17:11:20 -07:00
Brian C. Lane
1a92b1b05e Convert to using pocketlint for pylint rules
Also cleanup some warnings.
2015-05-15 17:11:20 -07:00
Brian C. Lane
80f66d438d Convert livemedia-creator to py3 2015-05-15 17:11:20 -07:00
Brian C. Lane
cb7dadb35f Update image-minimizer for py3
Also switch to using argparse instead of optparse.
2015-05-15 17:11:20 -07:00
Brian C. Lane
ca0bb2681e Change mkefiboot to py3
Just a couple prints.
2015-05-15 17:11:20 -07: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
2f927118a7 Update lorax for python3 and argparse 2015-05-15 17:11:20 -07:00
Brian C. Lane
e1a05d962c Use the execWith* methods from Anaconda
The previous ones were a bit of a kludge, the Anaconda ones have had a
lot of work put into them so let's just use them with slight modifications.
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
Brian C. Lane
a6e469e0e6 Clean up some pylint warnings
Mostly logging, using .format() on the strings.
2015-05-15 17:11:20 -07:00
Brian C. Lane
80ed5006d4 Add some more details about template rendering errors 2015-04-10 11:01:59 -07:00
Vratislav Podzimek
d2c64b1b26 Check that the transaction process is still alive
If it terminates really badly (e.g. with SIGSEGV), it doesn't report any error,
just doesn't put anything to the queue. So instead of just blindly waiting on
the queue forever, check that the process is still alive if we don't get any
message in long time interval.
2015-03-25 16:59:02 +01:00
Brian C. Lane
3148a2b215 livemedia-creator: Clean up resultdir handling 2015-03-24 14:21:18 -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
7404a28c6f livemedia-creator: Fix up fake yum object for DNF change
pylorax unconditionally calls reset() on the dbo, so provide an empty
method to keep it happy.

The lmc dbo is minimal because it is only used for creating the iso, not
anything related to package installation.
2015-03-09 09:15:31 -07:00
Brian C. Lane
c0ac3ad3bb Update logic for stage2 detection on boot.iso
The stage2 image can be either LiveOS/squashfs.img or it can be
images/install.img, adjust the IsoMountpoint for this and rename the
flag to .stage2 instead of .liveos
2015-03-09 08:32:57 -07:00
Brian C. Lane
11c9e0e8ee Add removekmod template command
removekmod GLOB [GLOB...] --allbut KEEPGLOB [KEEPGLOB...]

This can be used to remove kernel modules from under
/lib/modules/*/kernel/ while keeping specific items. This should be
easier than constructing find arguments to select the right things to
save.
2015-03-06 11:26:14 -08:00
Brian C. Lane
62de8c26f8 Skip using srpm repos
DNF has a bug (#1191289) when the SRPM repo isn't the first one used,
and we don't need them for lorax anyway.
2015-02-16 08:47:31 -08:00
Brian C. Lane
13de711548 Drop the dnf Base object deletion code and use reset
It appears that reset+fill_sack will now do the right thing and load the
state of the installed packages. Drop the hack with deleting the object.

Also add a double-check to make sure there really is a list of files
for anaconda-core before we run off and make an image without removing
anything.
2015-02-16 08:47:30 -08:00
Brian C. Lane
9ff5897eee Get the log directory from the configfile
In the lorax script create it if missing and override it with the
path of --logfile
2015-02-16 08:47:30 -08:00
Brian C. Lane
fe457ed71b lorax: Add --cachedir, --force and --workdir cmdline options
--cachedir allows the user to specify where the DNF cache is located.
This doesn't actually appear to do much since dnf erases the cache when
it is done. May be useful in the future.

--workdir sets the top level directory for lorax to use for installing
packages, creating installtree and installroot. Normally a temporary
directory under /var/tmp.

Note that the workdir will *not* be removed if there is an error setting
up the DNF object.

--force skips checking if the output directory exists, allowing things
like pungi to use lorax to place the output next to the repo tree it has
already created.
2015-02-16 08:47:30 -08:00
Brian C. Lane
1ec35938b3 Cleanup help alignment 2015-02-16 08:47:30 -08: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
Brian C. Lane
3f77b80d6c Use /usr/bin/python2 in scripts
New packaging guidelines:

https://fedoraproject.org/wiki/Packaging:Python#Multiple_Python_Runtimes
https://fedorahosted.org/fpc/ticket/327#comment:9
2015-02-09 08:48:22 -08:00
Brian C. Lane
30c21a1b97 livemedia-creator: Add --timeout option to cancel install after X minutes
Installations sometimes get stuck. This adds the option to cancel it
after some number of minutes have passed.
2015-02-02 12:44:32 -08:00
Brian C. Lane
c231c2a63f livemedia-creator: Bump default releasever to 22 2015-01-20 10:59:18 -08:00
Radek Vykydal
5aa6bb5f0c Add --live-rootfs-keep-size option 2015-01-16 10:01:41 +01:00
Radek Vykydal
d16bdcaf6d Add --live-rootfs-size option. 2015-01-16 10:01:41 +01:00
Brian C. Lane
879d831ffc livemedia-creator: Turn on debug output for dracut
Some dracut failures are hard to detect without debug enabled, so just
turn it on all the time.
2015-01-15 09:39:15 -08:00
Brian C. Lane
563f4386e8 livemedia-creator: Copy all the logs from /tmp/
It wasn't copying new logs from dnf, kickstart script logs or
tracebacks.
2015-01-15 09:39:15 -08:00