# Usages:
#
-# ./mg-hosts mknetbootdir HOST...
+# ./mg-hosts mknetbootdir -Fany | -F<firmware>... HOST...
# Create directories for netboot as expected by the rest
# of osstest. Will use "sudo". The HOST(s) must be
# allocated (via mg-allocate HOST).
sub cmd_mknetbootdir () {
my $dryrun = 0;
+ my %expect_firmware;
while (@ARGV && $ARGV[0] =~ m/^-/) {
$_ = shift @ARGV;
last if $_ =~ m/^--?$/;
while (m/^-./) {
if (s/^-n/-/) { $dryrun= 1; }
+ elsif (s/^-F(.*)//) { $expect_firmware{$1} = 1 }
else { die "unknown mknetbootdir option $_"; }
}
}
+ die "need at least one -F<firmware> or -Fany option"
+ unless %expect_firmware;
die unless @ARGV>=1;
my $sudo = $ENV{'OSSTEST_SUDO'} // 'sudo';
foreach my $hn (@ARGV) {
my $ho= selecthost("host=$hn");
my ($dir, $file) = host_netboot_file($ho);
+ if (!$expect_firmware{any}) {
+ my $got_firmware = get_host_property($ho, "firmware");
+ die
+ "host $hn configuration says firmware \`$got_firmware', not as expected\n"
+ unless $expect_firmware{$got_firmware};
+ }
die unless defined $dir;
my ($rdir, $realfile) = host_netboot_file($ho, 'TemplatesReal');
$realfile //= $file;