merge Arabic translation of debconf templates
[debian/amanda] / server-src / amlabel.pl
index e9920dba2af94ec5eb9f56545290daa0666ef1d2..f9103b8cb1f0d06cbadf0d5257d8376dc60fdeb4 100644 (file)
@@ -19,6 +19,7 @@
 
 use lib '@amperldir@';
 use strict;
+use warnings;
 
 use File::Basename;
 use Getopt::Long;
@@ -41,8 +42,7 @@ my $exit_status = 0;
 my %subcommands;
 
 sub usage {
-    print STDERR "Usage: amlabel <conf> <label> [slot <slot-number>] "
-              . "[-f] [-o configoption]*\n";
+    print STDERR "Usage: amlabel [-f] [-o configoption]* <conf> <label> [slot <slot-number>]\n";
     exit(1);
 }
 
@@ -113,7 +113,7 @@ sub main {
        }
 
        $tlf = Amanda::Config::config_dir_relative(getconf($CNF_TAPELIST));
-       $tl = Amanda::Tapelist::read_tapelist($tlf);
+       $tl = Amanda::Tapelist->new($tlf);
        if (!defined $tl) {
            return failure("Can't load tapelist file ($tlf)", $finished_cb);
        }
@@ -216,16 +216,17 @@ sub main {
            }
 
            # update the tapelist
+           $tl->reload(1);
            $tl->remove_tapelabel($opt_label);
-           $tl->add_tapelabel("0", $opt_label, undef);
-           $tl->write($tlf);
+           $tl->add_tapelabel("0", $opt_label, undef, 1, undef, $res->{'barcode'});
+           $tl->write();
 
            print "Success!\n";
 
            # notify the changer
            $res->set_label(label => $opt_label, finished_cb => $steps->{'labeled'});
        } else {
-           return failure("Volume not labeled.", $finished_cb);
+           return failure("Not writing label.", $finished_cb);
        }
     };