Merge tag 'upstream/3.3.3'
[debian/amanda] / server-src / amlabel.pl
index 77a5115c49e4b61825d43203ba8032266f2fe066..ce07c8cba7589f75a2ae1be61fd79ef27d6d7f0a 100644 (file)
@@ -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
@@ -57,8 +58,11 @@ $opt_force = 0;
 $opt_barcode = undef;
 $opt_meta = undef;
 $opt_assign = undef;
+
+debug("Arguments: " . join(' ', @ARGV));
 Getopt::Long::Configure(qw(bundling));
 GetOptions(
+    'version' => \&Amanda::Util::version_opt,
     'help|usage|?' => \&usage,
     'o=s'        => sub { add_config_override_opt($config_overrides, $_[1]); },
     'f'          => \$opt_force,
@@ -68,7 +72,7 @@ GetOptions(
     'version'    => \&Amanda::Util::version_opt,
 ) or usage();
 
-if ($opt_assign && (!$opt_meta || !$opt_barcode)) {
+if ($opt_assign && (!$opt_meta and !$opt_barcode)) {
     print STDERR "--assign require --barcode or --meta\n";
     usage();
 }
@@ -297,7 +301,7 @@ sub main {
            # update the tapelist
            $tl->reload(1);
            $tl->remove_tapelabel($label);
-           $tl->add_tapelabel("0", $label, undef, 1, $meta, $res->{'barcode'});
+           $tl->add_tapelabel("0", $label, undef, 1, $meta, $res->{'barcode'}, $dev->block_size/1024);
            $tl->write();
 
            print "Success!\n";