From 48351539c704d25f89a7036fa962c89e382af727 Mon Sep 17 00:00:00 2001
From: Robert Ricci <ricci@cs.utah.edu>
Date: Sat, 1 Mar 2003 01:10:06 +0000
Subject: [PATCH] Add installation of the ops meta-port to the process.

---
 install/ops-install.in | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/install/ops-install.in b/install/ops-install.in
index 9f3fc187ae..7e4d929750 100644
--- a/install/ops-install.in
+++ b/install/ops-install.in
@@ -2,7 +2,7 @@
 
 #
 # EMULAB-COPYRIGHT
-# Copyright (c) 2000-2003 University of Utah and the Flux Group.
+# Copyright (c) 2003 University of Utah and the Flux Group.
 # All rights reserved.
 #
 
@@ -13,7 +13,7 @@
 # * Figure out where to put directories such as /users /proj - they must
 #   already exist
 # * Fill out mailing list files - presumably, it's easier to just get the
-#   user to edit them himself
+#   User to edit them himself
 #
 
 #
@@ -47,6 +47,9 @@ my $CHGRP      = "/usr/bin/chgrp";
 my $CHMOD      = "/bin/chmod";
 my $PW         = "/usr/sbin/pw";
 my $NEWALIASES = "/usr/bin/newaliases";
+my $SH         = "/bin/sh";
+my $PKG_INFO   = "/usr/sbin/pkg_info";
+my $PWD        = "/bin/pwd";
 
 #
 # Some files we edit/create
@@ -59,12 +62,14 @@ my $EXPORTS_HEAD    = "$EXPORTS_FILE.head";
 my $SYSLOG_CONF     = "/etc/syslog.conf";
 my $NEWSYSLOG_CONF  = "/etc/newsyslog.conf";
 my $SUDOERS         = "/usr/local/etc/sudoers";
+my $PORTSDIR        = "/usr/ports/misc";
 
 #
 # Some directories we care about
 #
 my $LIST_DIR   = "/etc/mail/lists";
 my $TIPLOG_DIR = "/var/log/tiplogs";
+my $SRCDIR     = '@srcdir@';
 
 #
 # And some lists that we use
@@ -116,6 +121,28 @@ Phase "dirs", "Setting directory permissions", sub {
     }
 };
 
+Phase "ports", "Installing ports", sub {
+    Phase "pcopy", "Copying ports into place", sub {
+	DoneIfExists("$PORTSDIR/emulab-ops");
+	ExecQuietFatal("$SH $SRCDIR/ports/ports-install");
+    };
+    Phase "pinstall", "Installing ports (may take a while)", sub {
+	if (!ExecQuiet("$PKG_INFO -e emulab-ops-1.0")) {
+	    PhaseSkip("Ports already installed");
+	}
+
+	#
+	# This port is dead-simple, so it's safe to do it from this script
+	#
+	my $pwd = `$PWD`;
+	chomp $pwd;
+	chdir "$PORTSDIR/emulab-ops" or
+		PhaseFail "Unable to change to $PORTSDIR/emulab-ops: $!";
+	ExecQuietFatal("make install");
+	chdir $pwd;
+    };
+};
+
 Phase "rc.conf", "Adding testbed content to rc.conf", sub {
     DoneIfEdited($RCCONF);
     AppendToFileFatal($RCCONF,
@@ -191,6 +218,7 @@ Phase "exports", "Setting up exports", sub {
 	ExecQuietFatal("cp $EXPORTS_HEAD $EXPORTS_FILE");
     };
 
+    # XXX Newhup
     Phase "mountd", "HUPing mountd", sub {
 	PhaseSkip("No new exports file") if PhaseWasSkipped("ex.head");
 	PhaseSkip("mountd not running") unless `ps -auxw | grep mountd | grep -v grep`;
@@ -256,6 +284,7 @@ Phase "syslog", "Setting up syslog", sub {
 	    Phase $logfile, $logfile, sub {
 		DoneIfExists($logfile);
 		CreateFileFatal($logfile);
+		ExecQuietFatal("$CHGRP tbadmin $logfile");
 		ExecQuietFatal("$CHMOD 640 $logfile");
 	    };
 	}
-- 
GitLab