# $config{disc}[disc number]{function}{data}{'installation'} = $config[2][cd number][1][function number] it should have only one installation by disc, anyway
["c", "cd", 1, "<number of discs>", "Max number of discs", sub { my ($tmp, $cd) = @_; if ($cd =~ /\d+/) { $tmp->[0]{cd} = $cd } else { return 0 }; 1 }, "Setting max number of discs"],
[ "", "addmd5", 1, "<iso file>", "Add md5sum to iso header.", sub { my $err = include_md5(pop, 1, 1); print $err }, "Adding md5 to ISO header" ],
[ "k", "checkmd5", 1, "<iso file>", "Checking md5sum of iso header.", sub { my $err = include_md5(pop, 0, 1); print $err }, "Checking md5 of ISO header" ],
[ "", "bugzilla", 0, "", "Use bugzilla as information source.", sub { $config{bugzilla} = 1 }, "Using Bugzilla" ],
[ "b", "builddir", 1, "<build dir>", "Where live iso image are created (default current dir).", sub { $config{builddir} = pop @_ }, "Setting the build directory" ],
[ "", "buildhdlist", -1, "<rpms dir 1> <rpms dir 2> ... <rpms dir n>", "Build hdlist.cz files for given directories.",
[ "", "batch", 2, "<discs list> <batch file>", "batch mode to rebuilt discs from a previous session.", \&batchMode, "Batch mode" ],
[ "c", "catto", 1, "<log file>", "Log file.", sub { $config{log} = pop @_; open $LOG, ">$config{log}" or die "unable to open $config{log}\n" }, "Log file" ],
[ "", "listrpmsrate", 1, "<rpmsrate file>", "List the package in the rpmsrate file", \&packageOutOfRpmsrate, "Listing rpmsrate file" ],
[ "d", "depslist-creation", 0 , "", "rebuild the desplist.ordered file before checking the list.", sub { $config{deps}=1 }, "Depslist creation switch" ],
[ "", "discsize", 1 , "<disc size in bytes>", "Select a custom disc size (default $config{discsize}).", sub { $config{discsize} = convert_size(pop, $config{discsize}, $config{LOG}) }, "Custom disc size selection" ],
[ "f", "fast", 0 , "", "fast mode.", sub {
$config{fast} = 1;
$config{disc_building_tries} = 1;
$optimize = 0;
$config{optimize_space} = 0
}, "Fast mode" ],
[ "", "getleaves", 1, "<depslist file>", "Getting leaves from a depslist.ordered file", \&getLeaves, "Getting leaves from a depslist.ordered" ],
# FIXME function help should take 0 or one argument, but this is not possible with this structure
[ "", "check", -1, "<dir 1> <dir 2> ... <dir n>", "Check the hdlists, depslist and RPMS consistency.", sub { checkcds(@_) }, "Checking the hdlists, depslist and RPMs consistency" ],
[ "K", "checkdisc", 2, "<ISO mount point> <md5 file>", "Check the disc.", sub { check_discs(@_) }, "Checking the disc" ],
[ "i", "isodir", 1, "<iso dir>", "Where ISOs are built (default ./iso/product_name/).", sub { $config{isodir} = pop @_ }, "Setting the iso directory" ],
[ "l", "lists", 1 , "", "lists of discs taken into account.", sub { $config{lists} = getTracks(pop @_) }, "Using given disc list" ],
[ "m", "make", 1, "<cds number>", "Build the discs.", \&make , "Building the discs" ],
[ "", "nodeps", 0, "", "Do not include automatically dependencies of packages", sub { $config{nodeps} = 1 }, "Setting nodeps flag" ],
[ "", "nolive", 0, "", "Do not create live image of the discs.", sub { $config{nolive} = 1 }, "Setting nolive option" ],
[ "", "noiso", 0, "", "Do not create iso images of the discs.", sub { $config{noiso} = 1 }, "Setting noiso option" ],
[ "", "nosrcfit", 0, "", "Do not stop if sources discs are full", sub { $config{nosrcfit} = 1 }, "Setting nosrcfit option" ],
[ "", "nosrc", 0, "", "Do not include sources", sub { $config{nosrc} = 1 }, "Setting nosrc option" ],
[ "", "oem", -1, "<root of disc 1> <root of disc 2> ... <root of disc n>", "Build a OEM installation CD based on the given disc", \&oem, "Building oem disc" ],
[ "p", "printscript", 1, "<script file>", "Print the script that can be use to rebuild the discs", sub { $config{printscript} = shift }, "Printing script" ],
[ "", "printdiscsfiles", 1, "<file>", "Print the contains of each disc", sub { $config{print} = shift }, "Printing disc contains" ],
[ "", "pl", -1, "<hdlist 1> <hdlist 2> ... <hdlist n>", "Do a packdrake -l on the hdlists", sub { list_hdlist(@_) }, "Printing hdlist contents" ],
[ "t", "topdir", 1, "<top dir>", "Where files are created (default current dir).", sub { $config{topdir} = pop @_; $config{tmp} = $ENV{TMPDIR} || "$config{$topdir}/tmp" }, "Setting the top directory" ],
[ "", "update-rpmsrate", -2, "<rpmsrate> <rpms directory 1> <rpms directory 2> ... <rpms directory n>", "Add major to libraries in rpmsrate",
[ "", "verbose", 1 , "<log level>", "Print more messages (the higher the more, 5 is the higher)", sub { $config{verbose} = shift; 1 }, "Setting the verbose flag" ],
[ "v", "version", 0, "", "Print program version", sub { print_fh($config{LOG}, "\nmkcd version $VERSION\n"); 1 }, "" ],
[ "", "disc_building_tries", 1 , "<maximum number of iteration to build correct ISO size>", "Set the number of iterations when trying to adjust ISO size", sub { $config{disc_building_tries} = shift; $optimize = 1 }, "Setting the disc_building_tries value" ],
[ "", "use_optimize_space", 1 , "<number of disc building tries>", "Use optimize_space algorythm",
sub {
my $t = shift;
$config{disc_building_tries} = $t;
$optimize = 1;
$config{optimize_space} = $t
}, "Setting the disc_building_tries value" ],
[ "P", "Publisher", 1 , "<publisher name>", "Set the publisher name for ISO header publisher_id (128 char max)", sub { $config{Publisher} = substr shift, 0, 128 }, "Setting the publisher ID flag" ],
# [ "", "test", 0 , "", "Set the publisher name for ISO header publisher_id (128 char max)", sub { print "ARCH ", keys %{$config{ARCH}} , "\n\n" }, "Setting the publisher ID flag"],
$cds = [grep { ref $config{disc}[$_] and do { $list{$_} = 2; push @{$config{lists}}, $_ } or print $LOG "WARNING: disc $_ not defined\n" and 0 } @$cds];
$config{lists} ||= $cds;
$config{lists} = [grep { $list{$_} or ref $config{disc}[$_] and $list{$_} = 1 or print $LOG "WARNING: disc $_ not defined\n" and 0 } @{$config{lists}}];
return (\%list,$cds)
}
sub auto_mode {
my ($opt,$repository, @rpms) = @_;
$config{nolive} = 1;
$config{nosrcfit} = 1;
$config{deps} = 1;
if (!$optimize) {
$config{disc_building_tries} = 1;
$config{optimize_space} = 0;
}
-d "$repository/Mandrake" or print "ERROR: $repository/Mandrake does not exist\n" and return 0;