From 3cd66d5160a858e64a269dd5e06d6715b3444645 Mon Sep 17 00:00:00 2001
From: Mike Hibler <hibler@cs.utah.edu>
Date: Fri, 30 Nov 2012 13:01:36 -0700
Subject: [PATCH] Plumb through an fs-install makefile target and fixes to
 ops-install.

This officially drops the pretense that fs nodes can operate with minimal
Emulab software. If you have a seperate fs node, it had better be dedicated
to Emulab!

However, it still doesn't do everything. In particular, accounts are not
installed. This has never been needed for serving NFS, but is needed for
the samba stuff to work correctly.

Also, you cannot do an fs node software install from boss yet as we do not
mount fs filesystems on boss. You really cannot do a full ops install from
boss either since we don't mount ops' /usr/local/etc/emulab directory.
---
 GNUmakefile.in                            |  3 +++
 clientside/GNUmakefile.in                 |  1 +
 clientside/event/GNUmakefile.in           |  1 +
 clientside/lib/GNUmakefile.in             |  1 +
 clientside/lib/event/GNUmakefile.in       |  3 ++-
 clientside/lib/libtb/GNUmakefile.in       |  3 ++-
 clientside/lib/tmcd/GNUmakefile.in        |  4 ++--
 clientside/os/GNUmakefile.in              |  2 ++
 clientside/sensors/GNUmakefile.in         |  1 +
 clientside/tmcc/GNUmakefile.in            |  5 ++++-
 clientside/tmcc/common/GNUmakefile.in     | 13 +++++++++++++
 clientside/tmcc/common/config/rc.localize |  2 +-
 clientside/tmcc/common/fixarpinfo         |  2 +-
 clientside/tmcc/common/libsetup.pm        |  9 +++++++--
 clientside/tmcc/freebsd/GNUmakefile.in    |  9 +++++++++
 clientside/tools/GNUmakefile.in           |  1 +
 install/phases/boss/sslcerts              | 23 ++++++++++++++++++++++-
 17 files changed, 73 insertions(+), 10 deletions(-)

diff --git a/GNUmakefile.in b/GNUmakefile.in
index 79b1c57441..82d64cc61e 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -146,6 +146,7 @@ ops-install:
 	-chmod 770 $(INSTALL_TOPDIR)/log/mysql
 	-chown mysql $(INSTALL_TOPDIR)/log/mysql
 	-chgrp mysql $(INSTALL_TOPDIR)/log/mysql
+	@$(MAKE) -C rc.d control-install
 	@$(MAKE) -C tbsetup control-install
 	@$(MAKE) -C security control-install
 	@$(MAKE) -C tip control-install
@@ -162,7 +163,9 @@ ifeq ($(PELABSUPPORT),1)
 endif
 
 fs-install:
+	@$(MAKE) -C rc.d fs-install
 	@$(MAKE) -C tbsetup fs-install
+	@$(MAKE) -C clientside fs-install
 	@$(MAKE) -C sensors fs-install
 
 opsfs-install: ops-install fs-install
diff --git a/clientside/GNUmakefile.in b/clientside/GNUmakefile.in
index e564161c7e..8d34b70fd9 100644
--- a/clientside/GNUmakefile.in
+++ b/clientside/GNUmakefile.in
@@ -45,6 +45,7 @@ include $(TESTBED_SRCDIR)/GNUmakerules
 client:		client-subdirs
 client-install: client client-mkdirs client-install-subdirs client-setversion
 control-install: control-install-subdirs
+fs-install:     fs-install-subdirs
 subboss:	subboss-subdirs
 subboss-install: client client-mkdirs subboss-install-subdirs
 post-install:	post-install-subdirs
diff --git a/clientside/event/GNUmakefile.in b/clientside/event/GNUmakefile.in
index 645e240be2..9296fec9b1 100644
--- a/clientside/event/GNUmakefile.in
+++ b/clientside/event/GNUmakefile.in
@@ -64,6 +64,7 @@ boss-install:   boss-install-subdirs
 client:		client-subdirs
 client-install: client client-install-subdirs
 control-install: control-install-subdirs
+fs-install:
 post-install:	post-install-subdirs
 clean:		clean-subdirs
 distclean:	distclean-subdirs
diff --git a/clientside/lib/GNUmakefile.in b/clientside/lib/GNUmakefile.in
index d27a6865d1..ccf1e7e950 100644
--- a/clientside/lib/GNUmakefile.in
+++ b/clientside/lib/GNUmakefile.in
@@ -37,6 +37,7 @@ client: client-subdirs
 install: install-subdirs
 boss-install: install-subdirs
 control-install: control-install-subdirs
+fs-install: fs-install-subdirs
 client-install: client-install-subdirs
 subboss: client
 subboss-install: client-install
diff --git a/clientside/lib/event/GNUmakefile.in b/clientside/lib/event/GNUmakefile.in
index 4067249d8a..32639ecb4b 100644
--- a/clientside/lib/event/GNUmakefile.in
+++ b/clientside/lib/event/GNUmakefile.in
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000-2011 University of Utah and the Flux Group.
+# Copyright (c) 2000-2012 University of Utah and the Flux Group.
 # 
 # {{{EMULAB-LICENSE
 # 
@@ -164,6 +164,7 @@ install: $(LIBS) $(addprefix $(INSTALL_LIBDIR)/, $(LIB_STUFF)) \
 	$(addprefix $(INSTALL_DIR)/opsdir/lib/, $(LIB_STUFF))
 
 control-install:	$(LIBS) $(addprefix $(INSTALL_LIBDIR)/, $(LIB_STUFF))
+fs-install:
 
 #
 # Right now we don't bother with the dynamic libs for a couple of reasons:
diff --git a/clientside/lib/libtb/GNUmakefile.in b/clientside/lib/libtb/GNUmakefile.in
index 0f6b77b6bb..d5350da48f 100644
--- a/clientside/lib/libtb/GNUmakefile.in
+++ b/clientside/lib/libtb/GNUmakefile.in
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000-2011 University of Utah and the Flux Group.
+# Copyright (c) 2000-2012 University of Utah and the Flux Group.
 # 
 # {{{EMULAB-LICENSE
 # 
@@ -37,6 +37,7 @@ client-install: client
 # built during the ops-install target when installing a new emulab.
 # This is done on ops of course.
 control-install: client
+fs-install: client
 
 include $(TESTBED_SRCDIR)/GNUmakerules
 
diff --git a/clientside/lib/tmcd/GNUmakefile.in b/clientside/lib/tmcd/GNUmakefile.in
index fb16d03f7c..b9e73cd981 100644
--- a/clientside/lib/tmcd/GNUmakefile.in
+++ b/clientside/lib/tmcd/GNUmakefile.in
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000-2011 University of Utah and the Flux Group.
+# Copyright (c) 2000-2012 University of Utah and the Flux Group.
 # 
 # {{{EMULAB-LICENSE
 # 
@@ -77,6 +77,7 @@ client: all
 client-install:
 boss-install:
 control-install: all
+fs-install: all
 subboss-install:
 client-install:
 mfs:
@@ -86,4 +87,3 @@ frisbee-mfs-install:
 
 clean:
 	rm -f *.o libtmcd.a libtmcc.a
-
diff --git a/clientside/os/GNUmakefile.in b/clientside/os/GNUmakefile.in
index 39066d3a99..a7b11cbd67 100644
--- a/clientside/os/GNUmakefile.in
+++ b/clientside/os/GNUmakefile.in
@@ -56,6 +56,8 @@ boss-install:
 control-install: 
 	@$(MAKE) -C imagezip install
 
+fs-install:
+
 client: client-subdirs
 
 client-install: client
diff --git a/clientside/sensors/GNUmakefile.in b/clientside/sensors/GNUmakefile.in
index da8b9a82c3..28f83edab3 100644
--- a/clientside/sensors/GNUmakefile.in
+++ b/clientside/sensors/GNUmakefile.in
@@ -44,6 +44,7 @@ boss-install:	all boss-install-subdirs
 client:		client-subdirs
 client-install: client client-install-subdirs
 control-install: control-install-subdirs
+fs-install:
 subboss:
 subboss-install:
 post-install:	post-install-subdirs
diff --git a/clientside/tmcc/GNUmakefile.in b/clientside/tmcc/GNUmakefile.in
index eeeb2c1233..cc1623eb1b 100644
--- a/clientside/tmcc/GNUmakefile.in
+++ b/clientside/tmcc/GNUmakefile.in
@@ -158,9 +158,12 @@ install:
 boss-install:	$(INSTALL_SBINDIR)/findif \
 		elabinelabfiles
 
-control-install: tmcc
+control-install: tmcc findif
 	@$(MAKE) -C freebsd control-install
 
+fs-install: tmcc findif
+	@$(MAKE) -C freebsd fs-install
+
 subboss-install: subboss
 	@$(MAKE) -C $(MDSUBDIR) subboss-install
 
diff --git a/clientside/tmcc/common/GNUmakefile.in b/clientside/tmcc/common/GNUmakefile.in
index f217148740..fa3e989d2f 100644
--- a/clientside/tmcc/common/GNUmakefile.in
+++ b/clientside/tmcc/common/GNUmakefile.in
@@ -58,6 +58,7 @@ install client-install:
 local-install:		path-install local-script-install symlinks
 remote-install:		path-install remote-script-install
 control-install:	path-install control-script-install
+fs-install:		path-install fs-script-install
 subboss-local-install:	path-install subboss-local-script-install symlinks
 
 other-install:
@@ -162,6 +163,18 @@ remote-script-install:	common-script-install
 control-script-install:	dir-install bossnode
 	$(INSTALL) -m 755 $(SRCDIR)/libsetup.pm $(BINDIR)/libsetup.pm
 	$(INSTALL) -m 755 $(SRCDIR)/libtmcc.pm $(BINDIR)/libtmcc.pm
+	$(INSTALL) -m 755 $(SRCDIR)/libtestbed.pm $(BINDIR)/libtestbed.pm
+	$(INSTALL) -m 755 $(SRCDIR)/tmcc.pl $(BINDIR)/tmcc
+	$(INSTALL) -m 755 $(SRCDIR)/ctrlnode.sh $(SYSRCDIR)/ctrlnode.sh
+	$(INSTALL) -m 755 $(SRCDIR)/rc.ctrlnode $(RCDIR)/rc.ctrlnode
+	$(INSTALL) -m 755 $(SRCDIR)/config/librc.pm $(BINDIR)/librc.pm
+	$(INSTALL) -m 755 $(SRCDIR)/fixarpinfo $(BINDIR)/fixarpinfo
+	$(INSTALL) bossnode $(ETCDIR)/bossnode
+
+fs-script-install:	dir-install bossnode
+	$(INSTALL) -m 755 $(SRCDIR)/libsetup.pm $(BINDIR)/libsetup.pm
+	$(INSTALL) -m 755 $(SRCDIR)/libtmcc.pm $(BINDIR)/libtmcc.pm
+	$(INSTALL) -m 755 $(SRCDIR)/libtestbed.pm $(BINDIR)/libtestbed.pm
 	$(INSTALL) -m 755 $(SRCDIR)/tmcc.pl $(BINDIR)/tmcc
 	$(INSTALL) -m 755 $(SRCDIR)/ctrlnode.sh $(SYSRCDIR)/ctrlnode.sh
 	$(INSTALL) -m 755 $(SRCDIR)/rc.ctrlnode $(RCDIR)/rc.ctrlnode
diff --git a/clientside/tmcc/common/config/rc.localize b/clientside/tmcc/common/config/rc.localize
index 1d4e4f8e26..494fad9ae6 100755
--- a/clientside/tmcc/common/config/rc.localize
+++ b/clientside/tmcc/common/config/rc.localize
@@ -57,7 +57,7 @@ use librc;
 # Not all clients support this.
 #
 exit(0)
-    if (PLAB() || JAILED() || CONTROL());
+    if (PLAB() || JAILED() || CONTROL() || FSNODE());
 
 # Protos.
 sub doboot();
diff --git a/clientside/tmcc/common/fixarpinfo b/clientside/tmcc/common/fixarpinfo
index 73e44ae280..3a375ea4c0 100644
--- a/clientside/tmcc/common/fixarpinfo
+++ b/clientside/tmcc/common/fixarpinfo
@@ -70,7 +70,7 @@ use librc;
 # Not all clients support this.
 #
 exit(0)
-    if (!(SUBBOSS() || CONTROL()));
+    if (!(SUBBOSS() || CONTROL() || FSNODE()));
 
 # XXX
 my $os = `uname`;
diff --git a/clientside/tmcc/common/libsetup.pm b/clientside/tmcc/common/libsetup.pm
index 87eb3d9110..542364a17a 100644
--- a/clientside/tmcc/common/libsetup.pm
+++ b/clientside/tmcc/common/libsetup.pm
@@ -47,8 +47,8 @@ use Exporter;
 	 TBDebugTimeStamp TBDebugTimeStampWithDate
 	 TBDebugTimeStampsOn TBDebugTimeStampsOff
 
-	 MFS REMOTE REMOTEDED CONTROL WINDOWS JAILED PLAB LOCALROOTFS IXP
-	 USESFS SHADOW FSRVTYPE PROJDIR EXPDIR
+	 MFS REMOTE REMOTEDED CONTROL FSNODE WINDOWS JAILED PLAB LOCALROOTFS
+	 IXP USESFS SHADOW FSRVTYPE PROJDIR EXPDIR
 
 	 SIMTRAFGEN SIMHOST ISDELAYNODEPATH JAILHOST DELAYHOST STARGATE
 	 ISFW FAKEJAILED LINUXJAILED GENVNODE GENVNODETYPE GENVNODEHOST
@@ -451,6 +451,11 @@ sub REMOTEDED()	{ if (-e "$ETCDIR/isremded") { return 1; } else { return 0; } }
 #
 sub CONTROL()	{ if (-e "$ETCDIR/isctrl") { return 1; } else { return 0; } }
 
+#
+# Same for an FS node.
+#
+sub FSNODE()	{ if (-e "$ETCDIR/isfs") { return 1; } else { return 0; } }
+
 #
 # Same for a Windows (CygWinXP) node.
 #
diff --git a/clientside/tmcc/freebsd/GNUmakefile.in b/clientside/tmcc/freebsd/GNUmakefile.in
index 305f3bf19d..f6090d0e44 100644
--- a/clientside/tmcc/freebsd/GNUmakefile.in
+++ b/clientside/tmcc/freebsd/GNUmakefile.in
@@ -151,10 +151,19 @@ cdboot-install:	destdircheck common-install etc-install \
 control-install:	dir-install
 	cp /dev/null $(ETCDIR)/isctrl
 	$(INSTALL) -m 755 ../tmcc $(BINDIR)/tmcc.bin
+	$(INSTALL) -m 755 -s ../findif $(BINDIR)/findif
 	$(INSTALL) -m 755 $(SRCDIR)/liblocsetup.pm $(BINDIR)/liblocsetup.pm
 	(cd ../common; $(MAKE) control-install)
 	@echo "Remember to install the PEM files if necessary"
 
+fs-install:	dir-install
+	cp /dev/null $(ETCDIR)/isfs
+	$(INSTALL) -m 755 ../tmcc $(BINDIR)/tmcc.bin
+	$(INSTALL) -m 755 -s ../findif $(BINDIR)/findif
+	$(INSTALL) -m 755 $(SRCDIR)/liblocsetup.pm $(BINDIR)/liblocsetup.pm
+	(cd ../common; $(MAKE) fs-install)
+	@echo "Remember to install the PEM files if necessary"
+
 lbs-install:	simple-install
 	cp /dev/null $(BINDIR)/isrem
 	cp /dev/null $(ETCDIR)/isrem
diff --git a/clientside/tools/GNUmakefile.in b/clientside/tools/GNUmakefile.in
index 81c64f4f41..10a8c8dbc1 100644
--- a/clientside/tools/GNUmakefile.in
+++ b/clientside/tools/GNUmakefile.in
@@ -43,6 +43,7 @@ boss-install:   all boss-install-subdirs
 client:		client-subdirs
 client-install: client client-install-subdirs
 control-install: control-install-subdirs
+fs-install:
 subboss:
 subboss-install:
 post-install:	post-install-subdirs
diff --git a/install/phases/boss/sslcerts b/install/phases/boss/sslcerts
index 30eb5a0038..729e9960b3 100755
--- a/install/phases/boss/sslcerts
+++ b/install/phases/boss/sslcerts
@@ -74,7 +74,28 @@ sub Install($$$)
 			   "     ${USERNODE}:${ETC_EMULAB_DIR}/${CLIENT_PEM}");
 	    ExecQuietFatal("$SSH -o 'BatchMode=yes' root\@${USERNODE} ".
 			   "     'chmod 640 ${ETC_EMULAB_DIR}/${CLIENT_PEM}; ".
-			   "      chmod 640 ${ETC_EMULAB_DIR}/${EMULAB_PEM}'  ");
+			   "      chmod 640 ${ETC_EMULAB_DIR}/${EMULAB_PEM}; ".
+			   "      chown root:wheel ${ETC_EMULAB_DIR}/${CLIENT_PEM}; ".
+			   "      chown root:wheel ${ETC_EMULAB_DIR}/${EMULAB_PEM}' ");
+	};
+	Phase "sslfscopy", "Copying SSL certificates to fs", sub {
+	    if ($USERNODE eq $FSNODE) {
+		PhaseSkip("FS node is ops node");
+	    }
+	    if ($BOSSNODE eq $FSNODE) {
+		PhaseSkip("FS node is boss node");
+	    }
+	    ExecQuietFatal("$SSH -o 'BatchMode=yes' root\@${FSNODE} ".
+			   "     mkdir -p ${ETC_EMULAB_DIR} ");
+	    ExecQuietFatal("$SCP $PREFIX/etc/$EMULAB_PEM ".
+			   "     ${FSNODE}:${ETC_EMULAB_DIR}");
+	    ExecQuietFatal("$SCP $TOP_OBJDIR/ssl/$CTRLNODE_PEM".
+			   "     ${FSNODE}:${ETC_EMULAB_DIR}/${CLIENT_PEM}");
+	    ExecQuietFatal("$SSH -o 'BatchMode=yes' root\@${FSNODE} ".
+			   "     'chmod 640 ${ETC_EMULAB_DIR}/${CLIENT_PEM}; ".
+			   "      chmod 640 ${ETC_EMULAB_DIR}/${EMULAB_PEM}; ".
+			   "      chown root:wheel ${ETC_EMULAB_DIR}/${CLIENT_PEM}; ".
+			   "      chown root:wheel ${ETC_EMULAB_DIR}/${EMULAB_PEM}' ");
 	};
 	Phase "apache", "Setting up Apache on boss", sub {
 	    Phase "dirs", "Creating SSL directories ", sub {
-- 
GitLab