# HG changeset patch # User Heiko Schlittermann (JUMPER) # Date 1312149297 -7200 # Node ID 8b655cc9bd2794bd0cd8c3fa8265a09e87692436 # Parent 9362fac2a7c81dfe1702f992213fc853315c149e t diff -r 9362fac2a7c8 -r 8b655cc9bd27 bin/imager.save --- a/bin/imager.save Sun Jul 31 23:47:09 2011 +0200 +++ b/bin/imager.save Sun Jul 31 23:54:57 2011 +0200 @@ -51,9 +51,9 @@ -noperldoc => system("perldoc -V >/dev/null 2>&1") ); }, - "t|threads:i" => sub { $o{threads} = $_[1] ? $_[1] : 2 }, - "c|comment=s" => \$o{comment}, - "z|compress:i" => sub { $o{compress} = $_[1] ? $_[1] : Z_BEST_SPEED }, + "t|threads:i" => sub { $o{threads} = $_[1] ? $_[1] : 2 }, + "c|comment=s" => \$o{comment}, + "z|compress:i" => sub { $o{compress} = $_[1] ? $_[1] : Z_BEST_SPEED }, "p|pass=s" => \$o{pass}, "b|blocksize=s" => sub { given ($_[1]) { @@ -105,15 +105,15 @@ my %index; $index{META} = { - format => 1, - host => hostname, - filesystem => $src, - blocksize => $o{blocksize}, - devsize => $size, - timestamp => NOW, - datetime => DATETIME, - (defined $o{comment} ? (comment => $o{comment}) : ()), - encryption => $o{pass} ? CIPHER : "none", + format => 1, + host => hostname, + filesystem => $src, + blocksize => $o{blocksize}, + devsize => $size, + timestamp => NOW, + datetime => DATETIME, + (defined $o{comment} ? (comment => $o{comment}) : ()), + encryption => $o{pass} ? CIPHER : "none", }; open(my $in => $src); @@ -151,8 +151,8 @@ $ext .= $o{pass} ? ".x" : ""; # the extension we do not put into the index - push @{$index{BLOCKS}}, - sprintf "%12d %s %s" => ($. - 1), $cs, $file; + push @{ $index{BLOCKS} }, sprintf "%12d %s %s" => ($. - 1), + $cs, $file; if ( not( -e "$data/$file" @@ -183,7 +183,7 @@ else { print {$out} $buffer } close($out); rename($out => "$data/$file$ext"); - $index{BLOCKS}[$. - 1] .= " *"; + $index{BLOCKS}[$. - 1] .= " *"; $stats{written}++; } else { @@ -193,15 +193,14 @@ $SIG{ALRM}->(); alarm 0; - $index{META}{blocks} = @{$index{BLOCKS}}; + $index{META}{blocks} = @{ $index{BLOCKS} }; $index{META}{runtime} = time() - $^T . "s"; my $index = File::Temp->new(DIR => $idx); - say $index join "\n" => - "# imager", - (map { "$_: $index{META}{$_}" } sort(keys %{$index{META}})), - "", - @{$index{BLOCKS}}; + say $index join "\n" => "# imager", + (map { "$_: $index{META}{$_}" } sort(keys %{ $index{META} })), + "", + @{ $index{BLOCKS} }; close($index); rename $index->filename => "$idx/" . DATETIME;