diff -r c12fa4d32903 -r 2a7ab8422dd6 bin/imager.restore --- a/bin/imager.restore Wed Aug 17 09:33:59 2011 +0200 +++ b/bin/imager.restore Wed Aug 17 12:10:20 2011 +0200 @@ -17,7 +17,7 @@ use Pod::Usage; use Getopt::Long; use Hash::Util qw(lock_keys); -use IO::Uncompress::Gunzip qw(gunzip $GunzipError); +use Imager; use constant KiB => 1024; use constant MiB => 1024 * KiB; @@ -67,48 +67,19 @@ while (<$fh>) { next if /^#/; my ($blk, $hash, $path) = split; - my ($in, $buffer); - - if (-f "$data/$path") { - open($in => "$data/$path"); - binmode($in); - local $/ = undef; - $buffer = <$in>; - } + my $buffer; + if (-f "$data/$path") { Imager::get_block("$data/$path" => \$buffer) } elsif (-f "$data/$path.gz") { - open($in => "$data/$path.gz"); - binmode($in); - gunzip($in => \$buffer) - or die $GunzipError; + Imager::get_block("$data/$path.gz" => \$buffer); } elsif (-f "$data/$path.x") { - open($in, - "openssl @{[CIPHER]} -d -pass $o{pass} -in '$data/$path.x'|"); - binmode($in); - local $/ = undef; - $buffer = <$in>; + Imager::get_block("$data/$path.x" => \$buffer); } elsif (-f "$data/$path.gz.x") { - open($in, - "openssl @{[CIPHER]} -d -pass $o{pass} -in $data/$path.gz.x|"); - binmode($in); - gunzip($in => \$buffer) - or die $GunzipError; + Imager::get_block("$data/$path.gz.x" => \$buffer); } - elsif (-f "$data/$path.x.gz") { - warn "$data/$path.x.gz: depreciated!\n"; - open($in, -"gzip -d -c $data/$path.x.gz | openssl @{[CIPHER]} -d -pass $o{pass}|" - ); - binmode($in); - local $/ = undef; - $buffer = <$in>; - } - else { - die ME . ": Can't open $data/$path: $!\n"; - } + else { die ME . ": Can't open $data/$path: $!\n" } print {$out} $buffer; - close($in); } close($out); close($fh);