Commit 7ac28c17 authored by Leigh B Stoller's avatar Leigh B Stoller

Add update section, to make it easy to update entire MFS bundle from

the Utah downloads directory.
parent 714c9837
......@@ -19,10 +19,6 @@ sub Install($$$)
{
my ($server, $isupdate, $impotent) = @_;
# Replace if this script does an update for ip/domain.
return 0
if ($isupdate);
# Configure can override setting it here.
if ($MFSVERSION eq "") {
if ($FBSD_MAJOR > 8 || ($FBSD_MAJOR == 8 && $FBSD_MINOR >= 2)) {
......@@ -40,6 +36,24 @@ sub Install($$$)
$MFSURL = "http://www.emulab.net/downloads/$MFSTARBALL";
}
#
# Want to recreate the directory and start over.
#
if ($isupdate) {
Phase "tftpboot_rename", "Backing up $TFTP_DIR", sub {
DoneIfDoesntExist($TFTP_DIR);
BackupDirectoryFatal($TFTP_DIR);
ExecQuietFatal("/bin/rm -rf $TFTP_DIR")
if (!$impotent);
};
Phase "tftpboot_recreate", "Recreating $TFTP_DIR", sub {
DoneIfExists($TFTP_DIR);
mkdir $TFTP_DIR,0775 or
PhaseFail("Unable to create $TFTP_DIR : $!");
ExecQuietFatal("$CHGRP tbadmin $TFTP_DIR");
};
}
Phase "mfs", "Setting up MFSs", sub {
my $localfile = "$TFTP_DIR/tftpboot.tar.gz";
......@@ -99,6 +113,10 @@ sub Install($$$)
#
Phase "password", "Setting up MFS password", sub {
my $passhash;
# Skip in update mode.
PhaseSkip("update mode")
if ($isupdate);
my ($status, @output) =
ExecQuiet("$PREFIX/sbin/setsitevar -c $IMAGEPASSWORDSITEVAR");
......@@ -154,11 +172,13 @@ sub Install($$$)
# already loaded, but the script will just skip over them without
# raising an error.
#
Phase "descriptors", "Loading the Image and OS IDS", sub {
ExecQuietFatal("cd $TOP_OBJDIR/install; ".
" $SUDO -u $PROTOUSER $WAP ".
" perl load-descriptors $MFSDESCRIPTORS");
};
if (!$isupdate) {
Phase "descriptors", "Loading the Image and OS IDS", sub {
ExecQuietFatal("cd $TOP_OBJDIR/install; ".
" $SUDO -u $PROTOUSER $WAP ".
" perl load-descriptors $MFSDESCRIPTORS");
};
}
PhaseSucceed("done");
};
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment