Commit 60f04310 authored by Leigh B. Stoller's avatar Leigh B. Stoller

A bunch of changes for a "standalone" clearinghouse. Presently this

its really a hugely stripped down Emulab boss install, using a very
short version of install/boss-install to get a few things into place.

I refactored a few things in both the protogeni code and the Emulab
code, and whacked a bunch of makefiles and configure stuff. The result
is that we only need to install about 10-12 files from the Emulab
code, plus the protogeni code. Quite manageable, if you don't mind
that it requires FreeBSD 6.X ... Still, I think it satisfies the
requirement that we have a packaged clearinghouse that can be run
standalone from a running Emulab site.
parent d3600eb2
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2008 University of Utah and the Flux Group.
# Copyright (c) 2000-2009 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -23,15 +23,31 @@ SETUID_BIN_SCRIPTS =
SETUID_SBIN_SCRIPTS = tbacct addpubkey mkusercert mksyscert
SETUID_LIBX_SCRIPTS =
#
# Targets
#
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
TARGETS = $(SBIN_STUFF) $(LIBEXEC_STUFF) $(CTRLSBIN_STUFF)
else
TARGETS = mksyscert
SETUID_SBIN_SCRIPTS = mksyscert
endif
#
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
#
all: $(SBIN_STUFF) $(LIBEXEC_STUFF) $(CTRLSBIN_STUFF)
all: $(TARGETS)
include $(TESTBED_SRCDIR)/GNUmakerules
install: all script-install
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
install: boss-install
else
install: clrhouse-install
endif
boss-install: all script-install
@echo "Don't forget to do a post-install as root"
script-install: $(addprefix $(INSTALL_SBINDIR)/, $(SBIN_STUFF)) \
......@@ -53,6 +69,9 @@ control-install:
hook-install: $(addprefix $(INSTALL_DIR)/opsdir/sbin/, $(CTRLSBIN_STUFF))
# Clearinghouse install.
clrhouse-install: $(INSTALL_SBINDIR)/mksyscert
# This rule says what web* script depends on which installed binary directory.
$(LIBEXEC_STUFF): $(INSTALL_SBINDIR)
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2008 University of Utah and the Flux Group.
# Copyright (c) 2000-2009 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
......@@ -13,9 +13,8 @@ use Getopt::Std;
#
use lib "@prefix@/lib";
use libaudit;
use libdb;
use emutil;
use libtestbed;
use User;
#
# Create system SSL certificates.
......@@ -43,11 +42,8 @@ my $TBLOGS = "@TBLOGSEMAIL@";
my $OURDOMAIN = "@OURDOMAIN@";
my $PGENIDOMAIN = "@PROTOGENI_DOMAIN@";
my $PGENISUPPORT= @PROTOGENI_SUPPORT@;
my $CONTROL = "@USERNODE@";
my $BOSSNODE = "@BOSSNODE@";
# Locals
my $USERDIR = USERROOT();
my $SSLDIR = "$TB/lib/ssl";
my $TEMPLATE = "$SSLDIR/syscert.cnf";
my $CACONFIG = "$SSLDIR/ca.cnf";
......@@ -160,12 +156,6 @@ if (@ARGV < 1) {
my $orgunit = shift(@ARGV);
my $uuid = (@ARGV ? shift(@ARGV) : undef);
# Map invoking user to object.
my $this_user = User->LookupByUnixId($UID);
if (! defined($this_user)) {
fatal("You ($UID) do not exist!");
}
# Generate/confirm uuid
if (!defined($uuid)) {
$uuid = NewUUID();
......
......@@ -269,7 +269,8 @@ if ($WIKISUPPORT) {
# And the email address has to be unique.
#
UserError("Email address already in use; please pick another!")
if (User->LookupByEmail($newuser_args{'usr_email'}));
if ($newuser_args{'usr_email'} ne $TBOPS &&
User->LookupByEmail($newuser_args{'usr_email'}));
#
# Check the password.
......
......@@ -1454,6 +1454,8 @@ done
......@@ -1537,6 +1539,7 @@ REMOTEWIKIDOCS=1
PROTOGENI_SUPPORT=0
PROTOGENI_CLEARINGHOUSE=0
PROTOGENI_DOMAIN="unknown"
STANDALONE_CLEARINGHOUSE=0
#
# XXX You really don't want to change these!
......@@ -2139,17 +2142,17 @@ for ac_hdr in ulxmlrpcpp/ulxr_config.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:2142: checking for $ac_hdr" >&5
echo "configure:2146: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2147 "configure"
#line 2151 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2152: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2156: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -2188,17 +2191,17 @@ for ac_hdr in linux/videodev.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:2191: checking for $ac_hdr" >&5
echo "configure:2195: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2196 "configure"
#line 2200 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2201: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2205: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -2231,7 +2234,7 @@ done
# Extract the first word of "gtk-config", so it can be a program name with args.
set dummy gtk-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2234: checking for $ac_word" >&5
echo "configure:2238: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GTK_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -2310,7 +2313,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:2313: checking for a BSD compatible install" >&5
echo "configure:2317: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -2371,7 +2374,7 @@ esac
# Extract the first word of "rsync", so it can be a program name with args.
set dummy rsync; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2374: checking for $ac_word" >&5
echo "configure:2378: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_RSYNC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -2892,6 +2895,7 @@ s%@REMOTEWIKIDOCS@%$REMOTEWIKIDOCS%g
s%@PROTOGENI_SUPPORT@%$PROTOGENI_SUPPORT%g
s%@PROTOGENI_CLEARINGHOUSE@%$PROTOGENI_CLEARINGHOUSE%g
s%@PROTOGENI_DOMAIN@%$PROTOGENI_DOMAIN%g
s%@STANDALONE_CLEARINGHOUSE@%$STANDALONE_CLEARINGHOUSE%g
s%@TBOPSEMAIL@%$TBOPSEMAIL%g
s%@TBOPSEMAIL_NOSLASH@%$TBOPSEMAIL_NOSLASH%g
s%@TBROBOCOPSEMAIL@%$TBROBOCOPSEMAIL%g
......
......@@ -210,6 +210,7 @@ AC_SUBST(REMOTEWIKIDOCS)
AC_SUBST(PROTOGENI_SUPPORT)
AC_SUBST(PROTOGENI_CLEARINGHOUSE)
AC_SUBST(PROTOGENI_DOMAIN)
AC_SUBST(STANDALONE_CLEARINGHOUSE)
#
# Offer both versions of the email addresses that have the @ escaped
......@@ -291,6 +292,7 @@ REMOTEWIKIDOCS=1
PROTOGENI_SUPPORT=0
PROTOGENI_CLEARINGHOUSE=0
PROTOGENI_DOMAIN="unknown"
STANDALONE_CLEARINGHOUSE=0
#
# XXX You really don't want to change these!
......
......@@ -37,26 +37,40 @@ USERLIBS = libtbdb.pm libdb.py
SETUID_BIN_SCRIPTS =
SETUID_SBIN_SCRIPTS = genelists dhcpd_makeconf elabinelab_bossinit \
changecreator
SETUID_LIBX_SCRIPTS =
SETUID_LIBX_SCRIPTS =
#
# Targets
#
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
TARGETS = $(BIN_SCRIPTS) $(SBIN_SCRIPTS) $(LIBEXEC_SCRIPTS) $(LIB_SCRIPTS) \
$(USERSBINS) $(USERLIBS) schemacheck dbfillcheck
else
TARGETS = emdb.pm emutil.pm emdbi.pm
SETUID_SBIN_SCRIPTS =
endif
#
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
#
all: $(BIN_SCRIPTS) $(SBIN_SCRIPTS) $(LIBEXEC_SCRIPTS) $(LIB_SCRIPTS) \
$(USERSBINS) $(USERLIBS) schemacheck dbfillcheck
all: $(TARGETS)
include $(TESTBED_SRCDIR)/GNUmakerules
install: $(addprefix $(INSTALL_BINDIR)/, $(BIN_SCRIPTS)) \
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
install: boss-install
else
install: clrhouse-install
endif
boss-install: $(addprefix $(INSTALL_BINDIR)/, $(BIN_SCRIPTS)) \
$(addprefix $(INSTALL_SBINDIR)/, $(SBIN_SCRIPTS)) \
$(addprefix $(INSTALL_LIBDIR)/, $(LIB_SCRIPTS)) \
$(addprefix $(INSTALL_LIBEXECDIR)/, $(LIBEXEC_SCRIPTS)) \
$(addprefix $(INSTALL_DIR)/opsdir/sbin/, $(USERSBINS)) \
$(addprefix $(INSTALL_DIR)/opsdir/lib/, $(USERLIBS))
boss-install: install
post-install:
chown root $(INSTALL_SBINDIR)/genelists
chmod u+s $(INSTALL_SBINDIR)/genelists
......@@ -71,6 +85,9 @@ post-install:
control-install: $(addprefix $(INSTALL_SBINDIR)/, $(USERSBINS)) \
$(addprefix $(INSTALL_LIBDIR)/, $(USERLIBS))
# Clearinghouse install.
clrhouse-install: $(addprefix $(INSTALL_LIBDIR)/, $(TARGETS))
# This rule says what web* script depends on which installed binary directory.
$(WEB_SBIN_SCRIPTS): $(INSTALL_SBINDIR)
$(WEB_BIN_SCRIPTS): $(INSTALL_BINDIR)
......
......@@ -127,8 +127,8 @@ SSLCERT_ORGNAME="Utah Network Testbed"
# For boss this is an address on the private segment of the control net.
# For users this is an address on the public segment of the control net.
#
BOSSNODE_IP=155.98.32.70
USERNODE_IP=155.98.33.74
BOSSNODE_IP=10.1.32.70
USERNODE_IP=10.1.33.74
FSNODE_IP=$USERNODE_IP
#
......@@ -150,8 +150,8 @@ EXTERNAL_FSNODE_IP=$EXTERNAL_USERNODE_IP
# The overall control network range - this subnet should cover the
# CONTROL, PRIVATE, and PUBLIC networks below.
#
TESTBED_NETWORK=155.98.32.0
TESTBED_NETMASK=255.255.240.0
TESTBED_NETWORK=10.1.32.0
TESTBED_NETMASK=255.255.255.0
#
# As above, if you have internal and external networks, define the
......@@ -163,22 +163,22 @@ EXTERNAL_TESTBED_NETMASK=$TESTBED_NETMASK
#
# The node control network segment.
#
CONTROL_ROUTER_IP=155.98.36.1
CONTROL_NETWORK=155.98.36.0
CONTROL_NETMASK=255.255.252.0
CONTROL_ROUTER_IP=10.1.36.1
CONTROL_NETWORK=10.1.36.0
CONTROL_NETMASK=255.255.255.0
#
# The private network segment.
#
PRIVATE_NETWORK=155.98.32.0
PRIVATE_ROUTER=155.98.32.1
PRIVATE_NETWORK=10.1.32.0
PRIVATE_ROUTER=10.1.32.1
PRIVATE_NETMASK=255.255.255.0
#
# The public network segment.
#
PUBLIC_NETWORK=155.98.33.0
PUBLIC_ROUTER=155.98.33.1
PUBLIC_NETWORK=10.1.33.0
PUBLIC_ROUTER=10.1.33.1
PUBLIC_NETMASK=255.255.255.0
#
......@@ -186,7 +186,7 @@ PUBLIC_NETMASK=255.255.255.0
# to use for new nodes being added to the testbed.
# You need at least one.
#
DHCPD_DYNRANGE="155.98.36.200 155.98.36.249"
DHCPD_DYNRANGE="10.1.36.200 10.1.36.249"
#
# Fill in the nameservers for your campus network here - the nameserver on boss
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2008 University of Utah and the Flux Group.
# Copyright (c) 2000-2009 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -11,15 +11,21 @@ SUBDIR = install
include $(OBJDIR)/Makeconf
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
TARGETS = boss-install ops-install fs-install dump-descriptors load-descriptors
else
TARGETS = clrhouse-install
endif
#
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
#
all: boss-install ops-install fs-install dump-descriptors load-descriptors
all: $(TARGETS)
include $(TESTBED_SRCDIR)/GNUmakerules
install:
install: $(INSTALL_LIBDIR)/libinstall.pm
clean:
rm -f boss-install ops-install fs-install
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2009 University of Utah and the Flux Group.
# All rights reserved.
#
#
# Set up a ProtoGeni Clearinghouse.
#
#
# Configure variables
#
my $PREFIX = '@prefix@';
my $SRCDIR = '@srcdir@';
my $TOP_SRCDIR = '@top_srcdir@';
my $DBNAME = "@TBDBNAME@";
my $ELABINELAB = @ELABINELAB@;
my $OURDOMAIN = '@OURDOMAIN@';
my $LOGFACIL = '@TBLOGFACIL@';
#
# Some programs we use
#
my $SH = "/bin/sh";
my $CHMOD = "/bin/chmod";
my $CHGRP = "/usr/bin/chgrp";
my $CHOWN = "/usr/sbin/chown";
my $PWD = "/bin/pwd";
my $PW = "/usr/sbin/pw";
my $PATCH = "/usr/bin/patch";
my $SSH_KEYGEN = "/usr/bin/ssh-keygen";
my $PKG_INFO = "/usr/sbin/pkg_info";
my $PKG_ADD = "/usr/sbin/pkg_add";
my $PKG_DEL = "/usr/sbin/pkg_delete";
my $TOUCH = "/usr/bin/touch";
my $SSH_INIT = "/usr/bin/ssh -1";
my $SCP_INIT = "/usr/bin/scp -1";
my $SSH = "/usr/bin/ssh -2";
my $SCP = "/usr/bin/scp -2";
my $CP = "/bin/cp";
my $ENV = "/usr/bin/env";
my $MOUNT = "/sbin/mount";
my $SUDO = "/usr/local/bin/sudo";
my $SUIDPERL = "/usr/bin/suidperl";
my $GMAKE = "/usr/local/bin/gmake";
my $MYSQL = "/usr/local/bin/mysql";
my $MYSQLADMIN = "/usr/local/bin/mysqladmin";
my $MYSQLSHOW = "/usr/local/bin/mysqlshow";
my $MYSQLDUMP = "/usr/local/bin/mysqldump";
my $MYSQLINSTALL = "/usr/local/bin/mysql_install_db";
my $MYSQLDBDIR = "/var/db/mysql";
#
# Some files we edit/create
#
my $CRONTAB = "/etc/crontab";
my $RCCONF = "/etc/rc.conf";
my $SYSLOG_CONF = "/etc/syslog.conf";
my $NEWSYSLOG_CONF = "/etc/newsyslog.conf";
my $PROTOUSER = "elabman";
my $PROTOUSER_KEY = "$TOP_SRCDIR/install/elabman_dsa.pub";
my $ROOT_PRIVKEY = "/root/.ssh/id_rsa";
my $ROOT_PUBKEY = "$ROOT_PRIVKEY.pub";
my $ROOT_AUTHKEY = "/root/.ssh/authorized_keys";
my $APACHE_ETCDIR = "/usr/local/etc/apache";
my $SUDOERS = "/usr/local/etc/sudoers";
my $HTTPD_CONF = "$APACHE_ETCDIR/httpd.conf";
my $PHP_INI = "/usr/local/etc/php.ini";
my $WAP = "$PREFIX/sbin/withadminprivs";
my $GENCRLBUNDLE = "$PREFIX/sbin/protogeni/gencrlbundle";
my $M2CRYPTO_PATCH = "$TOP_SRCDIR/patches/m2crypto.patch";
my $MYSQL_PM_PATCH = "$TOP_SRCDIR/patches/Mysql.pm.patch";
my $SSH_CONFIG = "/etc/ssh/ssh_config";
my $SYSCTL_CONF = "/etc/sysctl.conf";
my $EMULAB_PEM = "emulab.pem";
# Apache certs on both boss and ops
my $APACHE_CERTPEM = "apache_cert.pem";
my $APACHE_KEYPEM = "apache_key.pem";
my $APACHE_CERTFILE = "$APACHE_ETCDIR/ssl.crt/www.${OURDOMAIN}.crt";
my $APACHE_KEYFILE = "$APACHE_ETCDIR/ssl.key/www.${OURDOMAIN}.key";
# XXX temporary for perl DBD mysql access
my $P5DBD_PKG = "p5-DBD-mysql50-3.0002";
# XXX temporary until fix dependencies in emulab-boss package
my $P5GD_PKG = "p5-GD-2.07";
#
# Some directories we care about
#
my $LOGDIR = "$PREFIX/log";
my $MYSQL_LOGDIR = "$LOGDIR/mysql";
my $RCDIR = "/usr/local/etc/rc.d";
my $PORTSDIR = "/usr/ports";
my $PORTSMISCDIR = "$PORTSDIR/misc";
my $VARRUN = "/var/run";
my $ETCSSH = "/etc/ssh";
#
# And some lists that we use
#
my @TESTBED_DIRS = ($PREFIX);
my @LOGFILES = ("$LOGDIR/pubsubd.log");
# Version of FreeBSD.
my $FBSD_MAJOR = 4;
my $FBSD_MINOR = 10;
if (`uname -r` =~ /^(\d+)\.(\d+)/) {
$FBSD_MAJOR = $1;
$FBSD_MINOR = $2;
}
else {
die("Could not determine what version of FreeBSD you are running!\n");
}
#
# The meta-ports (name and version) that drag in all the dependancies for
# a boss node. These are OS dependent as we upgrade.
#
my $PORTNAME = "emulab-clrhouse-1.1";
#
# Figure out which directory we live in, so that some stages can do thing
# relative to it.
#
my $OBJDIR = `/usr/bin/dirname $0`;
chomp $OBJDIR;
my $TOP_OBJDIR = "$OBJDIR/..";
#
# Allow this to work if the library is left in the source directory
#
use lib '@srcdir@';
use English;
use libinstall;
use Getopt::Std;
#
# Handle command-line options
#
sub usage {
print "Usage: boss-install [-b] [-p packagedir] [-s] [-P portname]\n";
print " Required: -p (for binary packages) or -s (for source makes.)\n";
exit(1);
}
my $packagedir = "";
my $batchmode = 0;
my $domakes = 0;
my $password;
my %opts;
if (! getopts("P:p:bsw:", \%opts)) {
usage();
}
if (defined($opts{p})) {
$packagedir = $opts{p};
}
if (defined($opts{b})) {
$batchmode = 1;
}
if (defined($opts{s})) {
$domakes = 1;
}
if (defined($opts{w})) {
$password = $opts{w};
}
if (defined($opts{P})) {
$PORTNAME = $opts{P};
}
# Don't just charge into making ports from source by default.
if ($packagedir eq "" and $domakes eq 0) {
print "At least one of -p and -s must be given.\n";
usage();
}
if ($packagedir ne "" and $domakes eq 1) {
print "Only one of -p and -s can be given.\n";
usage();
}
if (@ARGV) {
usage();
}
#
# Make sure they know what they're getting into...
#
if (! $batchmode) {
print STDERR
"WARNING: This script is ONLY intended to be run on a machine\n";
print STDERR
"that is being set up as a dedicated ClearingHouse Continue? [y/N] ";
my $response = <>;
die "Installation aborted!\n" unless ($response =~ /^y/i);
}
if ($UID != 0) {
die "This script must be run as root.\n";
}
Phase "usersgroups", "Creating users and groups", sub {
Phase "tbadmin", "Creating tbadmin group", sub {
if (getgrnam("tbadmin")) {
PhaseSkip("Group already exists");
}
ExecQuietFatal("$PW groupadd tbadmin -g 101");
};
Phase "GeniSlices", "Creating geni group", sub {
if (getgrnam("GeniSlices")) {
PhaseSkip("Group already exists");
}
ExecQuietFatal("$PW groupadd GeniSlices -g 102");
};
Phase "geniuser", "Creating geni user", sub {
if (getpwnam("geniuser")) {
PhaseSkip("User already exists");
}
ExecQuietFatal("$PW useradd geniuser -u 5998 -g guest -h - ".
"-s /sbin/nologin -c 'Geni User'");
};
Phase "root", "Creating root group", sub {
if (getgrnam("root")) {
PhaseSkip("Group already exists");
}
ExecQuietFatal("$PW groupadd root -g 103");
};
# Added next two cause the mysql package does not do this (port does).
Phase "mysqlgroup", "Creating mysql group", sub {
if (getgrnam("mysql")) {
PhaseSkip("Group already exists");
}
ExecQuietFatal("$PW groupadd mysql -g 88");
};
Phase "mysqluser", "Creating mysql user", sub {
if (getpwnam("mysql")) {
PhaseSkip("User already exists");
}
ExecQuietFatal("$PW useradd mysql -u 88 -g 88 -h - ".
"-d $MYSQLDBDIR -s /sbin/nologin -c 'MySQL Daemon'");
};
ExecQuietFatal("$CHOWN mysql:mysql $MYSQLDBDIR")
if (-e $MYSQLDBDIR);
};
Phase "dirs", "Setting directory permissions", sub {
foreach my $dir (@TESTBED_DIRS) {
Phase $dir, $dir, sub {
if (!-d $dir) {
PhaseFail("Directory $dir does not exist");
}
my ($mode,$group) = (stat($dir))[2,5];
# Fix up the mode (strip file type)
$mode = $mode & 0777;
if ($mode == 0775 && $group eq getgrnam("tbadmin")) {
PhaseSkip("Already done");
}
ExecQuietFatal("$CHGRP tbadmin $dir");
ExecQuietFatal("$CHMOD 0775 $dir");
};
}
};
Phase "ports", "Installing ports", sub {
if (!ExecQuiet("$PKG_INFO -e $PORTNAME")) {
PhaseSkip("Package already installed");
}
Phase "pcopy", "Copying ports into place", sub {
DoneIfExists("$PORTSMISCDIR/emulab-clrhouse");
ExecQuietFatal("$SH $SRCDIR/ports/ports-install");
};
PhaseFail("Please install ports manually, since some\n of them are " .
"interactive. Run: \n" .
" cd $PORTSMISCDIR/emulab-clrhouse && make install\n" .
"then re-run this script.");
};
Phase "portfixup", "Fixing up packages", sub {
Phase "rsync", "Looking for rsync", sub {
if (!ExecQuiet("$PKG_INFO -x rsync")) {
PhaseSkip("rsync already installed