cdtool is a small Perl script for mastering ISO 9660 images. More precisely, it aids in the placement and naming of files on such images, and the creation of them. More concisely, it basically aids in the generation of a path-list file with graft points for the venerable mkisofs utility. For comparison, it is somewhat similar in function to the graphical nautilus-cd-burner program, but is designed for command-line usage, and is able to save the generation data for the ISO image, a feature sorely missing from nautilus-cd-burner.


cdtool maintains two pieces of state in a file named ~/.cdtool. The pieces of state are the image currently being modified, and the graft point currently being manipulated inside the image. These are defined globally instead of on the command line for convenience only. cdtool is designed to be invoked many times, and therefore it would be inconvenient to need to respecify them every time. The current image state variable specifies a file name, which is generated in a ASCII readable (and modifiable) format, suitable for cdtool's operation. It contains the list of files in the image, and some other pieces of information about the image, such as its revision and its disk label. The term "graft point" is used in the same sense as in the man page for mkisofs—that is, as a directory created virtually (independent of the file system that the actual files are taken from), containing the actual files.

Every invocation of cdtool takes a subcommand as its first non-option argument. To set the current image, call cdtool setimg, followed by the image's file name. Remember not to use a relative file name, as that would generate a different image every time cdtool is called from a different CWD. To set the current graft point, call cdtool setgp, followed by the name of the graft point. The graft point name should not contain leading or trailing slashes, although trailing ones will be removed (mainly for convenience, to be able to specify / for the image's root directory).

When the current image is set, a number of commands are available to manipulate it:

cdtool add {FILE|-g GRAFTPOINT}...
The add command will add all the named files to a graft point. Graft points may either be specified using the -g option in line, in which case all the files following it will be added to the specified graft point (-g may be specified multiple times), or by omitting any -g option, in which case files will be added to the current graft point. In case any of the files specified is a directory, it will be traversed recursively, and all its descending files will be added. Graft points will consider the descending directory tree. cdtool will canonicalize all path elements (rooting them and resolving any .. elements and symbolic links).
cdtool rm NAME
The rm command takes one real file name (not a grafted name) and removes the file in the image corresponding to it from the image. If the specified file name resolves to a directory, any files in the image that reside in that directory or any of its subdirectories will be removed from the image.
cdtool ls
The ls command outputs all the virtual (grafted) names in the image, one per line, to stdout.
cdtool szck
The szck command checks the size of all the files that the image would contain, and outputs the total size with thousands seperators to stdout.
cdtool mkiso
The mkiso command invokes mkisofs to generate an actual ISO image to stdout, which can, for instance, be redirected to a local file or piped directly into cdrecord for burning on-the-fly. The image is created with Rock Ridge and Joliet extensions. The suggested usage is cdtool mkiso | cdrecord - (provided that a valid /etc/cdrecord.conf exists). If the image has been modified since the mkiso command was last run on it, its revision will be incremented. The disk label used will be either the disk label specified in the image, or, if none is specified, the basename of the image file, appended with the current image revision.


Valid XHTML 1.1! Valid CSS! This site attempts not to be broken.
Author: Fredrik Tolf <>
Last changed: Fri Jan 5 07:14:47 2007