Commit 91e96bab authored by Leigh B. Stoller's avatar Leigh B. Stoller

* Create /etc/hosts on boss and make sure that names resolve.

* Reorder and reorg slightly the ports install section to deal with
  the case where the ports are already installed from packages before
  calling boss-install.

* Install initial self signed apache cert/key from the ssl directory
  so that apache will run right away. Also make sure that startup file
  in /usr/local/etc/rc.d is renamed so it runs at bootup.

* Build and install testbed tree from boss-install. This is nice for
  inner elab, but might not be such a good idea for real installations
  cause it goes away for a really long time, and cause the output from
  the make is lost. Rob, suggestions? Maybe just redirect the output
  and tell the user about it?

* Install newly created dhcpd.conf template file, and generate a new
  dhcpd.conf file from it. Also, touch /var/db/dhcpd.leases or else
  dhcpd breaks. How stupid is that?
parent 38a39130
......@@ -32,6 +32,8 @@ my $LOGFACIL = '@TBLOGFACIL@';
my $USERNODE = '@USERNODE@';
my $FSNODE = '@FSNODE@';
my $BOSSNODE = '@BOSSNODE@';
my $BOSSNODE_IP= '@BOSSNODE_IP@';
my $USERNODE_IP= '@USERNODE_IP@';
#
# Some programs we use
......@@ -61,13 +63,13 @@ my $MYSQLSHOW = "/usr/local/bin/mysqlshow";
my $MYSQLDUMP = "/usr/local/bin/mysqldump";
my $GMAKE = "/usr/local/bin/gmake";
my $RNDC_CONFGEN = "/usr/local/sbin/rndc-confgen";
#
# Some files we edit/create
#
my $CRONTAB = "/etc/crontab";
my $HOSTS = "/etc/hosts";
my $FSTAB = "/etc/fstab";
my $RCCONF = "/etc/rc.conf";
my $SYSLOG_CONF = "/etc/syslog.conf";
......@@ -80,6 +82,12 @@ my $ROOT_AUTHKEY = "/root/.ssh/authorized_keys";
my $SUDOERS = "/usr/local/etc/sudoers";
my $HTTPD_CONF = "/usr/local/etc/apache/httpd.conf";
my $PHP_INI = "/usr/local/etc/php.ini";
my $DHCPD_CONF = "/usr/local/etc/dhcpd.conf";
my $DHCPD_TEMPLATE = "/usr/local/etc/dhcpd.conf.template";
my $DHCPD_LEASES = "/var/db/dhcpd.leases";
my $DHCPD_MAKECONF = "$PREFIX/sbin/dhcpd_makeconf";
my $APACHE_CERTFILE = "/usr/local/etc/apache/ssl.crt/www.${OURDOMAIN}.crt";
my $APACHE_KEYFILE = "/usr/local/etc/apache/ssl.key/www.${OURDOMAIN}.key";
my $CRACKLIB_DICT = "/usr/local/lib/pw_dict.pwd";
......@@ -100,6 +108,8 @@ my $EMULAB_PEM = "emulab.pem";
my $CLIENT_PEM = "client.pem";
my $CTRLNODE_PEM = "ctrlnode.pem";
my $ETC_EMULAB_DIR = "/etc/emulab";
my $APACHE_CERTPEM = "apache_cert.pem";
my $APACHE_KEYPEM = "apache_key.pem";
#
# Some directories we care about
......@@ -138,7 +148,12 @@ my @LOGFILES = ("$LOGDIR/bootinfo.log", "$LOGDIR/tmcd.log",
my @CISCO_MIBS = ("CISCO-SMI", "CISCO-TC", "CISCO-VTP-MIB", "CISCO-PAGP-MIB",
"CISCO-PRIVATE-VLAN-MIB", "CISCO-STACK-MIB", "CISCO-VLAN-MEMBERSHIP-MIB");
my @OPS_NAMES = ($FSNODE, $USERNODE);
#
# List of names that goes into $HOSTS and which must resolve.
#
my @OPS_NAMES = ($USERNODE, "users", "ops");
push(@OPS_NAMES, $FSNODE)
if ($USERNODE ne $FSNODE);
#
# The meta-port (name and version) that drags in all the dependancies for
......@@ -278,43 +293,34 @@ Phase "tftp", "Setting up directories for tftp", sub {
};
Phase "ports", "Installing ports", sub {
# Ick. The php4 port is broken with SSL, so we have to patch it - hopefully
# it'll get fixed someday, and we remove this
Phase "php4patch", "Patching php4 port", sub {
if (!ExecQuiet("$PATCH -C -f -l -R -p0 -i $PHP4_PATCH")) {
PhaseSkip("$PHP4_PATCH already applied");
}
ExecQuietFatal("$PATCH -f -l -p0 -i $PHP4_PATCH");
};
if (!ExecQuiet("$PKG_INFO -e $BOSS_PORT")) {
PhaseSkip("Ports already installed");
}
Phase "packages", "Installing packages", sub {
if (!ExecQuiet("$PKG_INFO -e $BOSS_PORT")) {
PhaseSkip("Ports already installed");
}
if (!$packagedir) {
PhaseSkip("No package directory provided");
}
ExecQuietFatal("$ENV PKG_PATH=$packagedir $PKG_ADD $BOSS_PORT");
};
if ($packagedir) {
PhaseSkip("Packages installed okay");
}
Phase "pcopy", "Copying ports into place", sub {
if ($packagedir) {
PhaseSkip("Package directory provided");
}
DoneIfExists("$PORTSDIR/emulab-boss");
ExecQuietFatal("$SH $SRCDIR/ports/ports-install");
};
Phase "pinstall", "Checking for port installation", sub {
if (!ExecQuiet("$PKG_INFO -e $BOSS_PORT")) {
PhaseSkip("Ports already installed");
}
if ($packagedir) {
PhaseSkip("Package directory provided");
# Ick. The php4 port is broken with SSL, so we have to patch it - hopefully
# it'll get fixed someday, and we remove this
Phase "php4patch", "Patching php4 port", sub {
if (!ExecQuiet("$PATCH -C -f -l -R -p0 -i $PHP4_PATCH")) {
PhaseSkip("$PHP4_PATCH already applied");
}
PhaseFail("Please install ports manually, since some\n of them are " .
"interactive. Run: \n" .
"cd $PORTSDIR/emulab-boss && make install\n" .
"then re-run this script.");
ExecQuietFatal("$PATCH -f -l -p0 -i $PHP4_PATCH");
};
PhaseFail("Please install ports manually, since some\n of them are " .
"interactive. Run: \n" .
"cd $PORTSDIR/emulab-boss && make install\n" .
"then re-run this script.");
};
Phase "patches", "Applying patches", sub {
......@@ -565,8 +571,15 @@ Phase "suidperl", "Setting the suid bit on $SUIDPERL", sub {
ExecQuietFatal("$CHMOD u+s $SUIDPERL");
};
Phase "hosts", "Adding boss/ops IP addresses to $HOSTS", sub {
DoneIfEdited($HOSTS);
AppendToFileFatal($HOSTS,
"${BOSSNODE_IP}\t${BOSSNODE} boss",
"${USERNODE_IP}\t@OPS_NAMES");
};
Phase "resolve", "Checking to make sure names for ops resolve", sub {
foreach my $name (@OPS_NAMES) {
foreach my $name (@OPS_NAMES, ${BOSSNODE}, "boss") {
Phase $name, $name, sub {
if (gethostbyname($name)) {
PhaseSkip("$name resolves");
......@@ -717,6 +730,22 @@ Phase "sslcerts", "Setting up SSL certificates", sub {
" chmod 640 ${ETC_EMULAB_DIR}/${CLIENT_PEM}; ".
" chmod 640 ${ETC_EMULAB_DIR}/${EMULAB_PEM} ");
};
Phase "apache", "Installing Apache SSL cert and key", sub {
Phase "cert", "Installing Apache SSL certificate", sub {
DoneIfExists("$APACHE_CERTFILE");
ExecQuietFatal("$CP $TOP_OBJDIR/ssl/$APACHE_CERTPEM ".
" $APACHE_CERTFILE");
};
Phase "key", "Installing Apache SSL key", sub {
DoneIfExists("$APACHE_KEYFILE");
ExecQuietFatal("$CP $TOP_OBJDIR/ssl/$APACHE_KEYPEM ".
" $APACHE_KEYFILE");
};
Phase "startup", "Installing Apache startup file", sub {
DoneIfExists("$RCDIR/apache.sh");
ExecQuietFatal("mv $RCDIR/apache.sh.sample $RCDIR/apache.sh");
};
};
};
Phase "event", "Setting up event system", sub {
......@@ -726,6 +755,38 @@ Phase "event", "Setting up event system", sub {
};
};
#
# Build and install software. Note that I am not looking to see if its
# been done; I suppose we could touch a file to indicate that build has
# been completed, but maybe that is not such a good idea.
#
Phase "Software", "Building and Installing Software", sub {
Phase "building", "Building (please be patient)", sub {
ExecQuietFatal("cd $TOP_OBJDIR; $GMAKE");
};
Phase "installing", "Installing (please be patient)", sub {
ExecQuietFatal("cd $TOP_OBJDIR; $GMAKE boss-install");
};
Phase "postinstall", "Post Installing Testbed Software", sub {
ExecQuietFatal("cd $TOP_OBJDIR; $GMAKE post-install");
};
};
Phase "dhcpd", "Setting up initial dhcpd configuration", sub {
Phase "template", "Installing $DHCPD_TEMPLATE", sub {
ExecQuietFatal("$CP $TOP_OBJDIR/dhcpd/dhcpd.conf.template ".
"$DHCPD_TEMPLATE");
};
Phase "config", "Creating $DHCPD_CONF from template", sub {
ExecQuietFatal("$DHCPD_MAKECONF $DHCPD_TEMPLATE > $DHCPD_CONF");
};
# How silly is this?
Phase "leases", "Creating stub leases file", sub {
DoneIfExists("$DHCPD_LEASES");
ExecQuietFatal("touch $DHCPD_LEASES");
};
};
print "----------------------------------------------------------------------\n";
print "Installation completed succesfully!\n";
print "Please reboot this machine before proceeding with boss setup\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment