From 4c29081976f97fbdf6637ab357a11b0c57b94deb Mon Sep 17 00:00:00 2001
From: Mike Hibler <mike@flux.utah.edu>
Date: Wed, 3 Nov 2004 16:29:09 +0000
Subject: [PATCH] Add frisbee-mfs and frisbee-mfs-install targets that account
 for the non-standard installation of client software in the frisbee MFS.

---
 GNUmakefile.in                    | 18 +++++++++++++++-
 cdrom/groklilo/GNUmakefile.in     |  6 ++++--
 os/GNUmakefile.in                 | 12 +++++++----
 os/frisbee.redux/GNUmakefile.in   |  4 +++-
 os/growdisk/GNUmakefile.in        |  2 +-
 tmcd/GNUmakefile.in               |  5 +++++
 tmcd/common/paths.sh              |  4 +++-
 tmcd/freebsd/GNUmakefile.in       | 35 ++++++++++++++++++++++++++++++-
 tmcd/freebsd/mfs-frisbee-rc.conf  | 12 +++++++++++
 tmcd/freebsd/mfs-frisbee-rc.local |  6 ++++++
 10 files changed, 93 insertions(+), 11 deletions(-)
 create mode 100644 tmcd/freebsd/mfs-frisbee-rc.conf
 create mode 100644 tmcd/freebsd/mfs-frisbee-rc.local

diff --git a/GNUmakefile.in b/GNUmakefile.in
index 565d51f1aa..d5615b6a95 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -118,7 +118,13 @@ destdircheck:
 	    false; \
 	fi
 
-mfs:
+mfsoscheck:
+	@if [ `uname -s` != "FreeBSD" ]; then \
+	    echo "Must build MFS files on a FreeBSD system!"; \
+	    false; \
+	fi
+
+mfs: mfsoscheck
 	@$(MAKE) -C os mfs
 	@$(MAKE) -C sensors mfs
 	@$(MAKE) -C tmcd mfs
@@ -128,6 +134,16 @@ mfs-install: destdircheck mfs
 	@$(MAKE) -C sensors mfs-install
 	@$(MAKE) -C tmcd mfs-install
 
+frisbee-mfs: mfsoscheck
+	@$(MAKE) -C cdrom/groklilo client
+	@$(MAKE) -C os frisbee-mfs
+	@$(MAKE) -C tmcd frisbee-mfs
+
+frisbee-mfs-install: destdircheck frisbee-mfs
+	@CLIENT_BINDIR=/etc/testbed $(MAKE) -e -C cdrom/groklilo client-install
+	@$(MAKE) -C os frisbee-mfs-install
+	@$(MAKE) -C tmcd frisbee-mfs-install
+
 #
 # A check to see if this is a 'real' install. Kinda hacky, but as far as I can
 # tell, you can't put ifeq()'s inside of targets
diff --git a/cdrom/groklilo/GNUmakefile.in b/cdrom/groklilo/GNUmakefile.in
index 206eceff55..9eeac26efc 100644
--- a/cdrom/groklilo/GNUmakefile.in
+++ b/cdrom/groklilo/GNUmakefile.in
@@ -18,8 +18,10 @@ CFLAGS	+= -O -g -Wall -I${OBJDIR} -UINBOOTLOADER
 groklilo: groklilo.c
 	$(CC) $(CFLAGS) -static -g -o groklilo $< $(LFLAGS)
 
-client-install: groklilo
-	$(INSTALL_PROGRAM) groklilo $(DESTDIR)$(CLIENT_BINDIR)
+client: groklilo
+
+client-install: client
+	$(INSTALL_PROGRAM) -s groklilo $(DESTDIR)$(CLIENT_BINDIR)
 
 clean:
 	rm -f *.o core groklilo
diff --git a/os/GNUmakefile.in b/os/GNUmakefile.in
index b5fb3ce853..90955c766b 100644
--- a/os/GNUmakefile.in
+++ b/os/GNUmakefile.in
@@ -48,15 +48,19 @@ endif
 	$(MAKE) -C genhostsfile client-install
 
 mfs:
-ifeq ($(SYSTEM),FreeBSD)
 	$(MAKE) -C imagezip client
-endif
 
 mfs-install: mfs
-ifeq ($(SYSTEM),FreeBSD)
 	$(INSTALL_PROGRAM) $(SRCDIR)/create-image $(LBINDIR)/create-image
 	$(MAKE) -C imagezip client-install
-endif
+
+frisbee-mfs:
+	$(MAKE) -C frisbee.redux client
+	$(MAKE) -C growdisk client
+
+frisbee-mfs-install: frisbee-mfs
+	CLIENT_BINDIR=/etc/testbed $(MAKE) -e -C frisbee.redux client-install
+	CLIENT_BINDIR=/etc/testbed $(MAKE) -e -C growdisk client-install
 
 remote-install: 
 	$(INSTALL) -m 755 -o root -g wheel -d $(LBINDIR)
diff --git a/os/frisbee.redux/GNUmakefile.in b/os/frisbee.redux/GNUmakefile.in
index a259aedb7b..c596c1ac81 100644
--- a/os/frisbee.redux/GNUmakefile.in
+++ b/os/frisbee.redux/GNUmakefile.in
@@ -83,7 +83,9 @@ trace.o:	decls.h trace.h log.h
 
 install:	$(INSTALL_SBINDIR)/frisbeed
 
-client-install: frisbee
+client: frisbee
+
+client-install: client
 	$(INSTALL_PROGRAM) frisbee $(DESTDIR)$(CLIENT_BINDIR)
 
 clean:
diff --git a/os/growdisk/GNUmakefile.in b/os/growdisk/GNUmakefile.in
index af01692fcd..ddfff86c4b 100644
--- a/os/growdisk/GNUmakefile.in
+++ b/os/growdisk/GNUmakefile.in
@@ -26,7 +26,7 @@ install:
 
 client: all
 client-install: client
-	$(INSTALL_PROGRAM) growdisk $(DESTDIR)$(CLIENT_BINDIR)
+	$(INSTALL_PROGRAM) -s growdisk $(DESTDIR)$(CLIENT_BINDIR)
 
 clean:
 	rm -f *.o growdisk growdisk.debug
diff --git a/tmcd/GNUmakefile.in b/tmcd/GNUmakefile.in
index 9add9d6f4a..da906143d8 100644
--- a/tmcd/GNUmakefile.in
+++ b/tmcd/GNUmakefile.in
@@ -107,6 +107,11 @@ mfs: client
 mfs-install: mfs
 	@$(MAKE) -C $(MDSUBDIR) mfs-install
 
+frisbee-mfs: client
+
+frisbee-mfs-install: frisbee-mfs
+	@$(MAKE) -C $(MDSUBDIR) frisbee-mfs-install
+
 $(INSTALL_BINDIR)/tmcd/%: %
 	@echo "Installing $<"
 	-mkdir -p $(INSTALL_BINDIR)/tmcd
diff --git a/tmcd/common/paths.sh b/tmcd/common/paths.sh
index e7efea2a57..8223b84c49 100644
--- a/tmcd/common/paths.sh
+++ b/tmcd/common/paths.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # EMULAB-COPYRIGHT
-# Copyright (c) 2000-2003 University of Utah and the Flux Group.
+# Copyright (c) 2000-2004 University of Utah and the Flux Group.
 # All rights reserved.
 #
 
@@ -31,6 +31,8 @@ elif [ -d /etc/testbed ]; then
 	BINDIR=/etc/testbed
 	VARDIR=/etc/testbed
 	BOOTDIR=/etc/testbed
+	LOGDIR=/tmp
+	LOCKDIR=/tmp
 	DBDIR=/etc/testbed
 elif [ -d /etc/rc.d/testbed ]; then
 	ETCDIR=/etc/rc.d/testbed
diff --git a/tmcd/freebsd/GNUmakefile.in b/tmcd/freebsd/GNUmakefile.in
index 4a2344967a..27e15b9471 100644
--- a/tmcd/freebsd/GNUmakefile.in
+++ b/tmcd/freebsd/GNUmakefile.in
@@ -28,7 +28,6 @@ all:	supfile injail $(SCRIPTS)
 
 include $(TESTBED_SRCDIR)/GNUmakerules
 
-DESTDIR		= 
 SYSETCDIR	= $(DESTDIR)/etc
 JAILDIR		= $(SYSETCDIR)/jail
 ETCDIR		= $(DESTDIR)$(CLIENT_ETCDIR)
@@ -46,6 +45,10 @@ destdircheck:
 	    echo "You must define DESTDIR for this target!"; \
 	    false; \
 	fi
+	@if [ "$(DESTDIR)" = "/" ]; then \
+	    echo "DESTDIR is '/', really really bad idea!"; \
+	    false; \
+	fi
 
 install client-install:	common-install etc-install \
 			sup-install script-install bin-install jail-install
@@ -58,6 +61,36 @@ mfs-install:	destdircheck common-install etc-install \
 	    echo >$(ISMFS) "This file indicates its the MFS. DO NOT DELETE!"; \
 	fi
 
+#
+# XXX butt-uglies live here:
+#   - hardwire /etc/testbed instead of $(ETCDIR)
+#   - rather than keep a special copy of the master.passwd file that has
+#     root's shell as sh instead of csh, we just link sh to csh in the MFS.
+#   - no ismfs file since we don't run any perl scripts that need it
+#
+frisbee-mfs-install:	destdircheck
+	$(INSTALL) -m 644 $(SRCDIR)/mfs-frisbee-rc.conf $(SYSETCDIR)/rc.conf
+	$(INSTALL) -m 644 $(SRCDIR)/mfs-frisbee-rc.local $(SYSETCDIR)/rc.local
+	$(INSTALL) -m 755 $(SRCDIR)/dhclient-exit-hooks \
+			$(SYSETCDIR)/dhclient-exit-hooks
+	@if [ -r $(SRCDIR)/master.passwd ]; then \
+	    $(INSTALL) -m 600 $(SRCDIR)/master.passwd $(SYSETCDIR); \
+	    pwd_mkdb -d $(SYSETCDIR) $(SYSETCDIR)/master.passwd; \
+	    if [ ! -e $(DESTDIR)/bin/csh ]; then \
+		ln $(DESTDIR)/bin/sh $(DESTDIR)/bin/csh; \
+	    fi \
+	fi
+	@if [ -r $(SRCDIR)/group ]; then \
+	    $(INSTALL) -m 644 $(SRCDIR)/group $(SYSETCDIR); \
+	fi
+	$(INSTALL) -m 755 $(SRCDIR)/control_interface $(SYSETCDIR)/testbed
+	$(INSTALL) -m 755 $(SRCDIR)/dhclient $(SYSETCDIR)/testbed
+	$(INSTALL) -m 755 $(SRCDIR)/rc.frisbee $(SYSETCDIR)/testbed
+	$(INSTALL) -m 755 $(SRCDIR)/rc.ipod $(SYSETCDIR)/testbed
+	$(INSTALL) -m 755 $(SRCDIR)/slicefix $(SYSETCDIR)/testbed
+	$(INSTALL) -m 755 -s ../tmcc-nossl $(SYSETCDIR)/testbed/tmcc
+	$(INSTALL) -m 755 -s ../findif $(SYSETCDIR)/testbed
+
 cdboot-install:	destdircheck common-install etc-install \
 			script-install bin-install
 	$(INSTALL) -m 755 $(SRCDIR)/cdboot/rc.conf $(SYSETCDIR)/rc.conf
diff --git a/tmcd/freebsd/mfs-frisbee-rc.conf b/tmcd/freebsd/mfs-frisbee-rc.conf
new file mode 100644
index 0000000000..4ff2a17b35
--- /dev/null
+++ b/tmcd/freebsd/mfs-frisbee-rc.conf
@@ -0,0 +1,12 @@
+sendmail_enable="NONE"
+sshd_enable="NO"
+syslogd_enable="NO"
+inetd_enable="NO"
+cron_enable="NO"
+ldconfig_paths=""
+ldconfig_paths_aout=""
+blanktime="NO"
+update_motd="NO"
+network_interfaces="lo0"
+ifconfig_lo0="DHCP"
+dhcp_program="/etc/testbed/dhclient"
diff --git a/tmcd/freebsd/mfs-frisbee-rc.local b/tmcd/freebsd/mfs-frisbee-rc.local
new file mode 100644
index 0000000000..48c024cbf6
--- /dev/null
+++ b/tmcd/freebsd/mfs-frisbee-rc.local
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+if [ -x /etc/testbed/rc.frisbee ]; then
+       	echo "Playing Frisbee ..."
+        /etc/testbed/rc.frisbee
+fi
-- 
GitLab