--- a/bin/imager.check Sun Jul 31 23:22:07 2011 +0200
+++ b/bin/imager.check Sun Jul 31 23:22:59 2011 +0200
@@ -133,11 +133,11 @@
# we don't need uncompressed files if an compressed version
# exists
unlink $_ and return if -f "$_.gz";
- unlink "$_.x" and return if -f "$_.x.gz";
+ unlink "$_.x" and return if -f "$_.x.gz";
- # 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";
+ # 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
@@ -207,9 +207,9 @@
next
if -f "$dir/data/$k"
or -f "$dir/data/$k.gz"
- or -f "$dir/data/$k.x"
- or -f "$dir/data/$k.x.gz"
- or -f "$dir/data/$k.gz.x";
+ or -f "$dir/data/$k.x"
+ or -f "$dir/data/$k.x.gz"
+ or -f "$dir/data/$k.gz.x";
say "missing $k @$i";
@invalid{@$i} = ();
}
--- a/bin/imager.fuse Sun Jul 31 23:22:07 2011 +0200
+++ b/bin/imager.fuse Sun Jul 31 23:22:59 2011 +0200
@@ -22,8 +22,8 @@
);
lock_keys %o;
-use constant ME => basename $0;
-use constant BS => 4 * 1024;
+use constant ME => basename $0;
+use constant BS => 4 * 1024;
use constant CIPHER => "aes-128-cbc";
my ($DATA, $IDX);
@@ -48,9 +48,9 @@
"d|debug!" => \$o{debug},
"detach!" => \$o{detach},
"tmp:s" => sub { $o{tmp} = length $_[1] ? $_[1] : $ENV{TMP} // "/tmp" },
- "h|help" => sub { pod2usage(-verbose => 1, -exit => 0) },
- "p|pass=s" => \$o{pass},
- "m|man" => sub {
+ "h|help" => sub { pod2usage(-verbose => 1, -exit => 0) },
+ "p|pass=s" => \$o{pass},
+ "m|man" => sub {
pod2usage(
-verbose => 2,
-exit => 0,
@@ -230,28 +230,36 @@
gunzip($fh => \$cache{data})
or die $GunzipError;
}
- elsif (-e "$fn.x") {
- open(my $fh => "openssl @{[CIPHER]} -d -pass '$o{pass}' -in '$fn.x'|");
- binmode($fh);
- local $/ = undef;
- $cache{data} = <$fh>;
- close($fh);
- }
- elsif (-e "$fn.gz.x") {
- open(my $fh => "openssl @{[CIPHER]} -d -pass '$o{pass}' -in '$fn.gz.x'|");
- binmode($fh);
- gunzip($fh => \$cache{data})
- or die $GunzipError;
- close($fh);
- }
- elsif (-e "$fn.x.gz") {
- warn "$fn.x.gz is depreciated!\n";
- open(my $fh => "zcat $fn.x.gz | openssl @{[CIPHER]} -d -pass '$o{pass}'|");
- binmode($fh);
- local $/ = undef;
- $cache{data} = <$fh>;
- close($fh);
- }
+ elsif (-e "$fn.x") {
+ open(
+ my $fh =>
+ "openssl @{[CIPHER]} -d -pass '$o{pass}' -in '$fn.x'|");
+ binmode($fh);
+ local $/ = undef;
+ $cache{data} = <$fh>;
+ close($fh);
+ }
+ elsif (-e "$fn.gz.x") {
+ open(
+ my $fh =>
+ "openssl @{[CIPHER]} -d -pass '$o{pass}' -in '$fn.gz.x'|"
+ );
+ binmode($fh);
+ gunzip($fh => \$cache{data})
+ or die $GunzipError;
+ close($fh);
+ }
+ elsif (-e "$fn.x.gz") {
+ warn "$fn.x.gz is depreciated!\n";
+ open(
+ my $fh =>
+ "zcat $fn.x.gz | openssl @{[CIPHER]} -d -pass '$o{pass}'|"
+ );
+ binmode($fh);
+ local $/ = undef;
+ $cache{data} = <$fh>;
+ close($fh);
+ }
$cache{fn} = $fn;
}
--- a/bin/imager.restore Sun Jul 31 23:22:07 2011 +0200
+++ b/bin/imager.restore Sun Jul 31 23:22:59 2011 +0200
@@ -5,7 +5,7 @@
# 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
+# elif test -f DATA/$f.x.gz then zcat DATA/$f.x.gz | openssl aes-128-cbs -d
# fi
# done
@@ -20,10 +20,10 @@
use Hash::Util qw(lock_keys);
use IO::Uncompress::Gunzip qw(gunzip $GunzipError);
-use constant KiB => 1024;
-use constant MiB => 1024 * KiB;
-use constant GiB => 1024 * MiB;
-use constant ME => basename $0;
+use constant KiB => 1024;
+use constant MiB => 1024 * KiB;
+use constant GiB => 1024 * MiB;
+use constant ME => basename $0;
use constant CIPHER => "aes-128-cbc";
my %o = (pass => "stdin");
@@ -83,13 +83,15 @@
or die $GunzipError;
}
elsif (-f "$data/$path.x") {
- open($in, "openssl @{[CIPHER]} -d -pass $o{pass} -in '$data/$path.x'|");
+ open($in,
+ "openssl @{[CIPHER]} -d -pass $o{pass} -in '$data/$path.x'|");
binmode($in);
local $/ = undef;
$buffer = <$in>;
}
elsif (-f "$data/$path.gz.x") {
- open($in, "openssl @{[CIPHER]} -d -pass $o{pass} -in $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;
@@ -97,7 +99,8 @@
elsif (-f "$data/$path.x.gz") {
warn "$data/$path.x.gz: depreciated!\n";
open($in,
- "gzip -d -c $data/$path.x.gz | openssl @{[CIPHER]} -d -pass $o{pass}|");
+"gzip -d -c $data/$path.x.gz | openssl @{[CIPHER]} -d -pass $o{pass}|"
+ );
binmode($in);
local $/ = undef;
$buffer = <$in>;
--- 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(