lintian doesn't like orphan packages with uploaders...
[debian/amanda] / installcheck / Installcheck / Run.pm
index f87e85b770e1ae79311f50ea766664b68f925d54..9235aafc890b24938599e145e5c250e85685b0ac 100644 (file)
@@ -1,9 +1,10 @@
 # vim:ft=perl
-# Copyright (c) 2008, 2009, 2010 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2008-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
@@ -189,10 +190,17 @@ our $taperoot = "$Installcheck::TMP/vtapes";
 our $holdingdir ="$Installcheck::TMP/holding";
 
 sub setup {
+    my $new_vtapes = shift;
+    my $nb_slot = shift;
     my $testconf = Installcheck::Config->new();
 
+    $nb_slot = 3 if !defined $nb_slot;
     (-d $diskname) or setup_backmeup();
-    setup_vtapes($testconf, 3);
+    if ($new_vtapes) {
+       setup_new_vtapes($testconf, $nb_slot);
+    } else {
+       setup_vtapes($testconf, $nb_slot);
+    }
     setup_holding($testconf, 25);
     setup_disklist($testconf);
 
@@ -289,6 +297,32 @@ sub setup_vtapes {
     ]);
 }
 
+sub setup_new_vtapes {
+    my ($testconf, $ntapes) = @_;
+    if (-d $taperoot) {
+       rmtree($taperoot);
+    }
+
+    # make each of the tape directories
+    for (my $i = 1; $i < $ntapes+1; $i++) {
+       my $tapepath = "$taperoot/slot$i";
+       mkpath("$tapepath");
+    }
+
+    load_vtape(1);
+
+    # set up the appropriate configuration
+    $testconf->add_param("tpchanger", "\"chg-disk:$taperoot\"");
+    $testconf->add_param("labelstr", "\"TESTCONF[0-9][0-9]\"");
+    $testconf->add_param("tapecycle", "$ntapes");
+
+    # this overwrites the existing TEST-TAPE tapetype
+    $testconf->add_tapetype('TEST-TAPE', [
+       'length' => '30 mbytes',
+       'filemark' => '4 kbytes',
+    ]);
+}
+
 sub setup_holding {
     my ($testconf, $mbytes) = @_;