Commit 3b8becfe authored by Leigh B. Stoller's avatar Leigh B. Stoller

Stuff to change the hostname to the testbed allocated name. I do this

via the dhclient script in FreeBSD, and the pump "script" directive in
Linux.
parent ae159d4d
......@@ -31,8 +31,11 @@ install:
$(INSTALL) -m 755 $(SRCDIR)/rc.testbed $(INSTALL_DIR)/rc.testbed
$(INSTALL) -m 755 $(SRCDIR)/rc.setup $(INSTALL_DIR)/rc.setup
$(INSTALL) -m 755 $(SRCDIR)/runstartup $(INSTALL_DIR)/runstartup
$(INSTALL) -m 755 $(SRCDIR)/sethostname $(INSTALL_DIR)/sethostname
$(INSTALL) -m 644 $(SRCDIR)/hosts $(INSTALL_DIR)/hosts
$(INSTALL) -m 755 ../tmcc $(INSTALL_DIR)/tmcc
$(INSTALL) -m 755 $(SRCDIR)/supfile $(INSTALL_DIR)/supfile
-mkdir -p /root/.cvsup
$(INSTALL) -m 600 $(SRCDIR)/cvsup.auth /root/.cvsup/auth
$(INSTALL) -m 755 $(SRCDIR)/dhclient-exit-hooks \
/etc/dhclient-exit-hooks
#!/bin/sh
#
# See if the Testbed configuration software wants to change the hostname.
# Installed into /etc.
#
exec /etc/testbed/sethostname
#!/usr/bin/perl -wT
use English;
#
# Set the hostname for the node according to the current experiment.
# Run from /etc/dhclient-exit-hooks
#
push(@INC, "/etc/testbed");
require setuplib;
#
# Untaint path
#
$ENV{'PATH'} = '/bin:/sbin:/usr/bin:/usr/local/bin:/etc/rc.d/testbed';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
# Turn off line buffering on output
$| = 1;
#
# Check allocation. Exit now if not allocated.
#
my ($pid, $eid, $vname) = check_status();
if (! $pid) {
exit 0;
}
#
# Otherwise, sethostname
#
my $nickname= "$vname.$eid.$pid";
print STDOUT "Resetting hostname to $nickname ... ";
if (system("hostname $nickname")) {
print STDOUT "*** FAILED!\n";
exit 1;
}
print STDOUT "Done!\n";
exit 0;
......@@ -33,8 +33,10 @@ install:
$(INSTALL) -m 755 $(SRCDIR)/runstartup $(INSTALL_DIR)/runstartup
$(INSTALL) -m 755 $(SRCDIR)/prepare $(INSTALL_DIR)/prepare
$(INSTALL) -m 755 $(SRCDIR)/setup $(INSTALL_DIR)/setup
$(INSTALL) -m 755 $(SRCDIR)/sethostname $(INSTALL_DIR)/sethostname
$(INSTALL) -m 644 $(SRCDIR)/hosts $(INSTALL_DIR)/hosts
$(INSTALL) -m 755 ../tmcc $(INSTALL_DIR)/tmcc
$(INSTALL) -m 755 $(SRCDIR)/supfile $(INSTALL_DIR)/supfile
-mkdir -p /root/.cvsup
$(INSTALL) -m 600 $(SRCDIR)/cvsup.auth /root/.cvsup/auth
$(INSTALL) -m 644 $(SRCDIR)/pump.conf /etc/pump.conf
script /etc/rc.d/testbed/sethostname
#!/usr/bin/perl -wT
use English;
#
# Set the hostname for the node according to the current experiment.
#
# In Linux, this gets invoked directly from the "pump" configuration
# program. See /etc/pump.conf. Who came up that name? Anyway, the
# first argument to the script is a token, one of up, renewal, or
# release. We set the hostname on either of the first two.
#
# If no args supplied at all (which means being run by hand, then do it.
#
push(@INC, "/etc/rc.d/testbed");
require setuplib;
#
# Untaint path
#
$ENV{'PATH'} = '/bin:/sbin:/usr/bin:/usr/local/bin:/etc/rc.d/testbed';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
# Turn off line buffering on output
$| = 1;
if (@ARGV) {
my $token = shift;
if ($token ne "up" && $token ne "renewal") {
exit 0;
}
}
#
# Check allocation. Exit now if not allocated.
#
my ($pid, $eid, $vname) = check_status();
if (! $pid) {
exit 0;
}
#
# Otherwise, sethostname
#
my $nickname= "$vname.$eid.$pid";
print STDOUT "Resetting hostname to $nickname ... ";
if (system("hostname $nickname")) {
print STDOUT "*** FAILED!\n";
exit 1;
}
print STDOUT "Done!\n";
exit 0;
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