#!/usr/bin/perl -w # $Id: make_cdfs,v 1.7 1999/09/23 18:19:23 jabrown Exp $ # Jeff Brown # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. my $prog_name = "make_cdfs"; sub usage_long { print STDERR "${prog_name} [-V \"volume name\"] -o outfile.iso path1 ... pathN\n" . "\n" . "This will create an ISO9660 filesystem image containing the _contents_\n" . "of the given pathnames. The filenames will be truncated to 8+3 format\n" . "and long filename info written in RockRidge and Joliet extensions,\n" . "as well as a plain-text file.\n" . "\n" . "All symbolic links will be followed.\n" . "\n" . "For advanced path specification syntax, see the mkisofs(1) manpage.\n"; exit 1; } sub usage_short { print STDERR "${prog_name}: invalid command line. Use \"${prog_name} -h\" for usage info.\n"; exit 1; } if ($#ARGV < 0) { usage_short; } elsif (scalar(grep(/^${ARGV[0]}/, ("-h", "-help", "-?"))) > 0) { usage_long; } my $iso_fname; undef $iso_fname; my $vol_title; undef $vol_title; my @path_specs; undef @path_specs; while ($#ARGV >= 0) { $arg = shift(@ARGV); if ($arg eq "-V") { $arg = shift(@ARGV); if (defined($arg)) { $vol_title = $arg; } else { usage_short; } } elsif ($arg eq "-o") { $arg = shift(@ARGV); if (defined($arg)) { $iso_fname = $arg; } else { usage_short; } } else { # Treat as path spec - no leading "-" since that may confuse mkisofs. if ($arg =~ /^-/) { print STDERR "${prog_name}: Path specifications may not begin with " . "'-' ('$arg')\n"; exit 1; } push(@path_specs, $arg); } } if (!defined($iso_fname)) { usage_short; } if ($#path_specs < 0) { usage_short; } # All files, follow symlinks, Joliet extensions, long filenames, # allow dotfiles, RockRidge extensions, make TRANS.TBL, verbose #mkisofs -a -f -J -l -L -r -T -v "$@" # All files, follow symlinks, Joliet extensions, # RockRidge extensions, make TRANS.TBL, verbose #mkisofs -a -f -J -r -T -v "$@" @cmd_line = ("mkisofs", "-a", "-f", "-J", "-r", "-T", "-v"); push(@cmd_line, ("-o", $iso_fname)); if (defined($vol_title)) { push(@cmd_line, ("-V", $vol_title)); } else { print STDERR "${prog_name}: WARNING: no volume title specified.\n"; } push(@cmd_line, @path_specs); print "Command: @cmd_line\n"; sleep(1); system(@cmd_line);