Commit ba31e630 authored by Leigh Stoller's avatar Leigh Stoller

Convert to using new path definition scripts in /etc/emulab. Also a

bunch of relocations of things from /etc/testbed in the old world, to
/usr/local/etc/emulab in the new world. Basically, /etc/emulab has
just a few config files that do not change. All of the binaries and
scripts are now placed in /usr/local/etc/emulab, and *all* of the
variable stuff that was written into /etc/testbed is now written into
/var/emulab/{boot,logs,jails,lock,db}.
parent 38452552
......@@ -4,8 +4,9 @@
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
NODETYPE=`/etc/testbed/nodetype`
NODETYPE=`nodetype`
if [ "$NODETYPE" = 'pc600' ]; then
echo 'fxp4'
......
......@@ -4,21 +4,22 @@
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
#
# Remember our server IP as the boss IP
#
rm -f /etc/testbed/bossip
rm -f $BOOTDIR/bossip
if [ x"$reason" = xREBOOT ]; then
echo $new_dhcp_server_identifier > /etc/testbed/bossip
echo $new_host_name > /etc/testbed/realname
echo $new_dhcp_server_identifier > $BOOTDIR/bossip
echo $new_host_name > $BOOTDIR/realname
fi
#
# See if the Testbed configuration software wants to change the hostname.
# Installed into /etc.
#
/etc/testbed/sethostname $new_domain_name
$BINDIR/sethostname $new_domain_name
#
# Once we have an IP address, we can stop dhclient so that it doesn't get
......
......@@ -4,9 +4,10 @@
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
if [ -x '/etc/testbed/cpuspeed.awk' ]; then
cpuspeed=`/etc/testbed/cpuspeed.awk /var/run/dmesg.boot`;
if [ -x $BINDIR/cpuspeed.awk ]; then
cpuspeed=`$BINDIR/cpuspeed.awk /var/run/dmesg.boot`;
else
cpuspeed='';
fi
......@@ -15,8 +16,8 @@ if [ x$cpuspeed = x ] || [ $cpuspeed = 0 ]; then
echo "unknown";
# XXX hack for minibed
elif [ $cpuspeed = "850" -a -x '/etc/testbed/chipset.awk' ]; then
if [ `/etc/testbed/chipset.awk /var/run/dmesg.boot` = "GX" ]; then
elif [ $cpuspeed = "850" -a -x $BINDIR/chipset.awk ]; then
if [ `$BINDIR/chipset.awk /var/run/dmesg.boot` = "GX" ]; then
echo pcL440GX;
else
echo pc$cpuspeed;
......
......@@ -4,16 +4,19 @@
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
require 'ctime.pl';
# Drag in path stuff so we can find emulab stuff.
BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
#
# Prepare the node for cutting a new image. Should be run just prior, on
# each of the FreeBSD and Linux partitions.
#
my $DUMPDATES = "/etc/dumpdates";
my @DBFILES = ("/var/db/testbed.deltas", "/var/db/testbed.tarfiles");
my @VARDIRS = ("logs", "db", "jails", "boot", "lock");
my $FSTAB = "/etc/fstab";
my $LOGDIR = "/var/log";
my $RUNDIR = "/var/run";
......@@ -26,12 +29,6 @@ my $SFSHOSTKEY = "/etc/sfs/sfs_host_key";
my $MOUNTINFO = "/var/db/mounttab";
my $LOCATEDB = "/var/db/locate.database";
#
# Untaint path
#
$ENV{'PATH'} = '/bin:/sbin:/usr/bin:/usr/local/bin:/etc/testbed';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
#
# Turn off line buffering on output
#
......@@ -41,7 +38,6 @@ $| = 1;
# Load the OS independent support library. It will load the OS dependent
# library and initialize itself.
#
use lib "/etc/testbed";
use libsetup;
#
......@@ -169,3 +165,12 @@ if (-f $SFSUSERS) {
if (-f $SFSHOSTKEY) {
system("rm -f $SFSHOSTKEY");
}
print "Clearing out directories in $VARDIR ...\n";
foreach my $dir (@VARDIRS) {
if (-d "$VARDIR/$dir") {
system("rm -rf $VARDIR/$dir/*");
}
}
......@@ -4,27 +4,22 @@
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
#
# Be nice to get this from libloc, but how do you get a package variable?
#
my $MAPFILE = "/etc/testbed/delay_mapping";
#
# Untaint path
#
$ENV{'PATH'} = '/bin:/sbin:/usr/bin:/usr/local/bin:/etc/testbed';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
# Drag in path stuff so we can find emulab stuff.
BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
#
# Load the OS independent support library. It will load the OS dependent
# library and initialize itself.
#
use lib "/etc/testbed";
use libsetup;
#
# Really comes from libloc.
#
my $MAPFILE = $libsetup::TMDELMAP;
if (! -s $MAPFILE) {
exit(0);
}
......
......@@ -4,9 +4,9 @@
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
PREFIX=/etc/testbed
NODETYPE=`${PREFIX}/nodetype`
NODETYPE=`${BINDIR}/nodetype`
case "$1" in
start)
......@@ -25,8 +25,8 @@ case "$1" in
;;
esac
[ -x ${PREFIX}/healthd ] \
&& ${PREFIX}/healthd -f ${PREFIX}/healthd.conf -S -q -p boss 180 \
[ -x ${BINDIR}/healthd ] \
&& ${BINDIR}/healthd -f ${BINDIR}/healthd.conf -S -q -p boss 180 \
&& echo -n ' healthd'
;;
stop)
......
......@@ -4,6 +4,7 @@
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
#
# The MFS does a very restricted set of operations.
......@@ -13,32 +14,26 @@ echo "Doing Testbed Setup on an MFS ... "
#
# Inform TMCD that we've rebooted, and are starting testbed setup
#
if [ -x /etc/testbed/tmcc ]; then
echo "Informing the testbed that we've rebooted ..."
/etc/testbed/tmcc state REBOOTED
fi
echo "Informing the testbed that we've rebooted ..."
$BINDIR/tmcc state TBSETUP
if [ -x /etc/testbed/setup ]; then
echo "Doing Testbed setup configuration ..."
/etc/testbed/setup
fi
echo "Doing Testbed setup configuration ..."
$BINDIR/bootsetup
if [ -x /etc/testbed/slothd ]; then
if [ -x $BINDIR/slothd ]; then
echo "Starting usage detector ..."
rm -f /var/run/slothd
/etc/testbed/slothd
$BINDIR/slothd
fi
/bin/rm -f /var/at/jobs/S*
if [ -s /etc/testbed/startupcmd ]; then
if [ -s $BOOTDIR/startupcmd ]; then
echo "Scheduling startup command to run in a little bit ..."
echo "/etc/testbed/runstartup" | at -q S 'now + 2 minutes'
echo "$BINDIR/runstartup" | at -q S 'now + 2 minutes'
fi
#
# Inform TMCD that we're up and running
#
if [ -x /etc/testbed/tmcc ]; then
echo "Informing the testbed that we're up and running ..."
/etc/testbed/tmcc state ISUP
fi
echo "Informing the testbed that we're up and running ..."
$BINDIR/tmcc state ISUP
......@@ -4,7 +4,6 @@
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
#
......@@ -17,11 +16,8 @@ use English;
# Otherwise, we have no safe way to determine the domain.
#
#
# Untaint path
#
$ENV{'PATH'} = '/bin:/sbin:/usr/bin:/usr/local/bin:/etc/testbed';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
# Drag in path stuff so we can find emulab stuff.
BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
#
# Turn off line buffering on output
......@@ -32,7 +28,6 @@ $| = 1;
# Load the OS independent support library. It will load the OS dependent
# library and initialize itself.
#
use lib "/etc/testbed";
use libsetup;
#
......
#!/bin/sh
if [ `/etc/testbed/control_interface` = 'fxp0' ]; then
. /etc/emulab/paths.sh
if [ `$BINDIR/control_interface` = 'fxp0' ]; then
dhcp_interfaces="$dhcp_interfaces fxp0";
fi
#!/bin/sh
if [ `/etc/testbed/control_interface` = 'fxp1' ]; then
. /etc/emulab/paths.sh
if [ `$BINDIR/control_interface` = 'fxp1' ]; then
dhcp_interfaces="$dhcp_interfaces fxp1";
fi
#!/bin/sh
if [ `/etc/testbed/control_interface` = 'fxp4' ]; then
. /etc/emulab/paths.sh
if [ `$BINDIR/control_interface` = 'fxp4' ]; then
dhcp_interfaces="$dhcp_interfaces fxp4";
fi
#!/bin/sh
if [ `/etc/testbed/control_interface` = 'xl0' ]; then
. /etc/emulab/paths.sh
if [ `$BINDIR/control_interface` = 'xl0' ]; then
dhcp_interfaces="$dhcp_interfaces xl0";
fi
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
#
# tbshutdown
......@@ -9,6 +15,9 @@
# to the testbed.
#
# Drag in path stuff so we can find emulab stuff.
BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
# First, we background ourselves (daemonize)
if ( background() ) {
# parent exits now
......@@ -30,7 +39,7 @@ exit(0);
sub cleanup() {
# This is our signal handler.
system("/etc/testbed/tmcc state SHUTDOWN");
system("tmcc state SHUTDOWN");
exit(0);
}
......
......@@ -4,18 +4,19 @@
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
#
# Boottime initialization.
#
case "$1" in
start)
if [ -x /etc/testbed/rc.testbed ]; then
echo ""
/etc/testbed/rc.testbed
fi
echo ""
$BINDIR/rc.testbed
;;
stop)
echo "Informing the testbed we're rebooting"
$BINDIR/tmcc state SHUTDOWN
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
......
......@@ -4,20 +4,15 @@
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
#
# Untaint path
#
$ENV{'PATH'} = '/bin:/sbin:/usr/bin:/usr/local/bin:/etc/testbed';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
# Drag in path stuff so we can find emulab stuff.
BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
#
# Load the OS independent support library. It will load the OS dependent
# library and initialize itself.
#
use lib "/etc/testbed";
use libsetup;
#
......
......@@ -4,8 +4,9 @@
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
NODETYPE=`/etc/testbed/nodetype`
NODETYPE=`nodetype`
if [ "$NODETYPE" = 'pc600' ]; then
echo 'eth4'
......
DEVICE="eth0"
if [ "`/etc/rc.d/testbed/control_interface`" = "$DEVICE" ]; then
. /etc/emulab/paths.sh
if [ "`control_interface`" = "$DEVICE" ]; then
BOOTPROTO="dhcp"
fi
ONBOOT="yes"
......
DEVICE="eth1"
if [ "`/etc/rc.d/testbed/control_interface`" = "$DEVICE" ]; then
. /etc/emulab/paths.sh
if [ "`control_interface`" = "$DEVICE" ]; then
BOOTPROTO="dhcp"
fi
ONBOOT="yes"
......
DEVICE="eth2"
if [ "`/etc/rc.d/testbed/control_interface`" = "$DEVICE" ]; then
. /etc/emulab/paths.sh
if [ "`control_interface`" = "$DEVICE" ]; then
BOOTPROTO="dhcp"
fi
ONBOOT="yes"
......
DEVICE="eth3"
if [ "`/etc/rc.d/testbed/control_interface`" = "$DEVICE" ]; then
. /etc/emulab/paths.sh
if [ "`control_interface`" = "$DEVICE" ]; then
BOOTPROTO="dhcp"
fi
ONBOOT="yes"
......
DEVICE="eth4"
if [ "`/etc/rc.d/testbed/control_interface`" = "$DEVICE" ]; then
. /etc/emulab/paths.sh
if [ "`control_interface`" = "$DEVICE" ]; then
BOOTPROTO="dhcp"
fi
ONBOOT="yes"
......
......@@ -4,9 +4,10 @@
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
if [ -x '/etc/rc.d/testbed/cpuspeed.awk' ]; then
cpuspeed=`/etc/rc.d/testbed/cpuspeed.awk /proc/cpuinfo`;
if [ -x $BINDIR/cpuspeed.awk ]; then
cpuspeed=`$BINDIR/cpuspeed.awk /proc/cpuinfo`;
else
cpuspeed='';
fi
......@@ -15,8 +16,8 @@ if [ x$cpuspeed = x ] || [ $cpuspeed = 0 ]; then
echo "unknown";
# XXX hack for minibed
elif [ $cpuspeed = "850" -a -x '/etc/rc.d/testbed/chipset.awk' ]; then
if [ "`/etc/rc.d/testbed/chipset.awk /proc/pci`" = "GX" ]; then
elif [ $cpuspeed = "850" -a -x $BINDIR/chipset.awk ]; then
if [ "`$BINDIR/chipset.awk /proc/pci`" = "GX" ]; then
echo pcL440GX;
else
echo pc$cpuspeed;
......
script @CLIENT_BINDIR@/sethostname
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
PREFIX=/etc/testbed
NODETYPE=`${PREFIX}/nodetype`
NODETYPE=`${BINDIR}/nodetype`
MODPROBE=/sbin/modprobe
case "$1" in
......@@ -27,8 +32,8 @@ case "$1" in
;;
esac
[ -x ${PREFIX}/healthd ] \
&& ${PREFIX}/healthd -f ${PREFIX}/healthd.conf -S -p boss 180 \
[ -x ${BINDIR}/healthd ] \
&& ${BINDIR}/healthd -f ${BINDIR}/healthd.conf -S -p boss 180 \
&& echo -n ' healthd'
;;
stop)
......
......@@ -4,7 +4,6 @@
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
#
......@@ -22,11 +21,8 @@ use English;
# domain suffix.
#
#
# Untaint path
#
$ENV{'PATH'} = '/bin:/sbin:/usr/bin:/usr/local/bin:/etc/rc.d/testbed';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
# Drag in path stuff so we can find emulab stuff.
BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
# Turn off line buffering on output
$| = 1;
......@@ -35,7 +31,6 @@ $| = 1;
# Load the OS independent support library. It will load the OS dependent
# library and initialize itself.
#
use lib "/etc/rc.d/testbed";
use libsetup;
if (@ARGV) {
......
......@@ -4,6 +4,7 @@
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
#
# testbed Do some testbed stuff,
......@@ -30,12 +31,9 @@ RETVAL=0
# See how we were called.
case "$1" in
start)
if [ -r /etc/rc.d/testbed/rc.delta ]; then
echo "Doing Testbed Delta Thing ..."
/etc/rc.d/testbed/rc.delta
RETVAL=$?
fi
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/testbed
# This stuff done from rc.local cause I cannot figure
# out a way to log to the console instead of messages.
# Note, /var/lock/subsys/testbed will be created at that time.
;;
stop)
rm /var/lock/subsys/testbed
......@@ -45,7 +43,7 @@ case "$1" in
killproc slothd
killproc healthd
echo "Informing the testbed we're rebooting ..."
/etc/rc.d/testbed/tmcc state REBOOTING
$BINDIR/tmcc state SHUTDOWN
RETVAL=$?
;;
status)
......
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