Imported Upstream version 3.3.3
[debian/amanda] / server-src / amrestore.pl
index 879aec434f1431460b8a2afe531d22e1eb764160..b9cde45d12add14f8ba59c86389d1ed5776fc6c3 100644 (file)
@@ -1,9 +1,10 @@
 #! @PERL@
 # 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 <<EOF;
 Usage: amrestore [--config config] [-b blocksize] [-r|-c|-C] [-p] [-h]
-    [-f filenum] [-l label] [-o configoption]*
+    [-f filenum] [-l label] [--exact-match] [-o configoption]*
     {device | [--holding] holdingfile}
     [hostname [diskname [datestamp [hostname [diskname [datestamp ... ]]]]]]"));
 EOF
@@ -57,7 +58,7 @@ Amanda::Util::setup_application("amrestore", "server", $CONTEXT_CMDLINE);
 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);
+    $opt_pipe, $opt_header, $opt_filenum, $opt_label, $opt_holding, $opt_restore_src, $opt_exact_match);
 
 debug("Arguments: " . join(' ', @ARGV));
 Getopt::Long::Configure(qw(bundling));
@@ -66,6 +67,7 @@ GetOptions(
     '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,
@@ -87,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);