images 1.7 KB
Newer Older
1 2 3 4 5 6 7
#
# 
#
use strict;
use libinstall;
use installvars;

8 9
my $UTAHURL       = "http://www.emulab.net/downloads";
my $DESCRIPTORS   = "$TOP_SRCDIR/install/descriptors-v3.xml";
Leigh B Stoller's avatar
Leigh B Stoller committed
10
my @STDIMAGES     = ("FBSD82-STD", "FEDORA10-STD");
11 12
my @MBRS          = ("emulab-mbr.dd", "emulab-mbr2.dd");
my $STDIMAGESURL  = "$UTAHURL/images-STD";
13 14 15 16 17 18 19 20 21

sub Install($$$)
{
    my ($server, $isupdate, $impotent) = @_;

    # Replace if this script does an update for ip/domain.
    return 0
	if ($isupdate);

22
    Phase "IDs", "Setting up Images and OSs", sub {
23
	#
24 25
	# Load up the initial descriptors. 
	# Load up the images from boss.
26 27 28 29
	#
	Phase "descriptors", "Loading the Image and OS IDS", sub {
	    ExecQuietFatal("cd $TOP_OBJDIR/install; ".
			   "   $SUDO -u $PROTOUSER $WAP ".
30
			   "   perl load-descriptors -a $DESCRIPTORS");
31
	};
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
	foreach my $imagename (@STDIMAGES) {
	    my $localfile = "$PREFIX/images/${imagename}.ndz";
	    my $url       = "$STDIMAGESURL/${imagename}.ndz";
	    
	    Phase "$imagename", "Fetching $imagename. Patience!", sub {
		DoneIfExists($localfile);
		FetchFileFatal($url, $localfile);
	    };
	}
	foreach my $mbr (@MBRS) {
	    my $localfile = "$PREFIX/images/$mbr";
	    my $url       = "$UTAHURL/$mbr";
	    
	    Phase "$mbr", "Fetching $mbr.", sub {
		DoneIfExists($localfile);
		FetchFileFatal($url, $localfile);
	    };
	}
	#
	# The sitevar is how the reload daemon knows what to reload nodes
	# with, by default. Now a comma separated list.
	#
	my $idlist = join(",", @STDIMAGES);
	
	Phase "sitevar", "Setting sitevar $DEFAULTIMAGESITEVAR", sub {
	    ExecQuietFatal("$PREFIX/sbin/setsitevar ".
			   "'$DEFAULTIMAGESITEVAR' '$idlist'");
	};
	PhaseSucceed("done")
61 62 63 64 65 66 67
    };
    return 0;
}

# Local Variables:
# mode:perl
# End: