It requires cdrecord and mkisofs. In order to work as documented, it needs a fairly recent version of mkisofs; the mkisofs distributed with RedHat 5.2 (mkisofs-1.12b4-1) works fine. If you have an older version, stuff you intend to go into subdirectories will get dumped into the top level of the CD.
Also, if you have an older version than 1.12.1 of mkisofs, you might want to add the `-a' option to both invocations of mkisofs in the script; that will cause editor backup files (files which end in `~' or `#') to be included in the generated CD-ROM. In 1.12b4, the default was not to include such files; in 1.12.1, the default is to include them.
Here's the script:
Usage: $0 [options] [paths] --help -h get help --dryrun -n don't do anything; just print actions to take --yes -y pre-answer all questions "yes" --quiet -q quiet mode --verbose -v verbose mode (not yet implemented) --isofs <path> -i put ISO-9660 image in <path>, not /backup/backup.iso --logfile <path> -l list CD contents in <path> after creation --speed <digit> -s speed for cdrecord (default is 1, single speed) --device <c,i,l> -d SCSI device as controller,id,lun (default "0,6,0") --exclude <glob> -m file or directory name to ignore; can appear multiple times. "cache", ".glimpse", and ".Xauthority" are ignored by default. --blank <type> -b blank a CD-RW before writing; <type> is "all" or "fast" --file <path> -f file with lines in the form DIR/=DIR or FILE=FILE which represent files or directories to be written to CD, eg "/etc/=/etc". Non-option arguments are of the form "CDDIR/=DIR" or "CDFILE=FILE", and will name files or directories to back up (as for lines in --file's file). If only "FILE" or "DIR" is specified, it or its contents will be put in the top level of the CD. A path or --file must be given. No shell metacharacters (spaces, backticks, asterisks, etc.) can appear in a pathname to be backed up. ("/my directory/=/my directory" fails.)
You can also create a file called cdbackup.defaults in the current directory (I run cdbackup out of a special directory by typing ./cdbackup, which is why this makes sense) that overrides some of the default settings in the script. That way you don't need always to specify `--speed 6 --device 0,4,0 --isofs /var/tmp/backup.iso' if you have a 6x CD-recorder on SCSI ID 4 and don't have a /backup partition. The variables you can override in this file and their default values (taken from the script) are:
really='' # 'echo' if just testing help=0 # 1 -> just display (long) help yes=0 # 1 -> noninteractive (go ahead) quiet=0 # 1 -> be quiet verbose=0 # 1 -> be verbose (UNUSED) cdrecord_v='' # '-v' if $verbose mkisofs_v='' # '-v' if $verbose isofs=/backup/backup.iso # where to create ISO-9660 image dev='0,6,0' # SCSI device to write to (ctlr,id,lun) logs=/backup/cdlogs speed=1 excludes='-m cache -m .glimpse -m .Xauthority' # ignore these dirs cdrecord_blank='' date=`date '+%Y-%m-%d-%H%M'` host=`hostname` logfile='' # name of log file to write # (default set below) dirs='' # files/dirs to copy dirfile='' # name of file with directories/files # to copyAs you can see, they don't all correspond trivially to individual command-line options.