prepared the info/ directory, but it's not used currently
authorHeiko Schlittermann (JUMPER) <hs@schlittermann.de>
Sun, 31 Jul 2011 23:22:07 +0200
changeset 43 27f0c30c5240
parent 42 b5db10953648
child 44 f1fea4381014
prepared the info/ directory, but it's not used currently
bin/imager.save
--- a/bin/imager.save	Sun Jul 31 22:58:30 2011 +0200
+++ b/bin/imager.save	Sun Jul 31 23:22:07 2011 +0200
@@ -19,6 +19,7 @@
 use constant MiB      => 1024 * KiB;
 use constant GiB      => 1024 * MiB;
 use constant NOW      => time();
+use constant BS	      => 4 * MiB;
 use constant DATETIME => strftime("%Y-%m-%dT%H:%M:%SZ" => gmtime(NOW));
 use constant CIPHER   => "aes-128-cbc";
 
@@ -31,7 +32,7 @@
 my %o = (
     compress  => undef,
     verbose   => undef,
-    blocksize => 4 * MiB,
+    blocksize => BS,
     pass      => undef,
     comment   => undef,
 );
@@ -87,9 +88,11 @@
     my ($src, $dst) = @_;
     my $idx  = "{DIR}/idx/{HOSTNAME}/{DEVICE}/";
     my $data = "{DIR}/data";
+    my $info = "{DIR}/data/info";
     my $size;
 
-    foreach ($idx, $data) {
+
+    foreach ($idx, $data, $info) {
         s/{DIR}/$dst/g;
         s/{HOSTNAME}/hostname/eg;
         s/{DEVICE}/get_devname($src)/eg;
@@ -97,7 +100,7 @@
     $size = get_devsize($src);
 
     -d $dst or die "$0: $dst: $!\n";
-    mkpath([$data, $idx]);
+    mkpath([$data, $idx, $info]);
 
     my $index = File::Temp->new(DIR => $idx);
     print {$index} <<__EOT;
@@ -116,7 +119,7 @@
 
     open(my $in => $src);
     binmode($in);
-    local $/ = \(my $bs = $o{blocksize});
+    local $/ = \$o{blocksize};
     local $| = 1;
 
     my %stats = (
@@ -246,7 +249,8 @@
 
 =item B<-b> I<blocksize> | B<--blocksize>=I<blocksize>
 
-The blocksize used. (may be suffixed with K, M, G). (default: 4 MiB)
+The blocksize used. (may be suffixed with K, M, G). (default: 4 MiB,
+or taken from F<data/info/blocksize>)
 
 =item B<-c> I<comment> | B<--comment>=I<comment>