#!/usr/bin/perl -w # 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 or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . use strict; use warnings; use Getopt::Long qw(GetOptionsFromString); use Pod::Usage; use File::Basename; use File::Spec; use IO::Handle; use Time::HiRes("usleep"); use Socket; use FileHandle; use IPC::Open2; use POSIX qw(:errno_h); use Cwd qw(getcwd abs_path); # always flush $| = 1; my $invocation_dir = getcwd(); chomp(my $gittop = `git rev-parse --show-toplevel 2>/dev/null`); ## Configuration file handling # Default configuration $CFG::hypervisor = ""; $CFG::hypervisor_params = "serial"; $CFG::genisoimage = "genisoimage"; $CFG::iprelay_addr = '141.76.48.80:2324'; #'141.76.48.252'; $CFG::qemu = 'qemu'; @CFG::chainloaders = (); #('bin/boot/bender promisc'); # TODO: convert to option $CFG::pulsar_root = ''; # TODO: convert to option $CFG::pulsar_mac = '52-54-00-12-34-56'; %CFG::targets = ( "tud" => '--server=erwin.inf.tu-dresden.de:~sojka/boot/novaboot --rsync-flags="--chmod=Dg+s,ug+w,o-w,+rX --rsync-path=\"umask 002 && rsync\"" --grub --grub-prefix=(nd)/tftpboot/sojka/novaboot --grub-preamble="timeout 0" --concat --iprelay=141.76.48.80:2324 --scriptmod=s/\\\\bhostserial\\\\b/hostserialpci/g', "novabox" => '--server=rtime.felk.cvut.cz:/srv/tftp/novaboot --rsync-flags="--chmod=Dg+s,ug+w,o-w,+rX --rsync-path=\"umask 002 && rsync\"" --pulsar=novaboot --iprelay=147.32.86.92:2324', "localhost" => '--scriptmod=s/console=tty[A-Z0-9,]+// --server=/boot/novaboot/$NAME --grub2 --grub-prefix=/boot/novaboot/$NAME --grub2-prolog=" set root=\'(hd0,msdos1)\'"', ); $CFG::scons = "scons -j2"; my @qemu_flags = qw(-cpu coreduo -smp 2); sub read_config($) { my ($cfg) = @_; { package CFG; # Put config data into a separate namespace my $rc = do($cfg); # Check for errors if ($@) { die("ERROR: Failure compiling '$cfg' - $@"); } elsif (! defined($rc)) { die("ERROR: Failure reading '$cfg' - $!"); } elsif (! $rc) { die("ERROR: Failure processing '$cfg'"); } } print "novaboot: Read $cfg\n"; } my @cfgs; { # We don't use $0 here, because it points to the novaboot itself and # not to the novaboot script. The problem with this approach is that # when a script is run as "novaboot