Commit 3180d656 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Minor rework so that the sup command is isolated by itself to avoid

the problem of having to sup a file that is currently executing (two
reboots required).
Fix up the startupcmd stuff to take arguments.
parent 90792dfb
......@@ -28,6 +28,7 @@ install:
$(INSTALL) -m 600 $(SRCDIR)/master.passwd $(INSTALL_DIR)/master.passwd
$(INSTALL) -m 755 $(SRCDIR)/setup $(INSTALL_DIR)/setup
$(INSTALL) -m 755 $(SRCDIR)/rc.testbed $(INSTALL_DIR)/rc.testbed
$(INSTALL) -m 755 $(SRCDIR)/rc.setup $(INSTALL_DIR)/rc.setup
$(INSTALL) -m 644 $(SRCDIR)/hosts $(INSTALL_DIR)/hosts
$(INSTALL) -m 755 ../tmcc $(INSTALL_DIR)/tmcc
$(INSTALL) -m 755 $(SRCDIR)/supfile $(INSTALL_DIR)/supfile
......
#!/bin/sh
if [ -x /etc/testbed/setup ]; then
echo "Doing Testbed setup configuration ..."
/etc/testbed/setup
fi
if [ -x /etc/testbed/rc.ifc ]; then
echo "Setting up Testbed interfaces ..."
/etc/testbed/rc.ifc
fi
if [ -x /etc/testbed/rc.delay ]; then
echo "Setting up Testbed delay configuration ..."
/etc/testbed/rc.delay
fi
if [ -x /etc/testbed/rc.rpm ]; then
echo "Installing RPMs ..."
/etc/testbed/rc.rpm
fi
if [ -x /etc/testbed/startupcmd ]; then
echo "Scheduling startup command to run in a little bit ..."
/bin/rm -f /var/at/jobs/S*
echo "/etc/testbed/runstartup" | at -q S 'now + 5 minutes'
fi
#!/bin/sh
#
# Don't put anything else in here. Put it in the rc.setup file cause
# if you sup this file, it won't take effect till the next reboot.
#
echo "Checking for file updates ..."
export HOME=/root
/usr/local/bin/cvsup -e -1 -g -L 1 /etc/testbed/supfile
if [ -x /etc/testbed/setup ]; then
echo "Setting up Testbed configuration..."
/etc/testbed/setup
fi
if [ -x /etc/testbed/rc.ifc ]; then
echo "Setting up Testbed interfaces..."
/etc/testbed/rc.ifc
fi
if [ -x /etc/testbed/rc.delay ]; then
echo "Setting up Testbed delay configuration..."
/etc/testbed/rc.delay
fi
if [ -x /etc/testbed/rc.rpm ]; then
echo "Installing RPMS"
/etc/testbed/rc.rpm
fi
if [ -x /etc/testbed/startupcmd ]; then
echo "Scheduling startup command to run in a little bit"
echo "/etc/testbed/runstartup" | at 'now + 5 minutes'
if [ -x /etc/testbed/rc.setup ]; then
echo "Starting Testbed Setup ..."
/etc/testbed/rc.setup
fi
......@@ -35,7 +35,7 @@ my $runcmd;
my $login;
while (<CMD>) {
if ($_ =~ /CMD=([-\@\w.\/ ]+) UID=([0-9a-z]+)/) {
if ($_ =~ /CMD=\'([-\@\w.\/ ]+)\' UID=([0-9a-z]+)/) {
$runcmd = $1;
$login = $2;
}
......@@ -44,9 +44,8 @@ while (<CMD>) {
if (!defined($runcmd) || !defined($login)) {
fatal("$TMSTARTUPCMD not in proper format!");
}
if (($uid = getpwnam($login)) == 0) {
(undef,undef,$uid,$gid,undef,undef,undef,$homedir) = getpwnam($login) or
fatal("Could not determine UID for $login");
}
#
# Fork a child so that we can run the command as the user and wait for it.
......@@ -64,6 +63,7 @@ else {
#
# The child becomes the user and runs the command.
#
$EGID = $GID = $gid;
$EUID = $UID = $uid;
exec($runcmd);
......
......@@ -384,7 +384,7 @@ open(RUN, ">$TMSTARTUPCMD")
or die("Could not open $TMSTARTUPCMD");
while (<TM>) {
if ($_ =~ /CMD=([-\@\w.\/ ]+) UID=([0-9a-z]+)/) {
if ($_ =~ /CMD=(\'[-\@\w.\/ ]+\') UID=([0-9a-z]+)/) {
print STDOUT " Will run $1 as $2\n";
print RUN "$_\n";
}
......
......@@ -2,4 +2,4 @@
# When the release is bumped, be sure to remove sup/sup/FBSD40-STD/checkouts
# on the client.
#
FBSD40-STD host=boss.emulab.net base=/etc/testbed/sup prefix=/ preserve release=20000221
FBSD40-STD host=boss.emulab.net base=/etc/testbed/sup prefix=/ preserve release=20010325
......@@ -29,6 +29,7 @@ install:
$(INSTALL) -m 600 $(SRCDIR)/shadow $(INSTALL_DIR)/shadow
$(INSTALL) -m 600 $(SRCDIR)/gshadow $(INSTALL_DIR)/gshadow
$(INSTALL) -m 755 $(SRCDIR)/rc.testbed $(INSTALL_DIR)/rc.testbed
$(INSTALL) -m 755 $(SRCDIR)/rc.setup $(INSTALL_DIR)/rc.setup
$(INSTALL) -m 755 $(SRCDIR)/setup $(INSTALL_DIR)/setup
$(INSTALL) -m 644 $(SRCDIR)/hosts $(INSTALL_DIR)/hosts
$(INSTALL) -m 755 ../tmcc $(INSTALL_DIR)/tmcc
......
#!/bin/sh
if [ -x /etc/rc.d/testbed/setup ]; then
echo "Setting up Testbed Configuration ..."
/etc/rc.d/testbed/setup
fi
if [ -x /etc/rc.d/testbed/rc.ifc ]; then
echo "Setting up Testbed Interfaces ..."
/etc/rc.d/testbed/rc.ifc
fi
if [ -x /etc/rc.d/testbed/rc.rpm ]; then
echo "Installing RPMs ..."
/etc/rc.d/testbed/rc.rpm
fi
if [ -x /etc/rc.d/testbed/startupcmd ]; then
echo "Scheduling startup command to run in a little bit ..."
/bin/rm -f /var/spool/at/S*
echo "/etc/rc.d/testbed/runstartup" | at -q S 'now + 5 minutes'
fi
#!/bin/sh
#
# Don't put anything else in here. Put it in the rc.setup file cause
# if you sup this file, it won't take effect till the next reboot.
#
echo "Checking for file updates ..."
export HOME=/root
/usr/local/bin/cvsup -e -1 -g -L 1 /etc/rc.d/testbed/supfile
if [ -x /etc/rc.d/testbed/setup ]; then
echo "Setting up Testbed Configuration"
/etc/rc.d/testbed/setup
fi
if [ -x /etc/rc.d/testbed/rc.ifc ]; then
echo "Setting up Testbed Interfaces"
/etc/rc.d/testbed/rc.ifc
if [ -x /etc/rc.d/testbed/rc.setup ]; then
echo "Starting Testbed Setup ..."
/etc/rc.d/testbed/rc.setup
fi
if [ -x /etc/rc.d/testbed/rc.rpm ]; then
echo "Installing RPMS"
/etc/rc.d/testbed/rc.rpm
fi
if [ -x /etc/rc.d/testbed/startupcmd ]; then
echo "Scheduling startup command to run in a little bit"
echo "/etc/rc.d/testbed/runstartup" | at 'now + 5 minutes'
fi
......@@ -35,7 +35,7 @@ my $runcmd;
my $login;
while (<CMD>) {
if ($_ =~ /CMD=([-\@\w.\/ ]+) UID=([0-9a-z]+)/) {
if ($_ =~ /CMD=\'([-\@\w.\/ ]+)\' UID=([0-9a-z]+)/) {
$runcmd = $1;
$login = $2;
}
......@@ -44,9 +44,8 @@ while (<CMD>) {
if (!defined($runcmd) || !defined($login)) {
fatal("$TMSTARTUPCMD not in proper format!");
}
if (($uid = getpwnam($login)) == 0) {
(undef,undef,$uid,$gid,undef,undef,undef,$homedir) = getpwnam($login) or
fatal("Could not determine UID for $login");
}
#
# Fork a child so that we can run the command as the user and wait for it.
......@@ -64,6 +63,7 @@ else {
#
# The child becomes the user and runs the command.
#
$EGID = $GID = $gid;
$EUID = $UID = $uid;
exec($runcmd);
......@@ -80,7 +80,6 @@ system("$TMCC startstatus $stat");
#
# Put the log file in the callers home dir! Hmm, what about name clashes?
#
(undef,undef,undef,undef,undef,undef,undef,$homedir) = getpwnam($login);
system("/bin/cp", "$logname", "$homedir");
exit(0);
......
......@@ -263,7 +263,7 @@ open(RUN, ">$TMSTARTUPCMD")
or die("Could not open $TMSTARTUPCMD");
while (<TM>) {
if ($_ =~ /CMD=([-\@\w.\/ ]+) UID=([0-9a-z]+)/) {
if ($_ =~ /CMD=(\'[-\@\w.\/ ]+\') UID=([0-9a-z]+)/) {
print STDOUT " Will run $1 as $2\n";
print RUN "$_\n";
}
......
......@@ -2,4 +2,4 @@
# When the release is bumped, be sure to remove sup/sup/RHL62-STD/checkouts
# on the client.
#
RHL62-STD host=boss.emulab.net base=/etc/rc.d/testbed/sup prefix=/ preserve release=20000221
RHL62-STD host=boss.emulab.net base=/etc/rc.d/testbed/sup prefix=/ preserve release=20010325
Supports Markdown
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