Commit d7909c5d authored by Mike Hibler's avatar Mike Hibler

Automate the freenas setup a bit more.

Use the "freenas-tarball" makefile target to create a tarball for
installation on FreeNAS 8.3 or 9.2. The tarball must be made on the
corresponding FreeBSD system (since FreeNAS has no installed compiler).

To install the tarball on FreeNAS you will need to login as root and:

    cd /
    mount -o rw -u /
    mount /cfg
    tar xzf freenas-tarball.tar.gz
    unmount /cfg
    mount -o ro -u /
parent 4d4fe742
......@@ -25,6 +25,8 @@ TESTBED_SRCDIR = @top_srcdir@
OBJDIR = @top_builddir@
SUBDIR = $(subst $(TESTBED_SRCDIR)/,,$(SRCDIR))
SYSTEM := $(shell uname -s)
ARCH := $(shell uname -p)
REL := $(shell $(SRCDIR)/tmcc/osstuff.sh -r)
include $(OBJDIR)/Makeconf
......@@ -62,7 +64,7 @@ newnode-mfs: newnode-mfs-subdirs
newnode-mfs-install: client-mkdirs newnode-mfs-install-subdirs
TARBALLDESTDIR = /var/tmp/emulab-client
client-tarball:
tarball-check:
@if [ `id -u` -ne 0 ]; then \
echo '*** Must run as root!'; \
false; \
......@@ -72,6 +74,8 @@ client-tarball:
echo "Remove it and try again."; \
false; \
fi
client-tarball: tarball-check
echo "Building and installing client-side in $(TARBALLDESTDIR)..."
DESTDIR=$(TARBALLDESTDIR) $(MAKE) client-install
echo "Creating tarball..."
......@@ -81,6 +85,43 @@ client-mkdirs:
-mkdir -p $(DESTDIR)$(CLIENT_BINDIR)
-mkdir -p $(DESTDIR)$(CLIENT_MANDIR)
freenas-os-check:
@if [ "$(SYSTEM)" != "FreeBSD" -o "$(ARCH)" != "amd64" -o \
\( "$(REL)" != "9.2" -a "$(REL)" != "8.3" \) ]; then \
echo "Must run on FreeBSD 8.3 or 9.2 amd64"; \
false; \
fi
#
# XXX when we have a real freenas9 target, all the moving files around
# should be done there...
#
freenas-tarball: freenas-os-check tarball-check
echo "Building and installing client-side in $(TARBALLDESTDIR)..."
DESTDIR=$(TARBALLDESTDIR) $(MAKE) client-install
echo "Tweaking for FreeNAS..."
(cd $(TARBALLDESTDIR); \
mkdir -p cfg cfg/rc.d cfg/local data local; \
mv etc/emulab cfg/emulab; \
mv usr/local/etc/emulab local/emulab; \
mv var/emulab data/emulab; \
ln -sf /data/emulab conf/base/var/emulab; \
rm -rf var data/emulab/sup; \
mkdir -p data/emulab/shadow data/emulab/vms; \
chflags noschg sbin/init; \
rm -rf boot etc root sbin usr/*; \
mv local usr/local; \
ln -sf /usr/local/emulab cfg/local/emulab)
(cd $(SRCDIR)/tmcc/freenas8; \
cp genvmtype $(TARBALLDESTDIR)/cfg/emulab/; \
cp testbed $(TARBALLDESTDIR)/cfg/rc.d/; \
cp bscontrol.proxy.pl $(TARBALLDESTDIR)/usr/local/emulab/bscontrol.proxy; \
cp freenas-config libfreenas.pm libvnode_blockstore.pm $(TARBALLDESTDIR)/usr/local/emulab/; \
rm -f $(TARBALLDESTDIR)/usr/local/emulab/rc/rc.kname; \
chmod -R g-w $(TARBALLDESTDIR)/usr/local/emulab)
echo "Creating tarball freenas-client.tar.gz..."
tar czf freenas-client.tar.gz -C $(TARBALLDESTDIR) .
#
# Attempt to find a git commit hash and stash in /etc/emulab.
#
......
#!/usr/bin/perl -w
#
# Copyright (c) 2004-2013 University of Utah and the Flux Group.
# Copyright (c) 2004-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -409,10 +409,14 @@ sub doboot()
# Kill off pubsubd and start clusterd.
#
system("killall pubsubd");
print("Starting pubsub cluster daemon\n");
system("/usr/local/libexec/clusterd -s $eventserver");
if ($?) {
fatal("Error running clusterd");
if (-x "/usr/local/libexec/clusterd") {
print("Starting pubsub cluster daemon\n");
system("/usr/local/libexec/clusterd -s $eventserver");
if ($?) {
fatal("Error running clusterd");
}
} else {
print STDERR "WARNING: clusterd not installed, not started\n";
}
}
elsif (!(REMOTE() && !REMOTEDED()) && !GENVNODE()) {
......
File mode changed from 100644 to 100755
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