Commit 38bc8fa1 authored by Mike Hibler's avatar Mike Hibler

Preliminary support for Ubuntu Linux.

 * added new tmcd directory with Ubuntu (really, Debian) specifics
 * fixed up GNUmakefiles to not do "-g wheel" when creating directories
 * other, relatively minor tweaks
parent 6a8cb53b
......@@ -2502,7 +2502,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tmcd/linux/sethostname.dhclient \
tmcd/linux9/GNUmakefile tmcd/linux9/supfile \
tmcd/fedora/GNUmakefile tmcd/fedora/supfile \
tmcd/linux-sg/GNUmakefile \
tmcd/linux-sg/GNUmakefile tmcd/ubuntu7/GNUmakefile \
tmcd/freebsd5/GNUmakefile tmcd/freebsd5/supfile \
tmcd/freebsd6/GNUmakefile tmcd/freebsd6/supfile tmcd/freebsd6/netif-emulab \
tmcd/freebsd7/GNUmakefile tmcd/freebsd7/supfile tmcd/freebsd7/netif-emulab \
......
......@@ -882,7 +882,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tmcd/linux/sethostname.dhclient \
tmcd/linux9/GNUmakefile tmcd/linux9/supfile \
tmcd/fedora/GNUmakefile tmcd/fedora/supfile \
tmcd/linux-sg/GNUmakefile \
tmcd/linux-sg/GNUmakefile tmcd/ubuntu7/GNUmakefile \
tmcd/freebsd5/GNUmakefile tmcd/freebsd5/supfile \
tmcd/freebsd6/GNUmakefile tmcd/freebsd6/supfile tmcd/freebsd6/netif-emulab \
tmcd/freebsd7/GNUmakefile tmcd/freebsd7/supfile tmcd/freebsd7/netif-emulab \
......
#!/usr/bin/perl -w -T
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -2679,8 +2679,7 @@ sub TimeStamp()
sub PATH_NICE()
{
if ($platform eq LINUX) {
return "/bin/nice";
}
return "/usr/bin/nice";
return "/bin/nice" if (-x "/bin/nice");
return "/usr/bin/nice" if (-x "/usr/bin/nice");
return "nice";
}
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004, 2006 University of Utah and the Flux Group.
# Copyright (c) 2000-2004, 2006, 2007 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -63,7 +63,7 @@ real-client: all
real-client-install:
cp -p $(INSTALL_FILES) $(DESTDIR)$(CLIENT_BINDIR)
if [ -x $(INSTALL_NSE) ]; then \
$(INSTALL) -m 755 -o root -g wheel -d $(DESTDIR)/usr/local/bin; \
$(INSTALL) -m 755 -o root -d $(DESTDIR)/usr/local/bin; \
cp -p $(INSTALL_NSE) $(DESTDIR)/usr/local/bin; \
fi
......
......@@ -45,7 +45,7 @@ endif
$(MAKE) -C genhostsfile client
client-install: client
$(INSTALL) -m 755 -o root -g wheel -d $(LBINDIR)
-mkdir -p $(LBINDIR)
$(INSTALL_PROGRAM) $(SRCDIR)/install-tarfile $(LBINDIR)/install-tarfile
-mkdir -p $(DESTDIR)$(CLIENT_MANDIR)/man1
$(INSTALL) -m 644 $(SRCDIR)/install-tarfile.1 $(DESTDIR)$(CLIENT_MANDIR)/man1/install-tarfile.1
......@@ -83,7 +83,7 @@ cdboot-install: mfs-install frisbee-mfs
$(MAKE) -e -C growdisk client-install
remote-install:
$(INSTALL) -m 755 -o root -g wheel -d $(LBINDIR)
-mkdir -p $(LBINDIR)
$(INSTALL_PROGRAM) $(SRCDIR)/install-tarfile $(LBINDIR)/install-tarfile
$(INSTALL_PROGRAM) $(SRCDIR)/install-rpm $(LBINDIR)/install-rpm
......
......@@ -185,7 +185,7 @@ install: $(INSTALL_BINDIR)/imagezip $(INSTALL_BINDIR)/imageunzip $(INSTALL_BINDI
client: all
client-install: client
$(INSTALL) -m 755 -o root -g wheel -d $(DESTDIR)/usr/local/bin
$(INSTALL) -m 755 -o root -d $(DESTDIR)/usr/local/bin
$(INSTALL_PROGRAM) -s imagezip$(EXE) $(DESTDIR)/usr/local/bin/imagezip$(EXE)
$(INSTALL_PROGRAM) -s imageunzip$(EXE) $(DESTDIR)/usr/local/bin/imageunzip$(EXE)
$(INSTALL_PROGRAM) -s imagedump$(EXE) $(DESTDIR)/usr/local/bin/imagedump$(EXE)
......
......@@ -43,7 +43,7 @@ client: all
client-install: client
$(INSTALL_PROGRAM) emulab-syncd$(EXE) $(DESTDIR)$(CLIENT_BINDIR)/emulab-syncd$(EXE)
$(INSTALL_PROGRAM) emulab-sync$(EXE) $(DESTDIR)$(CLIENT_BINDIR)/emulab-sync$(EXE)
$(INSTALL) -m 755 -o root -g wheel -d $(DESTDIR)$(CLIENT_MANDIR)/man1
$(INSTALL) -m 755 -o root -d $(DESTDIR)$(CLIENT_MANDIR)/man1
$(INSTALL_DATA) $(SRCDIR)/emulab-syncd.1 $(DESTDIR)$(CLIENT_MANDIR)/man1/emulab-syncd.1
$(INSTALL_DATA) $(SRCDIR)/emulab-sync.1 $(DESTDIR)$(CLIENT_MANDIR)/man1/emulab-sync.1
......
......@@ -9,7 +9,7 @@ EVENTSYS = @EVENTSYS@
OBJDIR = ..
SUBDIR = tmcd
SYSTEM := $(shell uname -s)
SYSTEM := $(shell $(TESTBED_SRCDIR)/utils/osstuff.sh -o)
include $(OBJDIR)/Makeconf
......@@ -36,10 +36,6 @@ TMLIBS += -lssl -lcrypto
SSLOBJ = ssl.o
ifeq ($(SYSTEM),Linux)
RHLVERSION := $(shell cat /etc/redhat-release | sed -e 's/Red Hat Linux release \([0-9]\).*/Linux\1/')
ifeq ($(RHLVERSION),)
RHLVERSION := $(shell cat /etc/redhat-release | sed -e 's/Fedora Core release \([0-9]\).*/Fedora\1/')
endif
ifneq ($(LDSTATIC),)
NOKERB := $(shell nm /usr/lib/libssl.a | grep -q krb; echo $$?)
else
......@@ -53,34 +49,46 @@ TMLIBS += -lkrb5support
endif
endif
TMLIBS += -ldl
ifeq ($(findstring Fedora,$(RHLVERSION)),Fedora)
MDSUBDIR = fedora
else
ifeq ($(RHLVERSION),Linux9)
MDSUBDIR = linux9
else
endif
#
# Take care of historic naming fubars:
# Redhat 7.x -> linux
# Redhat 9.0 -> linux9
# Fedora 4/6 -> fedora
# Stargate 1 -> linux-sg
# FreeBSD 4.x -> freebsd
# Windows XP -> cygwinxp
#
MDSUBDIR := $(shell $(TESTBED_SRCDIR)/utils/osstuff.sh -t)
ifeq ($(SYSTEM),Linux)
ifeq ($(MDSUBDIR),redhat7)
MDSUBDIR = linux
endif
ifeq ($(MDSUBDIR),redhat9)
MDSUBDIR = linux9
endif
ifeq ($(findstring fedora,$(MDSUBDIR)),fedora)
MDSUBDIR = fedora
endif
ifeq ($(MDSUBDIR),stargate1)
MDSUBDIR = linux-sg
endif
endif
ifeq ($(SYSTEM),FreeBSD)
FBSDVERSION := $(shell uname -v | sed -e 's/FreeBSD \([0-9]\).*/freebsd\1/')
ifeq ($(FBSDVERSION),freebsd4)
ifeq ($(MDSUBDIR),freebsd4)
MDSUBDIR = freebsd
else
MDSUBDIR = $(FBSDVERSION)
endif
endif
ifeq ($(SYSTEM),CYGWIN_NT-5.1)
ifeq ($(SYSTEM),Cygwin)
# Cygwin on Windows XP (a.k.a. NT 5.1) - resembles the Linux case.
ifeq ($(MDSUBDIR),CYGWIN_NT-5.1)
MDSUBDIR = cygwinxp
TMSLIBS += -lminires
endif
ifeq ($(host_cpu),arm)
MDSUBDIR = linux-sg
endif
ifeq ($(EVENTSYS),1)
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -50,16 +50,16 @@ other-install:
(cd ../../tools; $(MAKE) DESTDIR=$(DESTDIR) client-install)
dir-install:
$(INSTALL) -m 755 -o root -g wheel -d $(ETCDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(BINDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(RCDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/db
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/jails
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/logs
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/boot
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/lock
$(INSTALL) -m 755 -o root -g wheel -d $(TBBINDIR)
$(INSTALL) -m 755 -o root -d $(ETCDIR)
$(INSTALL) -m 755 -o root -d $(BINDIR)
$(INSTALL) -m 755 -o root -d $(RCDIR)
$(INSTALL) -m 755 -o root -d $(VARDIR)
$(INSTALL) -m 755 -o root -d $(VARDIR)/db
$(INSTALL) -m 755 -o root -d $(VARDIR)/jails
$(INSTALL) -m 755 -o root -d $(VARDIR)/logs
$(INSTALL) -m 755 -o root -d $(VARDIR)/boot
$(INSTALL) -m 755 -o root -d $(VARDIR)/lock
$(INSTALL) -m 755 -o root -d $(TBBINDIR)
path-install: dir-install
$(INSTALL) -m 755 $(SRCDIR)/paths.pm $(ETCDIR)/paths.pm
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2004, 2007 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -77,8 +77,8 @@ sysetc-install: dir-install ###ifcfgs
# Watchdog assumes the ssh keys are in /etc/ssh.
ln -f -s /etc /etc/ssh
# Boot log files have to be writable by root under rc.cygwin .
$(INSTALL) -c -m 775 -o root -g wheel -d /var/log
$(INSTALL) -c -m 775 -o root -g wheel -d /var/db
$(INSTALL) -c -m 775 -o root -d /var/log
$(INSTALL) -c -m 775 -o root -d /var/db
# Need an /etc/shells file for rc.acounts.
$(INSTALL) -m 755 $(SRCDIR)/shells /etc/shells
......@@ -89,7 +89,7 @@ script-install: dir-install $(SCRIPTS)
$(INSTALL) -m 755 $(SRCDIR)/liblocsetup.pm $(BINDIR)/liblocsetup.pm
$(INSTALL) -m 755 $(SRCDIR)/prepare $(BINDIR)/prepare
$(INSTALL) -m 755 $(SRCDIR)/tbshutdown $(BINDIR)/tbshutdown
$(INSTALL) -c -m 755 -o root -g wheel -d /sbin
$(INSTALL) -c -m 755 -o root -d /sbin
$(INSTALL) -m 755 $(SRCDIR)/reboot /sbin/reboot
# Put the tcsh desktop startup script in the CygWin root directory.
$(INSTALL) -m 755 $(SRCDIR)/cygwin-tcsh.bat /
......
......@@ -47,23 +47,23 @@ install client-install: common-install etc-install \
simple-install: common-install script-install bin-install
dir-install:
$(INSTALL) -m 755 -o root -g wheel -d $(SYSETCDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(SYSETCDIR)/sysconfig
$(INSTALL) -m 755 -o root -g wheel -d $(SYSETCDIR)/sysconfig/network-scripts
$(INSTALL) -m 755 -o root -g wheel -d $(RCDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(RCDIR)/init.d
$(INSTALL) -m 755 -o root -g wheel -d $(RCDIR)/rc1.d
$(INSTALL) -m 755 -o root -g wheel -d $(DEFRUNLVLDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(RCDIR)/rc6.d
$(INSTALL) -m 755 -o root -g wheel -d $(ETCDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(BINDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(RCDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/db
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/jails
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/logs
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/sup
$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/boot
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/sysconfig
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/sysconfig/network-scripts
$(INSTALL) -m 755 -o root -g root -d $(RCDIR)
$(INSTALL) -m 755 -o root -g root -d $(RCDIR)/init.d
$(INSTALL) -m 755 -o root -g root -d $(RCDIR)/rc1.d
$(INSTALL) -m 755 -o root -g root -d $(DEFRUNLVLDIR)
$(INSTALL) -m 755 -o root -g root -d $(RCDIR)/rc6.d
$(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 $(RCDIR)
$(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)/jails
$(INSTALL) -m 755 -o root -g root -d $(VARDIR)/logs
$(INSTALL) -m 755 -o root -g root -d $(VARDIR)/sup
$(INSTALL) -m 755 -o root -g root -d $(VARDIR)/boot
-rm -rf $(DESTDIR)/etc/testbed
ln -s emulab $(DESTDIR)/etc/testbed
-rm -rf $(DESTDIR)/usr/local/etc/testbed
......@@ -74,7 +74,7 @@ common-install: dir-install
sup-install: dir-install supfile
$(INSTALL) -m 755 ./supfile $(ETCDIR)/supfile
$(INSTALL) -m 750 -o root -g wheel -d $(DESTDIR)/root/.cvsup
$(INSTALL) -m 750 -o root -g root -d $(DESTDIR)/root/.cvsup
$(INSTALL) -m 600 $(SRCDIR)/cvsup.auth $(DESTDIR)/root/.cvsup/auth
bin-install: dir-install
......@@ -103,7 +103,7 @@ sysetc-install: dir-install ifcfgs
$(INSTALL) -m 755 $(SRCDIR)/tbprepare $(RCDIR)/init.d/tbprepare
-ln -sf $(RRCDIR)/init.d/tbprepare $(RCDIR)/rc1.d/K89tbprepare
-ln -sf $(RRCDIR)/init.d/tbprepare $(RCDIR)/rc6.d/K89tbprepare
$(INSTALL) -m 755 -o root -g wheel -d $(SYSETCDIR)/cron.pend
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/cron.pend
if [ -e $(SYSETCDIR)/cron.daily/slocate.cron ]; then \
mv -f $(SYSETCDIR)/cron.daily/slocate.cron \
$(SYSETCDIR)/cron.pend; \
......@@ -113,7 +113,9 @@ sysetc-install: dir-install ifcfgs
$(SYSETCDIR)/cron.pend; \
fi
$(INSTALL) -m 755 $(SRCDIR)/rc.local $(RCDIR)/rc.local
-ln -sf $(RRCDIR)/rc.local $(SYSETCDIR)/rc.local
if [ "$(RCDIR)" != "$(SYSETCDIR)" ]; then \
ln -sf $(RRCDIR)/rc.local $(SYSETCDIR)/rc.local; \
fi
sysetc-remove:
-rm -f $(RCDIR)/*/S95anacron $(RCDIR)/*/K05anacron
......@@ -137,7 +139,7 @@ script-install: dir-install $(SCRIPTS)
$(INSTALL) -m 755 $(SRCDIR)/cpuspeed.awk $(BINDIR)/cpuspeed.awk
sfs-install:
$(INSTALL) -m 755 -o root -g wheel -d $(DESTDIR)/etc/sfs
$(INSTALL) -m 755 -o root -g root -d $(DESTDIR)/etc/sfs
$(INSTALL) -m 755 $(SRCDIR)/sfs.sh $(RCDIR)/init.d/sfs
-ln -sf $(RRCDIR)/init.d/nfs $(DEFRUNLVLDIR)/S20nfs
-ln -sf $(RRCDIR)/init.d/sfs $(RCDIR)/rc6.d/K19sfs
......
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
......@@ -55,7 +55,7 @@ if [ "$new_network_number" = "10.200.1.0" ]; then
if `$BINDIR/tmcc bossinfo >/dev/null 2>&1`; then
break
fi
echo "${interface}: waiting for DNS.." >>$LOGDIR/dhclient-exit.log 2>&1
echo "`date`: ${interface}: waiting for DNS.." >>$LOGDIR/dhclient-exit.log 2>&1
sleep $i
done
fi
......@@ -63,7 +63,7 @@ fi
#
# See if the Testbed configuration software wants to change the hostname.
#
$BINDIR/sethostname.dhclient >$LOGDIR/dhclient.log 2>&1
$BINDIR/sethostname.dhclient >>$LOGDIR/dhclient.log 2>&1
echo "`date`: ${interface}: ${reason}: done" >>$LOGDIR/dhclient-exit.log 2>&1
......
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004, 2006 University of Utah and the Flux Group.
# Copyright (c) 2000-2004, 2006, 2007 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -590,7 +590,16 @@ sub os_useradd($$$$$$$$$)
# Map the shell into a full path.
$shell = MapShell($shell);
if (system("$USERADD -M -u $uid -g $gid $glist -p '$pswd' ".
#
# -M is Redhat only option? Overrides default CREATE_HOME.
# So we see if CREATE_HOME is set and if so, use -M.
#
my $marg = "";
if (!system("grep -q CREATE_HOME /etc/login.defs")) {
$marg = "-M";
}
if (system("$USERADD $marg -u $uid -g $gid $glist -p '$pswd' ".
"-d $homedir -s $shell -c \"$gcos\" $login") != 0) {
warn "*** WARNING: $USERADD $login error.\n";
return -1;
......
......@@ -14,7 +14,7 @@ require 'ctime.pl';
#
my $DUMPDATES = "/etc/dumpdates";
my @DBFILES = ();
my @SYSVARDIRS = ("lib/dhcp", "spool/clientmqueue", "log/audit");
my @SYSVARDIRS = ("lib/dhcp", "lib/dhcp3", "spool/clientmqueue", "log/audit");
my @VARDIRS = ("logs", "db", "jails", "boot", "lock");
my @SOCKETS = ("/dev/log", "/var/run/acpid.socket");
my $FSTAB = "/etc/fstab";
......@@ -89,7 +89,7 @@ foreach my $dbfile (@DBFILES) {
#
if (!$noumount && -e "/share/freebsd") {
print "Unmounting NFS filesystems ...\n";
if (!system("umount -t nfs")) {
if (!system("umount -at nfs")) {
#
# Note that this command will not remove anything if the NFS unmounts
# failed (and we didn't catch it) because the directories in question
......
#!/bin/bash
#
# EMULAB-COPYRIGHT
# Copyright (c) 2006 University of Utah and the Flux Group.
# Copyright (c) 2006, 2007 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
......@@ -11,16 +11,13 @@
#
# description: Clean up node using Emulab's prepare script.
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
if [ ! -f /etc/sysconfig/network ]; then
exit 0
if [ -f /etc/sysconfig/network ]; then
. /etc/sysconfig/network
elif [ -f /lib/lsb/init-functions ]; then
. /lib/lsb/init-functions
fi
. /etc/sysconfig/network
RETVAL=0
# Oh, give me a break! Linux rc greps for keywords "daemon |action " to
......@@ -36,14 +33,21 @@ case "$1" in
# Note: /var/lock/subsys/tbprepare will be created later, as needed.
;;
stop)
rm /var/lock/subsys/tbprepare
echo "Running Testbed prepare script ..."
$BINDIR/prepare 2>&1 | tee /prepare.log
$BINDIR/logboot /prepare.log
rm -f /prepare.log
echo "Informing the testbed we're rebooting ..."
$BINDIR/tmcc state SHUTDOWN
RETVAL=$?
#
# Note the Ubuntu does not use the /var/lock/subsys files
# so we will get here on every shutdown, not just when the
# subsys file exists.
#
if [ -f /var/lock/subsys/tbprepare ]; then
rm -f /var/lock/subsys/tbprepare
echo "Running Testbed prepare script ..."
$BINDIR/prepare 2>&1 | tee /prepare.log
$BINDIR/logboot /prepare.log
rm -f /prepare.log
echo "Informing the testbed we're rebooting ..."
$BINDIR/tmcc state SHUTDOWN
RETVAL=$?
fi
;;
status)
echo "Peachy"
......
......@@ -13,17 +13,20 @@
# and terminates any lingering daemons.
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
fi
# Source networking configuration.
if [ ! -f /etc/sysconfig/network ]; then
exit 0
if [ -f /etc/sysconfig/network ]; then
. /etc/sysconfig/network
elif [ -f /lib/lsb/init-functions ]; then
. /lib/lsb/init-functions
NETWORKING=yes
fi
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ "${NETWORKING}" = "no" ] && exit 0
RETVAL=0
......@@ -35,7 +38,7 @@ case "$1" in
# Note, /var/lock/subsys/testbed will be created at that time.
;;
stop)
rm /var/lock/subsys/testbed
rm -f /var/lock/subsys/testbed /var/emulab/boot/controlif
echo "Shutting down testbed daemons (some may fail)..."
echo -n " trafgen: "
killproc trafgen
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# All rights reserved.
#
#
# XXX ONLY RUN THIS INSTALL ON AN UBUNTO LINUX TESTBED 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/ubuntu7
include $(OBJDIR)/Makeconf
SCRIPTS =
#
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
#
all: supfile ifcfgs
include $(TESTBED_SRCDIR)/GNUmakerules
SYSETCDIR = $(DESTDIR)/etc
ETCDIR = $(DESTDIR)$(CLIENT_ETCDIR)
BINDIR = $(DESTDIR)$(CLIENT_BINDIR)
VARDIR = $(DESTDIR)$(CLIENT_VARDIR)
RCDIR = $(SYSETCDIR)
RRCDIR = /etc
INSTALL = /usr/bin/install -c
COMMON = $(SRCDIR)/../common
install client-install: common-install etc-install \
script-install bin-install sysetc-fixup
@echo "Remember to install the PEM files if necessary"
simple-install: common-install script-install bin-install
dir-install:
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/dhcp3
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/network
common-install: dir-install
(cd ../common; $(MAKE) DESTDIR=$(DESTDIR) local-install)
bin-install: dir-install
(cd ../linux; $(MAKE) DESTDIR=$(DESTDIR) RCDIR=$(RCDIR) bin-install)
$(INSTALL) -m 755 $(SRCDIR)/findcnet $(BINDIR)/findcnet
etc-install: dir-install common-sysetc-install
common-sysetc-install: dir-install
(cd ../linux; $(MAKE) DESTDIR=$(DESTDIR) RCDIR=$(RCDIR) RRCDIR=$(RRCDIR) sysetc-install)
sysetc-fixup:
rm -rf $(SYSETCDIR)/modules.conf $(SYSETCDIR)/cron.pend $(SYSETCDIR)/sysconfig $(SYSETCDIR)/init.d/ntpd
mv $(SYSETCDIR)/dhclient-enter-hooks $(SYSETCDIR)/dhcp3/
mv $(SYSETCDIR)/dhclient-exit-hooks $(SYSETCDIR)/dhcp3/
rm -f $(RRCDIR)/rc.local $(SYSETCDIR)/rc.local
$(INSTALL) -m 755 $(SRCDIR)/rc.local $(SYSETCDIR)/rc.local
$(INSTALL) -m 755 $(SRCDIR)/interfaces $(SYSETCDIR)/network/interfaces
$(INSTALL) -m 755 $(SRCDIR)/ntp.sh $(RCDIR)/init.d/ntp
script-install: dir-install $(SCRIPTS)
(cd ../linux; $(MAKE) DESTDIR=$(DESTDIR) RCDIR=$(RCDIR) script-install)
sfs-install:
#!/bin/sh
#
# Find the Emulab control network interface.
#
# When called the first time (an invocation on any interface when
# /var/emulab/boot/controlif does not exist) we run DHCP and find the
# control network.
#
# On all invocations, we check the contents of that file against the
# interface we were called with and return "cnet" if we are the control
# net. Otherwise we just return the physical interface name.
#
set -e
export LANG=C
iface="$1"
. /etc/emulab/paths.sh
#
# We use /var/run to store the current idea of the cnet interface
# because we want it to go away on reboot.
#
cnetfile="/var/run/cnet"
cnetif=""
if [ ! -f $cnetfile ]; then
cp /dev/null $cnetfile
#
# Find a list of candidate interfaces.
#
_iflist=""
for _if in `ifconfig -s -a | awk '{ print $1 }' | grep -v Iface`; do
case $_if in
eth*)
_iflist="$_iflist $_if"
;;
*)
;;
esac
done
echo "`date`: $iface: findcnet running dhclient on: $_iflist"
#
# If dhclient returns success, then it has configured the first interface
# and gone into background mode. At that point we don't care about it any
# more and just kill it. We also shutdown all the other interfaces (which
# dhclient will leave "up").
#
if [ -x /sbin/dhclient ] && /sbin/dhclient -q $_iflist ; then
killall dhclient
rm -f /var/run/dhclient.pid
echo "`date`: $iface: findcnet dhclient returned"
if [ -f $BOOTDIR/controlif ]; then
cp $BOOTDIR/controlif $cnetfile
cnetif=`cat $cnetfile`
for _if in $_iflist; do
if [ $_if != "lo" -a x$_if != x$cnetif ]
then
echo "`date`: taking $_if down"
ifconfig $_if down
fi
done
fi
fi
else
cnetif=`cat $cnetfile`
fi >>$LOGDIR/dhclient.log 2>&1
#
# In case ifup/ifdown try to feed us anything
#
while read foo bar; do
echo "`date`: $iface: findcnet got \"$foo $bar\" from caller"
done >>$LOGDIR/dhclient.log 2>&1
if [ -z "$cnetif" ]; then
echo "`date`: $iface: findcnet got empty $cnetfile" >>$LOGDIR/dhclient.log
fi
echo "`date`: $iface: cnet is $cnetif" >>$LOGDIR/dhclient.log
if [ "$cnetif" != "$iface" ]; then
echo $iface
else
echo "cnet"
fi
exit 0
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
dhcp:x:101:
syslog:x:102:
klog:x:103:
scanner:x:104:
nvram:x:105:
crontab:x:106:
ssh:x:107:
root:*::
daemon:*::
bin:*::
sys:*::
adm:*::
tty:*::
disk:*::
lp:*::
mail:*::
news:*::
uucp:*::
man:*::
proxy:*::
kmem:*::
dialout:*::
fax:*::
voice:*::
cdrom:*::
floppy:*::
tape:*::
sudo:*::
audio:*::
dip:*::
www-data:*::
backup:*::
operator:*::
list:*::
irc:*::
src:*::
gnats:*::
shadow:*::
utmp:*::
video:*::
sasl:*::
plugdev:*::
staff:*::
games:*::
users:*::
nogroup:*::
dhcp:!::
syslog:!::
klog:!::
scanner:!::
nvram:!::
crontab:!::
ssh:!::
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
#
# XXX abuse of mapping function follows.
# The findcnet script DHCPs on all interfaces the first time it is invoked
# and uses the results of that for every other invocation. The script
# returns "cnet" for the interface that is the control net, and the physical
# interface name for all others.
#
mapping eth*
script /usr/local/etc/emulab/findcnet
#
# The control network has been identified and configured indirectly
# via the mapping above. Here we just make sure that if shutdown, we
# remove the indicator file so that we will re-DHCP next time.
#
auto eth0 eth1 eth2 eth3 eth4 eth5 eth6 eth7 eth8 eth9
iface cnet inet manual
up echo "Emulab control net is $IFACE"
down rm -f /var/run/cnet
down ifconfig $IFACE down
#!/bin/sh
### BEGIN INIT INFO
# Provides: ntp
# Required-Start: $network $remote_fs $syslog