1 | #!/usr/bin/perl |
---|
2 | # |
---|
3 | # to prepare, create and burn iso images |
---|
4 | # |
---|
5 | |
---|
6 | my $VERSION = "3.3.6"; |
---|
7 | |
---|
8 | use strict; |
---|
9 | use File::NCopy qw(copy); |
---|
10 | use Mkcd::Commandline qw(parseCommandLine usage); |
---|
11 | use Mkcd::Tools qw(printTable getTracks du cpal checkcds cleanrpmsrate config compute_md5 include_md5 convert_size); |
---|
12 | use Mkcd::Group; |
---|
13 | use Mkcd::Package qw(packageOutOfRpmsrate getLeaves list_hdlist mkcd_build_hdlist %ARCH); |
---|
14 | use packdrake; |
---|
15 | use RPM::Header; |
---|
16 | |
---|
17 | # |
---|
18 | # FIXME not up to date |
---|
19 | # |
---|
20 | # config structure |
---|
21 | # |
---|
22 | # $config{name} = name for the product |
---|
23 | # |
---|
24 | # $config{list} = list data |
---|
25 | # $config{list}[list number]{name} = list name |
---|
26 | # {filelist} = ( file list location 1, file list location 2, ..., file list location n ) |
---|
27 | # |
---|
28 | # $config{list}[list number]{packages}[location i] = (RPMS location i, SRPMS location i) |
---|
29 | # |
---|
30 | # $config{list}[list number]{done} |
---|
31 | # {empty} |
---|
32 | # {auto} |
---|
33 | # {cd} |
---|
34 | # {sources} |
---|
35 | # |
---|
36 | # $config{list}[list number]{disc} = { cd => { rep => { options }} } |
---|
37 | # |
---|
38 | # $config{disc} = disc data |
---|
39 | # $config{disc}[disc number]{size} = size in bytes |
---|
40 | # $config{disc}[disc number]{serial} = serial number |
---|
41 | # $config{disc}[disc number]{name} = disc number irl |
---|
42 | # $config{disc}[disc number]{longname} = disc long name |
---|
43 | # $config{disc}[disc number]{fastgeneric} = [ generic data 1, generic data 2, ..., generic data n] |
---|
44 | # |
---|
45 | # $config{disc}[disc number]{function}{list}[function number] = (function name, { data }) |
---|
46 | # |
---|
47 | # $config{disc}[disc number]{function}{data}{dir}{repository identifier} = $config[2][cd number][1][function number] |
---|
48 | # |
---|
49 | # $config{disc}[disc number]{function}{data}{'installation'} = $config[2][cd number][1][function number] it should have only one installation by disc, anyway |
---|
50 | # |
---|
51 | # $config{disc}[disc number]{function}{data}[2]{'advertising'} = $config[2][cd number][1][function number] |
---|
52 | # |
---|
53 | # $config{disc}[disc number]{steps} = function to execute to build the disc |
---|
54 | # |
---|
55 | # |
---|
56 | # $config other values: |
---|
57 | # |
---|
58 | # discMax = higher real disc number |
---|
59 | # configfile = config file use for this session |
---|
60 | # lists |
---|
61 | # fast |
---|
62 | # nodeps |
---|
63 | # verbose |
---|
64 | # print |
---|
65 | # printscript |
---|
66 | # nolive |
---|
67 | # noiso |
---|
68 | # deps |
---|
69 | # nosrcfit |
---|
70 | # product |
---|
71 | # bugzilla |
---|
72 | # builddir |
---|
73 | # topdir |
---|
74 | # discsize |
---|
75 | # isodir |
---|
76 | # filetag |
---|
77 | # log |
---|
78 | # mkisoopt |
---|
79 | # tmp |
---|
80 | # |
---|
81 | |
---|
82 | # |
---|
83 | # Availaible functions |
---|
84 | # |
---|
85 | # see Functions.pm |
---|
86 | # |
---|
87 | |
---|
88 | # old -> new schema |
---|
89 | # |
---|
90 | # config structure |
---|
91 | # |
---|
92 | # $config[0][0] -> $config{name} |
---|
93 | # |
---|
94 | # $config[1] -> $config{list} |
---|
95 | # $config[1][list number][0] -> $config{list}[list number]{filelist} |
---|
96 | # |
---|
97 | # $config[1][list number][1][location i] -> $config{list}[list number]{packages}[location i] |
---|
98 | # |
---|
99 | # $config[1][list number][2] -> $config{list}[list number]{done}, $config{list}[list number]{empty} $config{list}[list number]{cd}$config{list}[list number]{auto} |
---|
100 | # |
---|
101 | # $config[1][list number][3] -> $config{list}[list number]{disc} |
---|
102 | # |
---|
103 | # $config[2] -> $config{disc} |
---|
104 | # $config[2][cd number][0] -> $config{disc}[disc number]{size}, $config{disc}[disc number]{serial}, $config{disc}[disc number]{name}, $config{disc}[disc number]{longname}, $config{disc}[disc number]{fastgeneric} |
---|
105 | # |
---|
106 | # $config[2][cd number][1][function number] -> $config{disc}[disc number]{function}{list}[function number] |
---|
107 | # |
---|
108 | # $config[2][cd number][2]{dir}{repository identifier} -> $config{disc}[disc number]{function}{data}{dir}{repository identifier} |
---|
109 | # |
---|
110 | # $config[2][cd number][2]{'installation'} -> $config{disc}[disc number]{function}{data}{'installation'} |
---|
111 | # |
---|
112 | # $config[2][cd number][2]{'advertising'} -> $config{disc}[disc number]{function}{data}[2]{'advertising'} |
---|
113 | # |
---|
114 | # $config[2][cd number][3] -> $config{disc}[disc number]{steps} |
---|
115 | # |
---|
116 | # |
---|
117 | # $config[3] -> $config{discMax}, $config{configfile} |
---|
118 | # |
---|
119 | # |
---|
120 | use vars qw($topdir %config @params %FUNCTIONS $functions $optimize); |
---|
121 | |
---|
122 | $topdir = `pwd`; |
---|
123 | chop $topdir; |
---|
124 | %config = ( |
---|
125 | lists => [], |
---|
126 | fast => 0, |
---|
127 | nodeps => 0, |
---|
128 | verbose => 0, |
---|
129 | print => 0, |
---|
130 | printscript => 0, |
---|
131 | nolive => 0, |
---|
132 | noiso => 0, |
---|
133 | deps => 0, |
---|
134 | nosrcfit => 0, |
---|
135 | nosrc => 0, |
---|
136 | product => 0, |
---|
137 | bugzilla => 0, |
---|
138 | builddir => 0, |
---|
139 | topdir => $topdir, |
---|
140 | discsize => 681000000, |
---|
141 | isodir => 0, |
---|
142 | filetag => 0, |
---|
143 | log => 0, |
---|
144 | mkisoopt => "-r -J -hide-rr-moved -nobak -cache-inodes", |
---|
145 | tmp => $ENV{TMPDIR} || "$topdir/tmp", |
---|
146 | disc_building_tries => 3, |
---|
147 | rejected_options => { |
---|
148 | no_disc => "Could not add more disc for this package", |
---|
149 | no_space => "Not enough space", |
---|
150 | deps => "Missing dependencies", |
---|
151 | old_version => "More recent version found", |
---|
152 | deps_rejected => "Some needed dependencies rejected", |
---|
153 | excluded => "Explicitely excluded", |
---|
154 | order_pb => "Needed dependency could not be put before", |
---|
155 | sequential => "Could not add interlist dependencies in sequential mode", |
---|
156 | autodeps => "not selected in rpm lists" |
---|
157 | }, |
---|
158 | optimize_space => 1, |
---|
159 | ARCH => \%ARCH |
---|
160 | ); |
---|
161 | |
---|
162 | $config{group} = new Mkcd::Group(\%config); |
---|
163 | $functions = $config{group}{disc}{functions}{functions}; |
---|
164 | my $arg = @ARGV; |
---|
165 | @params = ( |
---|
166 | # [ "one letter option", "long name option", "number of args (-X means Žat least XŽ)", "help text", "function to call", "log info"] |
---|
167 | [ "", "mkcd", 0, "<options>", "mkcd Mandrake Linux Disc maker", sub { $arg or usage('mkcd',\@params) }, "" ], |
---|
168 | [ "a", "auto", [ |
---|
169 | ["", "auto", -1, "<repository> <extra RPMS directory 1> <extra RPMS directory 2> ... <extra RPMS directory n>", "Auto mode configuration", |
---|
170 | sub { |
---|
171 | my ($tmp, @arg) = @_; |
---|
172 | $tmp->[0] ||= {}; |
---|
173 | push @$tmp, @arg; |
---|
174 | 1 |
---|
175 | }, "Setting auto mode arguments"], |
---|
176 | ["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"], |
---|
177 | ["s", "sources", [ |
---|
178 | [ "", "sources", 0, "<options>", "Sources mode options", |
---|
179 | sub { my ($tmp) = @_; |
---|
180 | $tmp->[0] ||= {}; |
---|
181 | 1 |
---|
182 | }, "Setting source mode options" ], |
---|
183 | [ "s", "separate", 0, "", "Separate binaries discs from sources discs", sub { my ($tmp) = @_; $tmp->[0]{separate} = 1 }, "Setting source mode separate option" ] |
---|
184 | ], "", "Create SRPMS discs too", sub { my ($tmp, $opt) = @_; $tmp->[0]{sources} = $opt }, "Setting source mode"], |
---|
185 | ["", "noisolinux", 0, "", "Do not use a isolinux boot", sub { my ($tmp) = @_; $tmp->[0]{noisolinux} = 1 }, "Setting noisolinux option"] |
---|
186 | ], "[options] <repository> <extra RPMS directory 1> <extra RPMS directory 2> ... <extra RPMS directory n>", "Automated mode, build discs from a repository.", \&auto_mode, "Auto mode" ], |
---|
187 | [ "", "addmd5", 1, "<iso file>", "Add md5sum to iso header.", sub { my $err = include_md5(pop,1,1); print $err }, "Adding md5 to ISO header" ], |
---|
188 | [ "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" ], |
---|
189 | [ "", "bugzilla", 0, "", "Use bugzilla as information source.", sub { $config{bugzilla} = 1 }, "Using Bugzilla" ], |
---|
190 | [ "b", "builddir", 1, "<build dir>", "Where live iso image are created (default current dir).", sub { $config{builddir} = pop @_ }, "Setting the build directory" ], |
---|
191 | [ "", "buildhdlist", -1, "<rpms dir 1> <rpms dir 2> ... <rpms dir n>", "Build hdlist.cz files for given directories.", |
---|
192 | sub { |
---|
193 | my $i; |
---|
194 | mkcd_build_hdlist(1 + @_, [ 0, map { $i++; { rpms => [ glob "$_/*.rpm" ], hdlist => "./hdlist$i.cz", synthesis => "./synthesis.hdlist$i.cz" } } @_ ], "$config{tmp}/.build_hdlist") |
---|
195 | }, "building hdlist files" ], |
---|
196 | [ "", "batch", 2, "<discs list> <batch file>", "batch mode to rebuilt discs from a previous session.", \&batchMode, "Batch mode" ], |
---|
197 | [ "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" ], |
---|
198 | [ "", "listrpmsrate", 1, "<rpmsrate file>", "List the package in the rpmsrate file", \&packageOutOfRpmsrate, "Listing rpmsrate file" ], |
---|
199 | [ "d", "depslist-creation", 0 , "", "rebuild the desplist.ordered file before checking the list.", sub { $config{deps}=1 }, "Depslist creation switch" ], |
---|
200 | [ "", "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" ], |
---|
201 | [ "f", "fast", 0 , "", "fast mode.", sub { |
---|
202 | $config{fast} = 1; |
---|
203 | $config{disc_building_tries} = 1; |
---|
204 | $optimize = 0; |
---|
205 | $config{optimize_space} = 0 |
---|
206 | }, "Fast mode" ], |
---|
207 | [ "", "getleaves", 1, "<depslist file>", "Getting leaves from a depslist.ordered file", \&getLeaves, "Getting leaves from a depslist.ordered" ], |
---|
208 | # FIXME function help should take 0 or one argument, but this is not possible with this structure |
---|
209 | [ "h", "help", -1, "<path> <to> <the> <function>", "Display help, eg. mkcd -h installation fixed. Type mkcd -h config for configuration files options.", |
---|
210 | sub { |
---|
211 | my (@function) = @_; |
---|
212 | if (@function) { |
---|
213 | my $key = join '/', @function; |
---|
214 | if (ref $FUNCTIONS{$key}) { |
---|
215 | usage($key, $FUNCTIONS{$key}) |
---|
216 | } |
---|
217 | } |
---|
218 | usage("mkcd", \@params); |
---|
219 | }, "" ], |
---|
220 | [ "", "check", -1, "<dir 1> <dir 2> ... <dir n>", "Check the hdlists, depslist and RPMS consistency.", sub { checkcds(@_) }, "Checking the hdlists, depslist and RPMs consistency" ], |
---|
221 | [ "K", "checkdisc", 2, "<ISO mount point> <md5 file>", "Check the disc.", sub { check_discs(@_) }, "Checking the disc" ], |
---|
222 | [ "i", "isodir", 1, "<iso dir>", "Where ISOs are built (default ./iso/product_name/).", sub { $config{isodir} = pop @_ }, "Setting the iso directory" ], |
---|
223 | [ "l", "lists", 1 , "", "lists of discs taken into account.", sub { $config{lists} = getTracks(pop @_) }, "Using given disc list" ], |
---|
224 | [ "m", "make", 1, "<cds number>", "Build the discs.", \&make , "Building the discs" ], |
---|
225 | [ "", "nodeps", 0, "", "Do not include automatically dependencies of packages", sub { $config{nodeps} = 1 }, "Setting nodeps flag" ], |
---|
226 | [ "", "nolive", 0, "", "Do not create live image of the discs.", sub { $config{nolive} = 1 }, "Setting nolive option" ], |
---|
227 | [ "", "noiso", 0, "", "Do not create iso images of the discs.", sub { $config{noiso} = 1 }, "Setting noiso option" ], |
---|
228 | [ "", "nosrcfit", 0, "", "Do not stop if sources discs are full", sub { $config{nosrcfit} = 1 }, "Setting nosrcfit option" ], |
---|
229 | [ "", "nosrc", 0, "", "Do not include sources", sub { $config{nosrc} = 1 }, "Setting nosrc option" ], |
---|
230 | [ "", "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" ], |
---|
231 | [ "p", "printscript", 1, "<script file>", "Print the script that can be use to rebuild the discs", sub { $config{printscript} = shift }, "Printing script" ], |
---|
232 | [ "", "printdiscsfiles", 1, "<file>", "Print the contains of each disc", sub { $config{print} = shift }, "Printing disc contains" ], |
---|
233 | [ "", "pl", -1, "<hdlist 1> <hdlist 2> ... <hdlist n>", "Do a packdrake -l on the hdlists", sub { list_hdlist(@_) }, "Printing hdlist contents" ], |
---|
234 | [ "s", "spec", 1, "<config file>", "Configuration file", sub { config(shift, \%config,$functions) } , "Loading configuration file" ], |
---|
235 | [ "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" ], |
---|
236 | [ "", "update-rpmsrate", -2, "<rpmsrate> <rpms directory 1> <rpms directory 2> ... <rpms directory n>", "Add major to libraries in rpmsrate", |
---|
237 | sub { |
---|
238 | my %rpm; |
---|
239 | foreach (@_) { $rpm{$_} = [ map { s/\.rpm$//; $_ } glob "$_/*.rpm" ] }; |
---|
240 | cleanrpmsrate(shift,0,0, \%rpm) |
---|
241 | }, "Adding major to libraries in rpmsrate" ], |
---|
242 | [ "", "verbose", 1 , "<log level>", "Print more messages (the higher the more, 5 is the higher)", sub { $config{verbose} = shift; 1 }, "Setting the verbose flag" ], |
---|
243 | [ "v", "version", 0, "", "Print program version", sub { print_fh($config{LOG}, "\nmkcd version $VERSION\n"); 1 }, "" ], |
---|
244 | [ "", "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" ], |
---|
245 | [ "", "use_optimize_space", 1 , "<number of disc building tries>", "Use optimize_space algorythm", |
---|
246 | sub { |
---|
247 | my $t = shift; |
---|
248 | $config{disc_building_tries} = $t; |
---|
249 | $optimize = 1; |
---|
250 | $config{optimize_space} = $t |
---|
251 | }, "Setting the disc_building_tries value" ], |
---|
252 | [ "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" ], |
---|
253 | # [ "", "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"], |
---|
254 | ); |
---|
255 | |
---|
256 | # FIXME this permit to have specific help |
---|
257 | foreach (@params) { |
---|
258 | $FUNCTIONS{"$_->[1]"} = ref $_->[2] ? $_->[2] : [ $_ ] |
---|
259 | } |
---|
260 | |
---|
261 | $FUNCTIONS{mkcd} = \@params; |
---|
262 | foreach my $k (keys %{$functions}) { |
---|
263 | $FUNCTIONS{$k} = $functions->{$k}; |
---|
264 | foreach (@{$functions->{$k}}) { |
---|
265 | $FUNCTIONS{"$k/$_->[1]"} = ref $_->[2] ? $_->[2] : [ $_ ] |
---|
266 | } |
---|
267 | push @{$FUNCTIONS{"config"}} , $functions->{$k}->[0] |
---|
268 | } |
---|
269 | |
---|
270 | local *LOG; |
---|
271 | open LOG, ">&STDERR"; |
---|
272 | $config{LOG} = *LOG; |
---|
273 | |
---|
274 | my $todo = parseCommandLine("mkcd", \@ARGV, \@params); |
---|
275 | @ARGV and usage("mkcd", \@params, "@ARGV, too many arguments"); |
---|
276 | foreach my $t (@$todo) { |
---|
277 | print LOG "mkcd: $t->[2]\n"; |
---|
278 | &{$t->[0]}(@{$t->[1]}) or print LOG "ERROR: $t->[2]\n"; |
---|
279 | } |
---|
280 | |
---|
281 | # FIXME only to make perl_checker happy |
---|
282 | sub print_fh { |
---|
283 | my ($fh, $text) = @_; |
---|
284 | print $fh $text |
---|
285 | } |
---|
286 | |
---|
287 | sub batchMode { |
---|
288 | my ($cds, $file) = @_; |
---|
289 | config($file, \%config,$functions); |
---|
290 | my ($discsFiles, $cd) = readBatchFile($file); |
---|
291 | (my $lists,$cds) = getDiscsList($cds); |
---|
292 | my @mkisos; |
---|
293 | my @size; |
---|
294 | Mkcd::Disc::makeDiscs(0,$lists,$cds, \@size, \@mkisos,$discsFiles); |
---|
295 | Mkcd::Disc::makeDiscs(1,$lists,$cds, \@size, \@mkisos,$discsFiles,$cd); |
---|
296 | } |
---|
297 | |
---|
298 | sub getDiscsList { |
---|
299 | my ($cds) = @_; |
---|
300 | $cds = getTracks($cds); |
---|
301 | print LOG "getDiscList: discs @$cds\n"; |
---|
302 | my %list; |
---|
303 | $cds = [grep { ref $config{disc}[$_] and do { $list{$_} = 2; push @{$config{lists}}, $_ } or print LOG "WARNING: disc $_ not defined\n" and 0 } @$cds]; |
---|
304 | $config{lists} ||= $cds; |
---|
305 | $config{lists} = [grep { $list{$_} or ref $config{disc}[$_] and $list{$_} = 1 or print LOG "WARNING: disc $_ not defined\n" and 0 } @{$config{lists}}]; |
---|
306 | return (\%list,$cds) |
---|
307 | } |
---|
308 | |
---|
309 | sub auto_mode { |
---|
310 | my ($opt,$repository, @rpms) = @_; |
---|
311 | $config{nolive} = 1; |
---|
312 | $config{nosrcfit} = 1; |
---|
313 | $config{deps} = 1; |
---|
314 | if (!$optimize) { |
---|
315 | $config{disc_building_tries} = 1; |
---|
316 | $config{optimize_space} = 0; |
---|
317 | } |
---|
318 | -d "$repository/Mandrake" or print "ERROR: $repository/Mandrake does not exist\n" and return 0; |
---|
319 | my $dir = "$repository/Mandrake"; |
---|
320 | local *DIR; opendir DIR, $dir; |
---|
321 | my $size; |
---|
322 | foreach (readdir DIR) { |
---|
323 | -d "$dir/$_" or next; |
---|
324 | m/RPMS(\d*)$/ or next; |
---|
325 | print LOG "auto_mode: adding $dir/$_\n"; |
---|
326 | unshift @rpms, "$dir/$_" |
---|
327 | } |
---|
328 | my ($name, $tag); |
---|
329 | if (-f "$repository/VERSION") { |
---|
330 | local *A; open A, "$repository/VERSION"; |
---|
331 | <A>; |
---|
332 | /^Mandrake Linux (.*) \d{8} \d{2}:\d{2}$/; |
---|
333 | ($name,$tag) = split ' ', $1 |
---|
334 | } |
---|
335 | $name ||= "Cooker"; |
---|
336 | $config{name} = $name; |
---|
337 | foreach (keys %$opt) { $config{list}[1]{$_} = $opt->{$_} } |
---|
338 | $config{list}[1]{auto} = 1; |
---|
339 | foreach (keys %{$config{list}[1]}) { print LOG "auto_mode: list options $_ -> $config{list}[1]{$_}\n" } |
---|
340 | foreach (@rpms) { |
---|
341 | # $size += du($_); |
---|
342 | push @{$config{list}[1]{packages}}, [$_ , @rpms] |
---|
343 | } |
---|
344 | my %cd = (1 => 2); |
---|
345 | my @cd = 1; |
---|
346 | #print LOG "Total RPMS $size\n"; |
---|
347 | $config{disc}[1]{size} = $config{discsize}; |
---|
348 | $config{disc}[1]{serial} = "${name}-disc1"; |
---|
349 | $config{disc}[1]{name} = 1; |
---|
350 | $config{disc}[1]{longname} = "MandrakeLinux $name"; |
---|
351 | $config{disc}[1]{appname} = "MandrakeLinux $name disc 1"; |
---|
352 | $config{disc}[1]{label} = substr "MandrakeLinux-$name-1.i586", 0, 32; |
---|
353 | my $idx = 1; |
---|
354 | my %idx; |
---|
355 | &{$functions->{dir}[0][5]}(1,$idx, "rpms", "Mandrake/RPMS"); |
---|
356 | $idx++; |
---|
357 | &{$functions->{generic}[0][5]}(1,$idx, "rpms",1); |
---|
358 | $idx++; |
---|
359 | $idx{installation} = $idx; |
---|
360 | &{$functions->{installation}[0][5]}(1,$idx); |
---|
361 | &{$functions->{installation}[5][5]}(1,$idx, "$repository"); |
---|
362 | &{$functions->{installation}[10][5]}(1,$idx, "$tag"); |
---|
363 | &{$functions->{installation}[18][5]}(1,$idx, "1/rpms"); |
---|
364 | $idx++; |
---|
365 | &{$functions->{boot}[0][5]}(1,$idx); |
---|
366 | if (-w "$repository/isolinux/isolinux.bin" && !$opt->{noisolinux}) { |
---|
367 | &{$functions->{boot}[1][5]}(1,$idx, { isolinux => 1 }, "isolinux"); |
---|
368 | &{$functions->{boot}[2][5]}(1,$idx, { bootimg => 1 }, "isolinux/isolinux.bin"); |
---|
369 | &{$functions->{boot}[5][5]}(1,$idx, "$repository/isolinux"); |
---|
370 | $idx++; |
---|
371 | &{$functions->{cp}[0][5]}(1,$idx, "$repository/images", "images/"); |
---|
372 | } else { |
---|
373 | &{$functions->{boot}[2][5]}(1,$idx, { bootimg => 1, dir => "Boot" }, "images/cdrom.img"); |
---|
374 | &{$functions->{boot}[4][5]}(1,$idx, "$repository/images"); |
---|
375 | } |
---|
376 | if ($opt->{sources}) { |
---|
377 | $config{nosrcfit} = 0; |
---|
378 | if ($opt->{sources}{separate}) { |
---|
379 | $config{disc}[2]{size} = $config{discsize}; |
---|
380 | $config{disc}[2]{serial} = "${name}-disc2-sources"; |
---|
381 | $config{disc}[2]{name} = 2; |
---|
382 | $config{disc}[2]{longname} = "MandrakeLinux $name sources"; |
---|
383 | $config{disc}[1]{appname} = "MandrakeLinux $name sources disc 2"; |
---|
384 | push @cd,2; |
---|
385 | $cd{2} = 2; |
---|
386 | &{$functions->{dir}[0][5]}(2,1, "srpms", "Mandrake/SRPMS"); |
---|
387 | &{$functions->{generic}[0][5]}(2,2, "srpms",1); |
---|
388 | &{$functions->{generic}[1][5]}(2,2, { source => 1 }); |
---|
389 | &{$functions->{installation}[17][5]}(1, $idx{installation}, "2/srpms") |
---|
390 | } else { |
---|
391 | $idx++; |
---|
392 | &{$functions->{dir}[0][5]}(1,$idx, "srpms", "Mandrake/SRPMS"); |
---|
393 | $idx++; |
---|
394 | &{$functions->{generic}[0][5]}(1,$idx, "srpms",1); |
---|
395 | &{$functions->{generic}[1][5]}(1,$idx, { source => 1 }); |
---|
396 | &{$functions->{installation}[17][5]}(1, $idx{installation}, "1/srpms") |
---|
397 | } |
---|
398 | } else { |
---|
399 | &{$functions->{installation}[6][5]}(1,$idx) |
---|
400 | } |
---|
401 | printTable(\%config); |
---|
402 | $config{group}->makeWithGroups(\%cd, \@cd); |
---|
403 | 1 |
---|
404 | } |
---|
405 | |
---|
406 | sub make { |
---|
407 | my ($cds) = @_; |
---|
408 | $config{group}->makeWithGroups(getDiscsList($cds)); |
---|
409 | 1 |
---|
410 | } |
---|
411 | |
---|
412 | sub oem { |
---|
413 | my (@cds) = @_; |
---|
414 | } |
---|
415 | |
---|
416 | sub check_discs { |
---|
417 | my ($mntpt, $mdfile) = @_; |
---|
418 | local *A; open A, "$mdfile"; |
---|
419 | my %ignore; |
---|
420 | my $sum; |
---|
421 | while (<A>) { |
---|
422 | chomp; |
---|
423 | last if ($sum) = /^(.*) - .*$/; |
---|
424 | my $t = "/$_"; |
---|
425 | $t =~ s/\/\/+/\//g; |
---|
426 | $ignore{$t} = 1 |
---|
427 | } |
---|
428 | close A; |
---|
429 | my $hexdigest = compute_md5([[ "/", $mntpt ]], \%ignore); |
---|
430 | if ($hexdigest eq $sum) { |
---|
431 | print "\nOK ($hexdigest)\n" |
---|
432 | } else { |
---|
433 | print "\nFAILED (computed $hexdigest <> expected $sum)\n"; |
---|
434 | return 0 |
---|
435 | } |
---|
436 | 1 |
---|
437 | } |
---|
438 | |
---|
439 | # |
---|
440 | # Changeloh |
---|
441 | # |
---|
442 | # 2002 03 15 |
---|
443 | # new sources handling |
---|
444 | # |
---|
445 | # 2002 03 19 |
---|
446 | # cdcom are now handled as normal list, so that deps are not forced. |
---|
447 | # |
---|
448 | # 2002 03 23 |
---|
449 | # change Group.pm getAlone to work with alone group. |
---|
450 | # |
---|
451 | # 2002 03 29 |
---|
452 | # fix a bug in Functions.pm for nolive mode and rpmsrate |
---|
453 | # |
---|
454 | # 2002 04 12 |
---|
455 | # oem mode |
---|
456 | # |
---|
457 | # 2002 05 02 |
---|
458 | # add separate mode for auto sources mode |
---|
459 | # |
---|
460 | # 2002 05 07 |
---|
461 | # add check_discs |
---|
462 | # |
---|
463 | # 2002 05 09 |
---|
464 | # check_discs, compute_md5, md5_add_tree |
---|
465 | # |
---|
466 | # 2002 05 13 |
---|
467 | # fix fentry problem in List.pm that create the "needed spreading" problem |
---|
468 | # |
---|
469 | # 2002 06 01 |
---|
470 | # first draft for new needed code |
---|
471 | # new perl-URPM |
---|
472 | # |
---|
473 | # 2002 06 01 |
---|
474 | # fix perl-URPM integration |
---|
475 | # |
---|
476 | # 2002 06 15 |
---|
477 | # begin new diff mode. |
---|
478 | # |
---|
479 | # 2002 08 12 |
---|
480 | # change clean_rpmsrate |
---|
481 | # |
---|
482 | # 2002 08 19 |
---|
483 | # start optimize_space for sources moving |
---|
484 | # change diff structure |
---|
485 | # change process_diff |
---|
486 | # |
---|
487 | # 2002 08 20 |
---|
488 | # some interlist and intergroup binaries moving in optimize_space |
---|
489 | # |
---|
490 | # 2002 08 25 |
---|
491 | # various update of optimize_space |
---|
492 | # new needed and deps handling in optimize_space |
---|
493 | # |
---|
494 | # 2002 08 29 |
---|
495 | # prepare_cloned_disc enhanced |
---|
496 | # add disc_prereq data in groups for cloned discs |
---|
497 | # |
---|
498 | # 20020918 |
---|
499 | # fixes in optimize_space |
---|
500 | # |
---|
501 | # 20020930 |
---|
502 | # fix help mode for options with extra options such as auto |
---|