Imported Upstream version 3.3.2
[debian/amanda] / server-src / amrestore.pl
index d7f2421dd6e796539ddb12698323dbf009fb0241..879aec434f1431460b8a2afe531d22e1eb764160 100644 (file)
@@ -1,5 +1,5 @@
 #! @PERL@
-# Copyright (c) 2009, 2010 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2009-2012 Zmanda, Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
@@ -58,6 +58,8 @@ my $config_overrides = new_config_overrides($#ARGV+1);
 
 my ($opt_config, $opt_blocksize, $opt_raw, $opt_compress, $opt_compress_best,
     $opt_pipe, $opt_header, $opt_filenum, $opt_label, $opt_holding, $opt_restore_src);
+
+debug("Arguments: " . join(' ', @ARGV));
 Getopt::Long::Configure(qw(bundling));
 GetOptions(
     'version' => \&Amanda::Util::version_opt,
@@ -171,6 +173,16 @@ sub main {
        return failure($err, $finished_cb) if $err;
 
        $dev = $res->{'device'};
+
+       if ($opt_blocksize) {
+           if ( !$dev->property_set("BLOCK_SIZE", $opt_blocksize)) {
+               return failure($dev->error_or_status, $finished_cb);
+           }
+
+           # re-read the label with the correct blocksize
+           $dev->read_label();
+       }
+
        if ($dev->status != $DEVICE_STATUS_SUCCESS) {
            return failure($dev->error_or_status, $finished_cb);
        }