copycds to do percentages

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1556 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
vallard 2008-06-02 20:27:02 +00:00
parent 1dacdc3b21
commit 6112f5b8b3

View File

@ -793,6 +793,7 @@ sub copycd
};
my $KID;
chdir $path;
my $numFiles = `find . -print | wc -l`;
my $child = open($KID, "|-");
unless (defined $child)
{
@ -813,7 +814,19 @@ sub copycd
else
{
nice 10;
exec "nice -n 20 cpio -dump $installroot/$distname/$arch";
my $c = "nice -n 20 cpio -vdump $installroot/$distname/$arch";
open(PIPE, "$c 2>&1 |") ||
$callback->({error => "Media copy operation fork failure"});
my $copied = 0;
my ($percent, $fout);
while(<PIPE>){
next if /^cpio:/;
$percent = $copied / $numFiles;
$fout = sprintf "%0.2f%%", $percent * 100;
$callback->({sinfo => "$fout"});
++$copied;
}
exit;
}
#my $rc = system("cd $path; find . | nice -n 20 cpio -dump $installroot/$distname/$arch");