X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=server-src%2Famrestore.pl;h=b9cde45d12add14f8ba59c86389d1ed5776fc6c3;hb=HEAD;hp=d7f2421dd6e796539ddb12698323dbf009fb0241;hpb=99080c663209a733fd597a2fcab96a45c9c41291;p=debian%2Famanda diff --git a/server-src/amrestore.pl b/server-src/amrestore.pl index d7f2421..b9cde45 100644 --- a/server-src/amrestore.pl +++ b/server-src/amrestore.pl @@ -1,9 +1,10 @@ #! @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 -# by the Free Software Foundation. +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -42,7 +43,7 @@ sub usage { print STDERR "$msg\n" if $msg; print STDERR < \&Amanda::Util::version_opt, 'help|usage|?' => \&usage, 'config=s' => \$opt_config, 'holding' => \$opt_holding, + 'exact-match' => \$opt_exact_match, 'b=i' => \$opt_blocksize, 'r' => \$opt_raw, 'c' => \$opt_compress, @@ -85,8 +89,9 @@ if (!$opt_holding) { if (Amanda::Holding::get_header($opt_restore_src)); } -my @opt_dumpspecs = Amanda::Cmdline::parse_dumpspecs([@ARGV], - $Amanda::Cmdline::CMDLINE_PARSE_DATESTAMP); +my $cmd_flags = $Amanda::Cmdline::CMDLINE_PARSE_DATESTAMP; +$cmd_flags |= $Amanda::Cmdline::CMDLINE_EXACT_MATCH if $opt_exact_match; +my @opt_dumpspecs = Amanda::Cmdline::parse_dumpspecs([@ARGV], $cmd_flags); usage("Cannot check a label on a holding-disk file") if ($opt_holding and $opt_label); @@ -171,6 +176,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); }