From Fedora Project Wiki

This page describes the language used in Lorax templates.

append

 append FILE STRING

Append STRING (followed by a newline character) to FILE. Python character escape sequences ('\n', '\t', etc.) will be converted to the appropriate characters.

Examples:

  • append /etc/depmod.d/dd.conf "search updates built-in"
  • append /etc/resolv.conf ""

chmod

 chmod FILEGLOB OCTALMODE

Change the mode of all the files matching FILEGLOB to OCTALMODE.

copy

 copy SRC DEST

Copy SRC to DEST. If DEST is a directory, SRC will be copied inside it. If DEST doesn't exist, SRC will be copied to a file with that name, if the path leading to it exists.

gconfset

 gconfset PATH KEYTYPE VALUE [OUTFILE]

Set the given gconf PATH, with type KEYTYPE, to the given value. OUTFILE defaults to /etc/gconf/gconf.xml.defaults if not given.

Example:

  • gconfset /apps/metacity/general/num_workspaces int 1

hardlink

 hardlink SRC DEST

Create a hardlink at DEST which is linked to SRC.

install

 install SRC DEST

Copy the given file (or files, if a glob is used) from the input tree to the given destination in the output tree. The path to DEST must exist in the output tree. If DEST is a directory, SRC will be copied into that directory. If DEST doesn't exist, SRC will be copied to a file with that name, assuming the rest of the path exists. This is pretty much like how the 'cp' command works.

Examples:

  • install usr/share/myconfig/grub.conf /boot
  • install /usr/share/myconfig/grub.conf.in /boot/grub.conf

installinitrd

 installinitrd SECTION SRC DEST

Same as installkernel, but for "initrd".

installkernel

 installkernel SECTION SRC DEST

Install the kernel from SRC in the input tree to DEST in the output tree, and then add an item to the treeinfo data store, in the named SECTION, where "kernel" = DEST.

Equivalent to:

  • install SRC DEST
  • treeinfo SECTION kernel DEST

installpkg

 installpkg PKGGLOB [PKGGLOB ...]

Request installation of all packages matching the given globs. Note that this is just a *request* - nothing is *actually* installed until the 'run_pkg_transaction' command is given.

log

 log MESSAGE

Emit the given log message. Be sure to put it in quotes!

Example:

  • log "Reticulating splines, please wait..."

mkdir

 mkdir DIR [DIR ...]

Create the named DIR(s). Will create leading directories as needed.

Example:

  • mkdir /images

move

 move SRC DEST

Move SRC to DEST.

remove

 remove FILEGLOB [FILEGLOB ...]

Remove all the named files or directories. Will *not* raise exceptions if the file(s) are not found.

removefrom

 removefrom PKGGLOB [--allbut] FILEGLOB [FILEGLOB...]

Remove all files matching the given file globs from the package (or packages) named. If '--allbut' is used, all the files from the given package(s) will be removed *except* the ones which match the file globs.

Examples:

  • removefrom usbutils /usr/bin/*
  • removefrom xfsprogs --allbut /sbin/*

removepkg

 removepkg PKGGLOB [PKGGLOB...]

Delete the named package(s).

Implementation note

RPM scriptlets (%preun/%postun) are *not* run.

Files are deleted, but directories are left behind.

replace

 replace PATTERN REPLACEMENT FILEGLOB [FILEGLOB ...]

Find-and-replace the given PATTERN (Python-style regex) with the given REPLACEMENT string for each of the files listed.

Example:

  • replace @VERSION@ ${product.version} /boot/grub.conf /boot/isolinux.cfg

run_pkg_transaction

 run_pkg_transaction

Actually install all the packages requested by previous 'installpkg' commands.

runcmd

 runcmd CMD [--chdir=DIR] [ARG ...]

Run the given command with the given arguments. If "--chdir=DIR" is given, change to the named directory before executing the command.

NOTE: All paths given MUST be COMPLETE, ABSOLUTE PATHS to the file or files mentioned. ${root}/${inroot}/${outroot} are good for constructing these paths.

FURTHER NOTE: Please use this command only as a last resort! Whenever possible, you should use the existing template commands. If the existing commands don't do what you need, fix them!

Example:

  • runcmd find ${root} -name "*.pyo" -type f -delete

symlink

 symlink SRC DEST

Create a symlink at DEST which points to SRC.

treeinfo

 treeinfo SECTION KEY ARG [ARG ...]

Add an item to the treeinfo data store. The given SECTION will have a new item added where KEY = "ARG ARG ..."

Example:

  • treeinfo images-${kernel.arch} boot.iso images/boot.iso