#!/bin/sh
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
) {
s/\s*\n$//;
$package= $_ if s/^Package: //i;
@filename= split(/ /,$_) if s/^Filename: //i;
@msdosfilename= split(/ /,$_) if s/^MSDOS-Filename: //i;
}
die "internal error - no package" if length($package) == 0;
die "internal error - no filename" if not @filename;
die "internal error - mismatch >@filename< >@msdosfilename<"
if @filename && @msdosfilename &&
@filename != @msdosfilename;
@invoke=(); $|=1;
for ($i=0; $i<=$#filename; $i++) {
$ppart= $i+1;
print "Looking for part $ppart of $package ... ";
if (-f "$binaryprefix$filename[$i]") {
$print= $filename[$i];
$invoke= "$binaryprefix$filename[$i]";
} elsif (-f "$binaryprefix$msdosfilename[$i]") {
$print= $msdosfilename[$i];
$invoke= "$binaryprefix$msdosfilename[$i]";
} else {
$base= $filename[$i]; $base =~ s,.*/,,;
$msdosbase= $msdosfilename[$i]; $msdosbase =~ s,.*/,,;
$c = open(X, "-|"));
if (not defined $c) {
die "failed to fork for find: $!\n";
}
if (!$c) {
exec("find", "-L",
length($binaryprefix) ?
$binaryprefix : ".",
"-name",$base,"-o","-name",$msdosbase);
die "failed to exec find: $!\n";
}
while (chop($invoke=