Commit 174337c0 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents dffb96dd 9023d00f
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -13,7 +13,7 @@ include $(OBJDIR)/Makeconf
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
TARGETS = libinstall.pm boss-install ops-install fs-install dump-descriptors \
load-descriptors update-install update-testbed testbed-version
load-descriptors update-install update-mfs update-testbed testbed-version
else
TARGETS = clrhouse-install
endif
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2011 University of Utah and the Flux Group.
# All rights reserved.
#
#
# Update an MFS using a specific tarball
#
use lib '@srcdir@';
use English;
use libinstall;
use Getopt::Std;
my $MFSDIR = "/tftpboot/frisbee/boot";
my $UPDATEVERS = "33";
if ($UID != 0) {
die("This script must be run as root.\n");
}
if (! -d "/mnt") {
die("Need directory /mnt.\n");
}
if (! -d "/mnt/frisbee" && !mkdir("/mnt/frisbee")) {
die("Cannot create directory /mnt/frisbee.\n");
}
if (! -e "$MFSDIR/mfsroot") {
die("No $MFSDIR/mfsroot; where is your MFS?\n");
}
if (!chdir($MFSDIR)) {
die("Cannot cd to $MFSDIR.\n");
}
# make a backup
print("Backing up mfsroot to mfsroot.bak ...\n");
if (system("cp -p mfsroot mfsroot.bak")) {
die("Could not backup mfsroot.\n");
}
print("Configuring md device ...\n");
my $unit = `/sbin/mdconfig -a -t vnode -f mfsroot`;
if ($?) {
die("Could not run mdconfig.\n");
}
if ($unit =~ /^md(\d+)$/) {
$unit = $1;
} else {
die("Malformed mdconfig output!?\n");
}
print("Mounting MFS ...\n");
if (system("mount /dev/md$unit /mnt/frisbee")) {
system("mdconfig -d -u $unit");
die("Could not mount /dev/md$unit.\n");
}
# check the current version
print("Checking version of MFS ...\n");
my $version = 0;
if (-e "/mnt/frisbee/etc/emulab/version") {
my $vers = `cat /mnt/frisbee/etc/emulab/version`;
if ($vers =~ /^(\d+)$/) {
$version = $1;
}
}
if ($version eq $UPDATEVERS) {
print "MFS is already up to date (version $UPDATEVERS)\n";
if (system("umount /mnt/frisbee") || system("mdconfig -d -u $unit")) {
warn("Could not umount/unconfig MFS; do it manually.\n");
} else {
unlink("mfsroot.bak");
}
exit(0);
}
# Rename the backup mfsroot
my $mfsbackup = "mfsroot.v$version";
print("Rename old MFS backup ...\n");
if (system("mv mfsroot.bak $mfsbackup")) {
if (system("umount /mnt/frisbee") || system("mdconfig -d -u $unit")) {
warn("Could not umount/unconfig MFS; do it manually.\n");
}
die("Could not rename backup\n");
}
# Find the latest version of libc installed
print("Determining MFS libc version ...\n");
my $libc = `ls /mnt/frisbee/lib/libc.so.* | tail -1`;
if ($? || ($libc !~ /\.so\.(\d+)$/)) {
if (system("umount /mnt/frisbee") || system("mdconfig -d -u $unit")) {
warn("Could not umount/unconfig MFS.\n");
}
die("No libc in MFS!?");
} else {
$libc = $1;
}
# fetch update tarball
my $tarball = "frisbee-$UPDATEVERS-libc$libc.tar.gz";
print("Fetching update tarball $tarball ...\n");
if (system("fetch -o /var/tmp http://www.emulab.net/downloads/$tarball")) {
if (system("umount /mnt/frisbee") || system("mdconfig -d -u $unit")) {
warn("Could not umount/unconfig MFS.\n");
}
die("No libc $libc update for MFS $UPDATEVERS.");
}
print("Installing tarball $tarball ...\n");
if (system("tar -C /mnt/frisbee -xvzf /var/tmp/$tarball")) {
if (system("umount /mnt/frisbee") || system("mdconfig -d -u $unit")) {
warn("Could not umount/unconfig MFS; fix it and ",
"move $mfsbackup to mfsroot.\n");
} elsif (system("mv $mfsbackup mfsroot")) {
warn("Could not restore old mfsroot; ",
"move $mfsbackup to mfsroot.\n");
}
die("Could not update to MFS $UPDATEVERS (libc version $libc).\n");
}
print("Update version ...\n");
system("echo $UPDATEVERS > /mnt/frisbee/etc/emulab/version");
print("Unmounting MFS ...\n");
if (system("umount /mnt/frisbee") || system("mdconfig -d -u $unit")) {
die("Could not umount/unconfig MFS; fix and run ./prepare\n");
}
print("Preparing MFS ...\n");
system("./prepare");
print("MFS successfully updated!\n",
"If it doesn't work, move mfsroot.v$version to mfsroot and run ./prepare\n");
exit(0);
......@@ -307,7 +307,8 @@ if ($stopbed) {
}
print "** Testbed is quiet; stopping testbed daemons ... \n";
if (system("$STARTUP stop >/dev/null 2>&1") ||
system("$MFRISBEED stop >/dev/null 2>&1")) {
(-x $MFRISBEED &&
system("$MFRISBEED stop >/dev/null 2>&1"))) {
Fatal("Could not stop testbed daemons. Stopping.");
}
$stopped = 1;
......
......@@ -7,6 +7,8 @@ use emdb;
use Image;
use NodeType;
my $MFRISBEED_STARTUP = "/usr/local/etc/rc.d/3.mfrisbeed.sh";
sub InstallUpdate($$)
{
my ($version, $phase) = @_;
......@@ -27,6 +29,11 @@ sub InstallUpdate($$)
# If something should run in the pre-install phase.
#
if ($phase eq "pre") {
Phase "startupfile", "Installing master frisbee startup file", sub {
DoneIfExists($MFRISBEED_STARTUP);
ExecQuietFatal("$GMAKE -C $TOP_OBJDIR/rc.d install");
};
if ($gotem) {
print("\n",
"*** PLEASE NOTE:\n",
......
......@@ -80,7 +80,9 @@ $(TARGET_PATH)/lib/libncurses.so.5.7: $(STAGING_DIR)/lib/libncurses.so.5.7
mkdir -p $(TARGET_PATH)/usr/share/terminfo/x
mkdir -p $(TARGET_PATH)/usr/share/tabset
cp -fa $(STAGING_DIR)/usr/share/tabset/* $(TARGET_PATH)/usr/share/tabset
cp -fa $(STAGING_DIR)/usr/share/terminfo/v/vt{100,220} \
cp -fa $(STAGING_DIR)/usr/share/terminfo/v/vt100 \
$(TARGET_PATH)/usr/share/terminfo/v
cp -fa $(STAGING_DIR)/usr/share/terminfo/v/vt220 \
$(TARGET_PATH)/usr/share/terminfo/v
cp -fa $(STAGING_DIR)/usr/share/terminfo/l/linux \
$(TARGET_PATH)/usr/share/terminfo/l
......
......@@ -55,6 +55,7 @@ script-install:
mkdir -p $(TARGET_PATH)/var/emulab/boot
mkdir -p $(TARGET_PATH)/var/emulab/db
mkdir -p $(TARGET_PATH)/usr/share/udhcpc
rm -f $(TARGET_PATH)/usr/local/etc/emulab
ln -sf /etc/testbed $(TARGET_PATH)/usr/local/etc/emulab
install -m 755 $(TESTBED_BUILD_PATH)/sethostname.dhclient $(TARGET_PATH)/usr/share/udhcpc
install -m 755 $(TMCD_PATH)/linux/control_interface $(TARGET_PATH)/etc/testbed
......
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