Commit 01f2edbb authored by Mike Hibler's avatar Mike Hibler

Start of install target for DP nodes.

Makefile is not ready yet.
parent 73042f58
...@@ -2508,7 +2508,7 @@ outfiles="$outfiles Makeconf GNUmakefile \ ...@@ -2508,7 +2508,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tmcd/freebsd5/GNUmakefile tmcd/freebsd5/supfile \ tmcd/freebsd5/GNUmakefile tmcd/freebsd5/supfile \
tmcd/freebsd6/GNUmakefile tmcd/freebsd6/supfile tmcd/freebsd6/netif-emulab \ tmcd/freebsd6/GNUmakefile tmcd/freebsd6/supfile tmcd/freebsd6/netif-emulab \
tmcd/freebsd7/GNUmakefile tmcd/freebsd7/supfile tmcd/freebsd7/netif-emulab \ tmcd/freebsd7/GNUmakefile tmcd/freebsd7/supfile tmcd/freebsd7/netif-emulab \
tmcd/cygwinxp/GNUmakefile \ tmcd/cygwinxp/GNUmakefile tmcd/dp/GNUmakefile \
tmcd/openbsd/GNUmakefile tmcd/ron/GNUmakefile tmcd/plab/GNUmakefile \ tmcd/openbsd/GNUmakefile tmcd/ron/GNUmakefile tmcd/plab/GNUmakefile \
utils/GNUmakefile utils/vlandiff utils/vlansync utils/delay_config \ utils/GNUmakefile utils/vlandiff utils/vlansync utils/delay_config \
utils/sshtb utils/create_image utils/node_admin \ utils/sshtb utils/create_image utils/node_admin \
......
...@@ -889,7 +889,7 @@ outfiles="$outfiles Makeconf GNUmakefile \ ...@@ -889,7 +889,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tmcd/freebsd5/GNUmakefile tmcd/freebsd5/supfile \ tmcd/freebsd5/GNUmakefile tmcd/freebsd5/supfile \
tmcd/freebsd6/GNUmakefile tmcd/freebsd6/supfile tmcd/freebsd6/netif-emulab \ tmcd/freebsd6/GNUmakefile tmcd/freebsd6/supfile tmcd/freebsd6/netif-emulab \
tmcd/freebsd7/GNUmakefile tmcd/freebsd7/supfile tmcd/freebsd7/netif-emulab \ tmcd/freebsd7/GNUmakefile tmcd/freebsd7/supfile tmcd/freebsd7/netif-emulab \
tmcd/cygwinxp/GNUmakefile \ tmcd/cygwinxp/GNUmakefile tmcd/dp/GNUmakefile \
tmcd/openbsd/GNUmakefile tmcd/ron/GNUmakefile tmcd/plab/GNUmakefile \ tmcd/openbsd/GNUmakefile tmcd/ron/GNUmakefile tmcd/plab/GNUmakefile \
utils/GNUmakefile utils/vlandiff utils/vlansync utils/delay_config \ utils/GNUmakefile utils/vlandiff utils/vlansync utils/delay_config \
utils/sshtb utils/create_image utils/node_admin \ utils/sshtb utils/create_image utils/node_admin \
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004, 2007 University of Utah and the Flux Group.
# All rights reserved.
#
#
# XXX ONLY RUN THIS INSTALL ON A LINUX DATAPOSITORY NODE
#
# Trivial. These things just need to be installed into the right place
# on a testbed node before cutting an image.
#
#
SRCDIR = @srcdir@
TESTBED_SRCDIR = @top_srcdir@
OBJDIR = ../..
SUBDIR = tmcd/dp
include $(OBJDIR)/Makeconf
all: bossnode
include $(TESTBED_SRCDIR)/GNUmakerules
DISTDIR = /var/tmp/emulab
DESTDIR =
SYSETCDIR = $(DESTDIR)/etc
ETCDIR = $(DESTDIR)$(CLIENT_ETCDIR)
BINDIR = $(DESTDIR)$(CLIENT_BINDIR)
VARDIR = $(DESTDIR)$(CLIENT_VARDIR)
RCDIR = $(SYSETCDIR)
INSTALL = /usr/bin/install -c
client-install:
dp-install: dp-stuff doinstall
doinstall: common-install etc-install sysetc-install other-install \
script-install bin-install
@echo "Remember to install the PEM files if necessary"
@echo "Don't forget to do a post-install as root"
dir-install:
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/emulab
$(INSTALL) -m 755 -o root -g root -d $(ETCDIR)
$(INSTALL) -m 755 -o root -g root -d $(BINDIR)
$(INSTALL) -m 755 -o root -g root -d $(VARDIR)
$(INSTALL) -m 755 -o root -g root -d $(VARDIR)/db
$(INSTALL) -m 755 -o root -g root -d $(VARDIR)/logs
$(INSTALL) -m 755 -o root -g root -d $(VARDIR)/boot
$(INSTALL) -m 755 -o root -g root -d $(VARDIR)/boot/tmcc
$(INSTALL) -m 755 -o root -g root -d $(VARDIR)/lock
common-install: dir-install
(cd ../common; $(MAKE) DESTDIR=$(DESTDIR) remote-install)
other-install: dir-install
bin-install: dir-install
$(INSTALL_PROGRAM) ../tmcc $(BINDIR)/tmcc.bin
etc-install: dir-install bossnode
cp /dev/null $(ETCDIR)/isrem
$(INSTALL) bossnode $(ETCDIR)/bossnode
$(INSTALL) $(SRCDIR)/emulabkey $(ETCDIR)/emulabkey
sysetc-install:
$(INSTALL) $(SRCDIR)/emulab.sh $(SYSETCDIR)/init.d/emulab
-ln -sf ../init.d/emulab $(SYSETCDIR)/rc0.d/K96emulab
-ln -sf ../init.d/emulab $(SYSETCDIR)/rc1.d/K96emulab
-ln -sf ../init.d/emulab $(SYSETCDIR)/rc2.d/S96emulab
-ln -sf ../init.d/emulab $(SYSETCDIR)/rc3.d/S96emulab
-ln -sf ../init.d/emulab $(SYSETCDIR)/rc4.d/S96emulab
-ln -sf ../init.d/emulab $(SYSETCDIR)/rc5.d/S96emulab
-ln -sf ../init.d/emulab $(SYSETCDIR)/rc6.d/K96emulab
script-install: dir-install
$(INSTALL_PROGRAM) $(SRCDIR)/emulabctl $(BINDIR)/emulabctl
$(INSTALL_PROGRAM) $(SRCDIR)/mkemuman.sh $(BINDIR)/mkemuman.sh
post-install:
$(BINDIR)/mkemuman.sh
(chown emulabman $(BINDIR) $(BINDIR)/*)
(chgrp bin $(BINDIR) $(BINDIR)/*)
(chown emulabman $(ETCDIR) $(ETCDIR)/*)
(chgrp bin $(ETCDIR) $(ETCDIR)/*)
chown root $(BINDIR)/update
chmod u+s $(BINDIR)/update
-chown root $(DESTDIR)/usr/bin/suidperl
-chmod u+s $(DESTDIR)/usr/bin/suidperl
#
# We build the bossnode file from config info
#
bossnode: GNUmakefile
echo >$@ "$(BOSSNODE)"
distdir:
rm -rf $(DISTDIR)
mkdir -p $(DISTDIR)
clean:
rm -f bossnode
Selective client install on DP node. Assumes $SRC is the Emulab
source directory and $OBJ is the build directory.
1. Build client-side.
cd $OBJ/tmcd
make client
make fullclient
Entire client will not build without installing boost and who knows
what else. But we do not need route calculation so don't bother.
2. Create the emulabman user:
cd $SRC/tmcd/dp
sudo ./mkemuman.sh
3. Create emulab directories:
sudo install -c -m 755 -o emulabman -g root -d /etc/emulab
sudo install -c -m 755 -o emulabman -g root -d /usr/local/etc/emulab
sudo install -c -m 755 -o emulabman -g root -d /usr/local/etc/emulab/rc
sudo install -c -m 755 -o emulabman -g root -d /var/emulab
sudo install -c -m 755 -o emulabman -g root -d /var/emulab/boot
sudo install -c -m 755 -o emulabman -g root -d /var/emulab/boot/tmcc
sudo install -c -m 755 -o emulabman -g root -d /var/emulab/db
sudo install -c -m 755 -o emulabman -g root -d /var/emulab/logs
sudo install -c -m 755 -o emulabman -g root -d /var/emulab/lock
4. Install certs from boss:
<copy them over from boss:/usr/testbed/etc>
sudo install -c -m 640 emulab.pem /etc/emulab/emulab.pem
sudo install -c -m 640 pcwa.pem /etc/emulab/client.pem
5. Install client stuff:
cd $OBJ
echo boss.emulab.net | sudo cp /dev/stdin /etc/emulab/bossnode
sudo touch /etc/emulab/isrem
cd tmcd
sudo install -c -m 755 tmcc /usr/local/etc/emulab/tmcc.bin
cd common
sudo install -c -o emulabman -m 755 ../../../src/tmcd/common/paths.pm /etc/emulab/paths.pm
sudo install -c -o emulabman -m 755 ../../../src/tmcd/common/paths.sh /etc/emulab/paths.sh
sudo install -c -o emulabman -m 755 ../../../src/tmcd/common/libsetup.pm /usr/local/etc/emulab/libsetup.pm
sudo install -c -o emulabman -m 755 ../../../src/tmcd/common/libtmcc.pm /usr/local/etc/emulab/libtmcc.pm
sudo install -c -o emulabman -m 755 ../../../src/tmcd/common/libtestbed.pm /usr/local/etc/emulab/libtestbed.pm
sudo install -c -o emulabman -m 755 ../../../src/tmcd/common/tmcc.pl /usr/local/etc/emulab/tmcc
sudo install -c -o emulabman -m 755 ../../../src/tmcd/common/watchdog /usr/local/etc/emulab/watchdog
sudo install -c -o emulabman -m 755 ../../../src/tmcd/common/update /usr/local/etc/emulab/update
cd config
sudo install -c -o emulabman -m 755 ../../../../src/tmcd/common/config/librc.pm /usr/local/etc/emulab/librc.pm
sudo install -c -o emulabman -m 755 ../../../../src/tmcd/common/config/rc.config /usr/local/etc/emulab/rc
sudo install -c -o emulabman -m 755 ../../../../src/tmcd/common/config/rc.mounts /usr/local/etc/emulab/rc
sudo install -c -o emulabman -m 755 ../../../../src/tmcd/common/config/rc.accounts /usr/local/etc/emulab/rc
sudo install -c -o emulabman -m 755 ../../../../src/tmcd/common/config/rc.rpms /usr/local/etc/emulab/rc
sudo install -c -o emulabman -m 755 ../../../../src/tmcd/common/config/rc.tarfiles /usr/local/etc/emulab/rc
cd ../../linux
sudo install -c -o emulabman -m 755 ../../../src/tmcd/linux/liblocsetup.pm /usr/local/etc/emulab/liblocsetup.pm
cd ../dp
sudo install -c -o emulabman -m 755 ../../../src/tmcd/dp/emulabctl /usr/local/etc/emulab/emulabctl
sudo install -c -o emulabman -m 755 ../../../src/tmcd/dp/mkemuman.sh /usr/local/etc/emulab/mkemuman.sh
sudo install -c ../../../src/tmcd/dp/emulab.sh /etc/init.d/emulab
sudo ln -sf ../init.d/emulab /etc/rc0.d/K96emulab
sudo ln -sf ../init.d/emulab /etc/rc1.d/K96emulab
sudo ln -sf ../init.d/emulab /etc/rc2.d/S96emulab
sudo ln -sf ../init.d/emulab /etc/rc3.d/S96emulab
sudo ln -sf ../init.d/emulab /etc/rc4.d/S96emulab
sudo ln -sf ../init.d/emulab /etc/rc5.d/S96emulab
sudo ln -sf ../init.d/emulab /etc/rc6.d/K96emulab
6. On boss, manually insert node into the widearea_nodeinfo table:
Create foo.xml file:
<opt>
<machine_type value='pcdp' />
<connect_type value='Inet2' />
<city value='Pittsburgh' />
<state value='PA' />
<zip value='15213' />
</opt>
and run wanodecreate:
wap wanodecreate sn001 foo.xml
7. On boss, run wanodecheckin to create the node in the DB:
wanodecheckin -d -h sn001.datapository.net PRIVKEY IPADDR
where PRIVKEY comes from the DB widearea_nodeinfo table entry just created
and IPADDR is the IP address of the machine.
8. Store privkey on node:
echo PRIVKEY | sudo cp /dev/stdin /etc/emulab/emulab-privkey
sudo chmod 600 /etc/emulab/emulab-privkey
Again, where PRIVKEY is what was put in the DB.
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003, 2007 University of Utah and the Flux Group.
# All rights reserved.
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
[ -f /etc/default/rcS ] && . /etc/default/rcS
. /lib/lsb/init-functions
. /etc/emulab/paths.sh
case "$1" in
start)
if [ -x $BINDIR/emulabctl ]; then
log_daemon_msg "Starting Emulab services" ""
$BINDIR/emulabctl start
log_end_msg $?
fi
;;
reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
if [ -x $BINDIR/emulabctl ]; then
log_daemon_msg "Stopping Emulab services" ""
$BINDIR/emulabctl stop
log_end_msg $?
fi
;;
restart)
$0 stop && sleep 10 && $0 start
;;
*)
echo "Usage: $0 start|stop|restart" >&2
exit 3
;;
esac
exit 0
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003, 2007 University of Utah and the Flux Group.
# All rights reserved.
#
use Getopt::Std;
use English;
use Errno;
use POSIX qw(strftime);
#
# Start/Stop the emulab support. Since we do not want to hold up the boot
# on a remote node, this goes into the background, and exits when done.
# The stop event kills one on progress.
#
sub usage()
{
print STDERR "Usage: emulabctl [-n] <start | stop>\n";
exit(1);
}
my $optlist = "nd";
#
# Must be root.
#
if ($UID != 0) {
die("*** $0:\n".
" Must be root to run this script!\n");
}
#
# Turn off line buffering on output
#
$| = 1;
# 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 libsetup;
use libtmcc;
# Locals
my $logname = "$LOGDIR/emulab-boot.debug";
my $pidfile = "/var/run/emulab-boot.pid";
my $debug = 0;
#
# Parse command arguments. Once we return from getopts, all that should be
# left are the required arguments.
#
%options = ();
if (! getopts($optlist, \%options)) {
usage();
}
if (defined($options{"d"})) {
$debug = 1;
}
if (@ARGV != 1) {
usage();
}
my $action = $ARGV[0];
if ($action ne "start" && $action ne "stop") {
usage();
}
#
# For stop, look to see if the pid file exists. If so, kill it and exit.
#
if ($action eq "stop") {
system("$BINDIR/watchdog stop");
if (! -e $pidfile) {
exit(0);
}
system("kill `cat $pidfile`");
exit($? >> 8);
}
#
# Go to background.
#
#
# Put this into the background and log its output. We *must* do this cause
# we do not want to halt the boot if the testbed is down!
#
if (!$debug && TBBackGround($logname)) {
#
# Parent exits normally
#
exit(0);
}
#
# Write our pid into the pid file so we can be killed later (when the
# experiment is torn down). We must do this first so that we can be
# killed before we change the sig handlers.
#
system("echo '$PID' > $pidfile") == 0
or die("Could not create $pidfile!");
#
# Setup a handler to catch TERM, and kill our process group. Generally,
# you do not want to send this a TERM, but use the stop argument instead.
#
my $pgrp = getpgrp(0);
sub handler () {
$SIG{TERM} = 'IGNORE';
$SIG{INT} = 'IGNORE';
unlink($pidfile);
tmcc(TMCCCMD_STATE, "SHUTDOWN");
kill('TERM', -$pgrp);
sleep(1);
exit(0);
}
$SIG{TERM} = \&handler;
$SIG{INT} = \&handler;
#
# Run the tmcc commands in blocking mode. No point in continuing if we
# cannot get a tmcd connection formed to tell it we are rebooting.
#
print "Informing Emulab Operations that we've rebooted ...\n";
tmcc(TMCCCMD_STATE, "TBSETUP");
#
# At bootup, look for new accounts.
#
print "Looking for new Emulab accounts ...\n";
system("$BINDIR/update -i");
#
# And start the watchdog.
#
print "Starting up the watchdog ...\n";
system("$BINDIR/watchdog");
#
# Inform TMCD that we are up and running.
#
print "Informing Emulab Operations that we're up and running ...\n";
tmcc(TMCCCMD_STATE, "ISUP");
# Done!
while (1) {
#
# Loop until killed.
#
sleep(1000);
}
exit(0);
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002, 2007 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
ostype=`uname -s`
if [ "$ostype" = "FreeBSD" ]; then
USERADD="pw useradd"
elif [ "$ostype" = "Linux" ]; then
USERADD="useradd"
else
echo "Unsupported OS: $ostype"
exit 1
fi
$USERADD emulabman -u 65520 -g bin -m -s /bin/tcsh -c "Emulab Man"
if [ ! -d ~emulabman ]; then
mkdir ~emulabman
chown emulabman ~emulabman
chgrp bin ~emulabman
fi
if [ -f $ETCDIR/emulabkey -a ! -d ~emulabman/.ssh ]; then
cd ~emulabman
chmod 755 .
mkdir .ssh
chown emulabman .ssh
chgrp bin .ssh
chmod 700 .ssh
cd .ssh
cp $ETCDIR/emulabkey authorized_keys
chown emulabman authorized_keys
chgrp bin authorized_keys
chmod 644 authorized_keys
fi
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