Commit Graph

46 Commits

Author SHA1 Message Date
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 b064ae6166 Add installimg command for use in the templates
installimg SRCDIR DESTFILE
  Create a compressed cpio archive of the contents of SRCDIR and place
  it in DESTFILE.

  If SRCDIR doesn't exist or is empty nothing is created.

Examples:
  installimg ${LORAXDIR}/product/ images/product.img
2014-11-05 09:58:51 -08: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
Brian C. Lane 9e15705bb9 Clean up download and install output
Commit d2ae92b4b3 patched up the download counter and progress
display. Yum no longer provides the needed information so now we get the
total number of packages from the start of the transaction.

This also turns off colors when stdout is not a tty, and only prints the
install progress once so that piping to a logfile isn't flooded with
useless characters.
2014-04-25 06:55:56 -07:00
Martin Gracik 62920272c7 Fix rexists 2012-12-19 12:39:39 +01:00
Dennis Gilmore 78e3d0f115 add installupgradeinitrd function and use it to install the upgrade initrds 2012-11-30 13:28:38 -06:00
Martin Gracik 91afe5883f Set permissions on the initrd (#863018)
Dracut now makes the initrd with 600 permissions
for security reasons. These reasons do not apply
to install images, and we want the other tools
that use lorax to be able to read the initrd file.
2012-10-11 10:24:11 +02: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
Will Woods 3a75b2e07d add 'systemctl' command and use it in postinstall
The 'systemctl' command can be used to enable, disable, or mask systemd
units inside the runtime being modified. Modify runtime-postinstall.tmpl
to use the 'systemctl' command.

We also no longer remove quota*.service or kexec*.service, since
these aren't enabled by default. And systemd-remount-api-vfs.service
should work correctly now, so we can leave it alone as well.
2012-06-19 20:00:00 -04:00
Will Woods 3fda56b499 Add some documentation to LoraxTemplateRunner 2012-06-19 19:59:59 -04:00
Will Woods daacb4465d fix '-runcmd' and improve logging
The '-cmd' functionality depends on the individual lorax template
commands raising errors, so they shouldn't do sys.exit().

Also, capture stderr along with stdout, and put both in the log.
2012-06-19 19:59:59 -04:00
Martin Gracik cbe001638e Verify the yum transaction
Check if all packages that were supposed to be installed,
ended up installed.
2012-06-04 16:14:38 +02:00
Martin Gracik 7446d0d1e2 Add a --required switch to installpkg
Some packages are critical to the compose. If --required
is specified in the template's installpkg command, lorax
will exit if the package is not available.
2012-06-04 16:14:38 +02:00
Martin Gracik b61927badc Log all removed files
This makes finding what glob removed some file easier.
2012-04-12 08:28:58 -07:00
Brian C. Lane ac6512a531 Fix missing CalledProcessError import 2012-02-17 08:32:00 -08:00
Dan Horák 17179f2120 use internal implementation of the addrsize utility
Anaconda dropped the addrsize utility in F-16, so we need to implement
it directly in lorax.
2012-02-09 14:08:56 +01:00
Martin Gracik 681f67f954 Log output of failed command
If we run a command from template with runcmd,
log it's output if it exits with non-zero return code.
2012-01-19 18:13:03 +01:00
Will Woods 5e411b09c0 consider %ghost files part of the filelists in templates
When considering a package's filelist (e.g. for things like removefrom
--allbut), we might need to also include the %ghost files, so make
_filelist() add them to its returned list.
2012-01-05 16:15:54 -05:00
Will Woods c8f06bd8ff ltmpl: be more careful about checking command names 2011-11-04 13:41:10 -04:00
Will Woods dfa7742a6d default to fatalerrors=True in LoraxTemplateRunner
This means that any (non-ignored) command error will cause lorax to
exit.

Do note, however, that some commands (e.g. remove, installpkg) don't
raise exceptions and therefore will not cause lorax to exit.
2011-10-26 13:09:50 -04:00
Will Woods 0e64f08ff8 Add '-cmd' syntax to ignore errors, drop copyif/moveif
Makefile-style "-cmd" syntax lets us run a command and ignore any
resulting errors. This is a more general version of what copyif/moveif
were trying to accomplish, so we can drop those commands.
2011-10-26 13:08:39 -04:00
Will Woods 305476eefe add comment about symlink root-escape problem 2011-10-25 16:19:23 -04:00
Will Woods cd1225c5fb minor comment cleanups 2011-10-24 16:27:36 -04:00
Will Woods 262a05e539 ltmpl: continue loop if installpkg can't find something
Otherwise, something like:
  installpkg missing-thingy kernel kernel-firmware
will leave you without a kernel.
2011-09-15 19:27:31 -04:00
Will Woods 318c843e37 ltmpl: improve exception handling/reporting
- Log the error message (and the line causing the error) to console
- Log the whole exception (with some excess junk removed) to debuglog
- don't immediately SystemExit if the template won't parse
- clean up some comments
2011-09-15 19:24:35 -04:00
Will Woods 473f01c696 Add docstrings for the ltmpl commands in LoraxTemplateRunner 2011-09-14 18:33:30 -04:00
Will Woods faafd04dcb add '--allbut' flag to 'removefrom'
This lets us easily do whitelisting instead of blacklisting during
runtime cleanup. For example:
 removefrom xfsprogs --allbut /sbin/* /usr/sbin/xfs_admin
would remove everything from the xfsprogs package except files in /sbin
and /usr/sbin/xfs_admin.

A few things in runtime-cleanup have been converted to use --allbut. The
only difference in the created runtime image is that we're deleting
/usr/share/kde4 from fedora-logos.
2011-08-31 19:40:20 -04:00
Will Woods 916402b023 handle templatedir more cleanly in ltmpl/treebuilder
make sure that runner.templatedir gets set to a useful default if
initialized with None, and and make sure we pass templatedir to
LoraxTemplateRunner.__init__ (so it'll get initialized properly)
2011-08-08 19:01:38 -04:00
Will Woods 9f6393c58e better logging for removepkg/removefrom
emit a useful log message if we attempt to removepkg something that
isn't installed, or if a glob used in a removefrom line matches no
files.

this will help us keep the templates cleaner.
2011-08-01 17:24:20 -04:00
Will Woods f5164d6460 ltmpl: do brace expansion on the entire template
Handle brace expansion while parsing the template rather than
individually per-command. This is closer to how bash does things anyway.
2011-07-06 18:02:20 -04:00
Will Woods 416b7eef57 make glob() in templates return a list 2011-06-30 17:54:02 -04:00
Will Woods 2e8d5c78b8 move template 'exists' and 'glob' to self.builtins
otherwise, assigning to runner.defaults clobbers them. oops.
2011-06-30 16:59:55 -04:00
Will Woods b39d90c688 Move LoraxTemplateRunner (and helpers) to ltmpl 2011-06-30 13:24:07 -04:00
Will Woods 2096ebc551 remove unused LoraxTemplate.getdata() 2011-06-08 17:32:38 -04:00
Will Woods dde2b9ae62 Remove comments (lines starting with '#') from templates 2011-05-31 12:24:17 -04:00
Will Woods 17e5f9e19a Better tracebacks for LoraxTemplate 2011-05-26 14:08:01 -04:00
Will Woods a15c5ded9c Add "directories=[]" param to LoraxTemplate 2011-05-12 17:29:01 -04:00
Will Woods a82da40015 Add "getdata" method to LoraxTemplate
getdata(cmd) will return a generator that yields every token on every
line that starts with the token "cmd". getdata(cmd, mode="lines") will
yield a list for each line rather than every individual token.

this simplifies some things in __init__.py.
2011-05-09 15:33:55 -04:00
Martin Gracik 0a7f221bd5 Mako template returns unicode strings (#681003)
New mako template returns unicode strings, which are
a problem for shlex. We need to encode them to ascii.
2011-03-10 10:53:55 +01:00
Martin Gracik b7504823e0 Fixed pylint errors in ltmpl.py 2010-12-02 13:20:41 +01:00
Martin Gracik 2fc71cc74e Catch template exceptions 2010-10-29 14:41:23 +02:00
Martin Gracik 45c5ef566c Experimental single initrd image 2010-10-12 18:32:35 +02:00
Martin Gracik a4c638f132 New version 2010-02-23 14:20:05 +01:00