--- a/bin/imager.restore Sat Jul 25 17:16:13 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-#! /usr/bin/perl
-# Eigentlich geht das selbe mit:
-# grep '^[[:space:]]*[[:digit:]]' IDX-file | tr -d | cut -f4 -d' ' | while read f; do
-# if test -f DATA/$f then cat $f
-# elif test -f DATA/$f.gz then zcat DATA/$f.gz
-# elif test -f DATA/$f.x then openssl aes-128-cbc -d -in DATA/$f.x
-# elif test -f DATA/$f.gz.x then openssl aes-128-cbc -d -in DATA/$f.gz.x | zcat
-# elif test -f DATA/$f.x.gz then zcat DATA/$f.x.gz | openssl aes-128-cbs -d
-# fi
-# done
-
-use 5.010;
-use strict;
-use warnings;
-use File::Basename;
-use autodie qw(:all);
-use Pod::Usage;
-use Getopt::Long;
-use Hash::Util qw(lock_keys);
-use Imager;
-
-use constant KiB => 1024;
-use constant MiB => 1024 * KiB;
-use constant GiB => 1024 * MiB;
-use constant ME => basename $0;
-use constant CIPHER => "aes-128-cbc";
-
-my %o = (pass => "stdin");
-lock_keys(%o);
-
-sub find_data_dir;
-
-MAIN: {
-
- Getopt::Long::Configure(qw(Bundling));
- GetOptions(
- "p|pass=s" => \$o{pass},
- "h|help" => sub { pod2usage(-verbose => 1, -exit => 0) },
- "m|man" => sub {
- pod2usage(
- -verbose => 2,
- -exit => 0,
- -noperldoc => system(
- "perldoc -V 1>/dev/null
- 2>&1"
- )
- );
- },
- )
- and @ARGV == 2
- or pod2usage;
-
- my $idx = shift;
- my $dst = shift;
- my $blocksize = undef;
- my $data = find_data_dir($idx);
-
- open(my $fh => $idx);
- { local $/ = ""; $_ = <$fh>; }
- /^format:\s*1$/m or die ME . ": expected index format 1\n";
- ($blocksize) = /^blocksize:\s*(\d+)/m or die ME . ": no blocksize found\n";
-
- my $out;
- if ($dst eq "-") { open($out => ">&STDOUT") }
- else { open($out => ">", $dst) }
-
- while (<$fh>) {
- next if /^#/;
- my ($blk, undef, $path) = split;
- my $buffer;
- Imager::get_block("$data/$path*" => \$buffer);
- print {$out} $buffer;
- }
- close($out);
- close($fh);
-}
-
-sub find_data_dir {
- for (my $dir = shift ; $dir ne "/" ; $dir = dirname $dir) {
- return "$dir/data" if -d "$dir/data" and -d "$dir/idx";
- }
- die ME . ": no data directory found!\n";
-}
-
-__END__
-
-=head1 NAME
-
- imager.restore - cats the blocks of the imager
-
-=head1 SYNOPSIS
-
- imager.restore [options] {idx} {destination}
-
-=head1 DESCRIPTION
-
-The B<imager.restore> takes all the blocks from the IDX file and
-cats them as one data stream. The destination can be any block device,
-a file name or even B<-> (STDOUT).
-
-=head1 OPTIONS
-
-=over
-
-=item B<-p>|B<--pass> I<pass>
-
-In case you expect encrypted data, this option takes the argument for
-B<openssl>'s C<-pass> option. See L<openssl(1)> for mor information.
-(default: stdin)
-
-=item B<-h>|B<--help>
-
-=item B<-m>|B<--man>
-
-The standard help options.
-
-=back
-
-=cut