--- a/bin/imager.save Tue Aug 23 11:18:20 2011 +0200
+++ b/bin/imager.save Thu Aug 25 22:05:26 2011 +0200
@@ -19,9 +19,8 @@
use constant KiB => 1024;
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 DATEFMT => "%Y-%m-%dT%H:%M:%SZ";
use constant CIPHER => "aes-128-cbc";
sub get_devsize;
@@ -36,6 +35,7 @@
blocksize => BS,
pass => undef,
comment => undef,
+ now => time(),
);
lock_keys(%o);
@@ -52,6 +52,7 @@
"c|comment=s" => \$o{comment},
"z|compress:i" => sub { $o{compress} = $_[1] ? $_[1] : Z_BEST_SPEED },
"p|pass=s" => \$o{pass},
+ "now=i" => \$o{now},
"b|blocksize=s" => sub {
given ($_[1]) {
when (/(\d+)G/i) { $o{blocksize} = $1 * GiB };
@@ -117,8 +118,8 @@
filesystem => $src,
blocksize => $o{blocksize},
devsize => $size,
- timestamp => NOW,
- datetime => DATETIME,
+ timestamp => $o{now},
+ datetime => strftime(DATEFMT => gmtime $o{now}),
(defined $o{comment} ? (comment => $o{comment}) : ()),
encryption => $o{pass} ? CIPHER : "none",
};
@@ -219,7 +220,7 @@
"",
@{ $index{BLOCKS} };
close($index);
- rename $index->filename => "$idx/" . DATETIME;
+ rename $index->filename => "$idx/" . strftime(DATEFMT => gmtime $o{now});
say "# $src DONE (runtime " . (time() - $^T) . "s)";
say "# $src WRITTEN $stats{written}, SKIPPED $stats{skipped} blocks";
@@ -279,6 +280,10 @@
Comment to be included in the header of the index file. (default: none)
+=item B<--now> I<timestamp>
+
+Set the timestamp used for naming the idx files. (default: now)
+
=item B<-p>|B<--pass> I<pass>
Use symmetric encryption for writing the data blocks. This option