From d7909c5db5b8592c8681742bf85f35078b7cda70 Mon Sep 17 00:00:00 2001 From: Mike Hibler Date: Tue, 30 Sep 2014 22:43:33 -0600 Subject: [PATCH] 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 / --- clientside/GNUmakefile.in | 43 ++++++++++++++++++++- clientside/tmcc/common/rc.bootsetup | 14 ++++--- clientside/tmcc/freenas8/bscontrol.proxy.pl | 0 3 files changed, 51 insertions(+), 6 deletions(-) mode change 100644 => 100755 clientside/tmcc/freenas8/bscontrol.proxy.pl diff --git a/clientside/GNUmakefile.in b/clientside/GNUmakefile.in index 15bacf857..24501a3da 100644 --- a/clientside/GNUmakefile.in +++ b/clientside/GNUmakefile.in @@ -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. # diff --git a/clientside/tmcc/common/rc.bootsetup b/clientside/tmcc/common/rc.bootsetup index 0f013d3f7..020607b76 100755 --- a/clientside/tmcc/common/rc.bootsetup +++ b/clientside/tmcc/common/rc.bootsetup @@ -1,6 +1,6 @@ #!/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()) { diff --git a/clientside/tmcc/freenas8/bscontrol.proxy.pl b/clientside/tmcc/freenas8/bscontrol.proxy.pl old mode 100644 new mode 100755 -- GitLab