bin/imager.restore
branchtesting
changeset 38 fac6d76d06e8
parent 37 cb50d6c57439
child 42 b5db10953648
--- 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";
         }