bin/imager.save
changeset 44 f1fea4381014
parent 43 27f0c30c5240
child 45 9362fac2a7c8
--- a/bin/imager.save	Sun Jul 31 23:22:07 2011 +0200
+++ b/bin/imager.save	Sun Jul 31 23:22:59 2011 +0200
@@ -19,7 +19,7 @@
 use constant MiB      => 1024 * KiB;
 use constant GiB      => 1024 * MiB;
 use constant NOW      => time();
-use constant BS	      => 4 * MiB;
+use constant BS       => 4 * MiB;
 use constant DATETIME => strftime("%Y-%m-%dT%H:%M:%SZ" => gmtime(NOW));
 use constant CIPHER   => "aes-128-cbc";
 
@@ -50,9 +50,9 @@
                 -noperldoc => system("perldoc -V >/dev/null 2>&1")
             );
         },
-	"c|comment=s" => \$o{comment},
-        "z|compress:i" => sub { $o{compress} = $_[1] ? $_[1] : Z_BEST_SPEED },
-	"p|pass=s"  => \$o{pass},
+        "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]) {
                 when (/(\d+)G/i) { $o{blocksize} = $1 * GiB };
@@ -91,7 +91,6 @@
     my $info = "{DIR}/data/info";
     my $size;
 
-
     foreach ($idx, $data, $info) {
         s/{DIR}/$dst/g;
         s/{HOSTNAME}/hostname/eg;
@@ -147,27 +146,30 @@
         my ($file, $ext, $cs);
         $file = $cs = md5_hex($buffer);
         $file =~ s/(?<fn>(?<prefix>...).*)/$+{prefix}\/$+{fn}/g;
-	$ext = "";
+        $ext = "";
         $ext .= $o{compress} ? ".gz" : "";
-	$ext .= $o{pass} ? ".x" : "";
+        $ext .= $o{pass}     ? ".x"  : "";
 
         # the extension we do not put into the index
         my $log = sprintf "%12d %s %s" => ($. - 1), $cs, $file;
 
-        if (not(-e "$data/$file" 
-	    or -e "$data/$file.gz"
-	    or -e "$data/$file.x"
-	    or -e "$data/$file.gz.x"
-	    or -e "$data/$file.x.gz")) {
+        if (
+            not(   -e "$data/$file"
+                or -e "$data/$file.gz"
+                or -e "$data/$file.x"
+                or -e "$data/$file.gz.x"
+                or -e "$data/$file.x.gz")
+          )
+        {
             mkpath dirname("$data/$file");
-	    my $out = File::Temp->new(
+            my $out = File::Temp->new(
                 TEMPLATE => ".XXXXXXX",
                 DIR      => dirname("$data/$file")
             );
 
-	    if ($o{pass}) {
-		open($out, "|openssl @{[CIPHER]} -pass $o{pass} -out $out");
-	    }
+            if ($o{pass}) {
+                open($out, "|openssl @{[CIPHER]} -pass $o{pass} -out $out");
+            }
             binmode($out);
             if ($o{compress}) {
                 gzip(