fully done the compression part testing
authorHeiko Schlittermann (JUMPER) <hs@schlittermann.de>
Sun, 31 Jul 2011 16:09:46 +0200
branchtesting
changeset 38 fac6d76d06e8
parent 37 cb50d6c57439
child 39 31906810aafb
fully done the compression part
bin/imager.check
bin/imager.restore
bin/imager.save
--- a/bin/imager.check	Sun Jul 31 15:03:06 2011 +0200
+++ b/bin/imager.check	Sun Jul 31 16:09:46 2011 +0200
@@ -135,12 +135,14 @@
             unlink $_ and return if -f "$_.gz";
 	    unlink "$_.x" and return if -f "$_.x.gz";
 
-	    # FIXME: do we need a compressed version?
+	    # the next step we can't do, because it can happen that
+	    # the restorer does not know about a password
+	    #unlink "$_.gz.x" and return if -f "$_.gz";
 
             # cut away the first part of the filename and
             # some optional extension
             (my $rn = $File::Find::name) =~ s/^$dir\/data\/(.*?)(?:\..+)?$/$1/;
-            exists $block{$rn} and return;
+            return if exists $block{$rn};
             push @unused, abs_path $File::Find::name;
             return;
 
--- a/bin/imager.restore	Sun Jul 31 15:03:06 2011 +0200
+++ b/bin/imager.restore	Sun Jul 31 16:09:46 2011 +0200
@@ -1,11 +1,12 @@
 #! /usr/bin/perl
 # Eigentlich geht das selbe mit:
 # grep '^[[:space:]]*[[:digit:]]' IDX-file | tr -d | cut -f4 -d' ' | while read f; do
-#	cat DATA/$f || zcat DATA/$f.gz
-# done
-# ODER
-# perl -ne '/^\s*\d/ and print "DATA/" . (split)[2] . "\n"' IDX-File | while read f; do
-#	cat DATA/$f || zcat DATA/$f.gz
+#       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;
@@ -87,20 +88,20 @@
             local $/ = undef;
             $buffer = <$in>;
         }
+        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;
+        }
         elsif (-f "$data/$path.x.gz") {
             warn "$data/$path.x.gz: depreciated!\n";
             open($in,
-                "gzip -d -c $data/$path.x.gz | openssl bf -d -pass $o{pass}|");
+                "gzip -d -c $data/$path.x.gz | openssl @{[CIPHER]} -d -pass $o{pass}|");
             binmode($in);
             local $/ = undef;
             $buffer = <$in>;
         }
-        elsif (-f "$data/$path.gz.x") {
-            open($in, "openssl bf -d -pass $o{pass} -in $data/$path.gz.x|");
-            binmode($in);
-            gunzip($in => \$buffer)
-              or die $GunzipError;
-        }
         else {
             die ME . ": Can't open $data/$path: $!\n";
         }
--- a/bin/imager.save	Sun Jul 31 15:03:06 2011 +0200
+++ b/bin/imager.save	Sun Jul 31 16:09:46 2011 +0200
@@ -240,13 +240,14 @@
 
 =over
 
-=item B<-b> I<blocksize>|B<--blocksize>=I<blocksize>
+=item B<-b> I<blocksize> | B<--blocksize>=I<blocksize>
 
 The blocksize used. (may be suffixed with K, M, G). (default: 4 MiB)
 
 =item B<-p> I<pass> | B<--pass>=I<pass>
 
-Use symmetric encryption for writing the data blocks.
+Use symmetric encryption for writing the data blocks. This option
+is passed to L<openssl(3)>.
 
 =item B<-z> [I<level>]|B<--compress>[=I<level>]