source: fedkit/make_hosts

Last change on this file was b4624b2, checked in by Ted Faber <faber@…>, 14 years ago

remove first parameter from make_hosts - we calculate the dir already and it only confuses startcmd generation

  • Property mode set to 100755
File size: 3.1 KB
RevLine 
[3c7da22]1#!/bin/sh
2
[9d207bd]3# find perl
4if [ -x "/usr/bin/perl" ]; then
5    PERL="/usr/bin/perl"
6else
7    if [ -x "/usr/local/bin/perl" ]; then
8        PERL="/usr/local/bin/perl"
9    else
10        # Wing it...
11        PERL="perl"
12    fi
13fi
14
15# Find this experiment's stashed scripts.  (Perl for advanced parsing)
16EMUDIR="/usr/local/etc/emulab/"
17PROJECT=`$EMUDIR/tmcc -b status | $PERL -ne '/ALLOCATED=([^\/]+)\/([^\s]+)/ && print "$1\n";'`
18EXP=`$EMUDIR/tmcc -b status | $PERL -ne '/ALLOCATED=([^\/]+)\/([^\s]+)/ && print "$2\n";'`
[9c166cf]19CONFIGDIR="/proj/$PROJECT/exp/$EXP/tmp"
20SCRIPTDIR="/usr/local/federation/bin"
[9d207bd]21
[3c7da22]22# Very simple script to copy the global hosts file over the local one
23# while preserving the localhost entry.  Run on DETER master clients
24
25grep 127\\.0\\.0\\.1 /etc/hosts > /tmp/hosts
[b4624b2]26cat "$CONFIGDIR/hosts" >> /tmp/hosts
[3c7da22]27cp /tmp/hosts /etc/hosts && rm /tmp/hosts
[e06b224]28
[7add1a3]29# Find the right version of pkill.  For killing.
30if [ -x "/usr/bin/pkill" ] ; then 
31        PKILL="/usr/bin/pkill"
32else
33        if [ -x "/bin/pkill" ] ; then 
34                PKILL="/bin/pkill"
35        else
36                PKILL="echo"
[f778038]37        fi
38fi
39
[9d207bd]40# XXX: modified seer daemon to read a config file.  Not in the tarfile yet.  If
41# we see one, and there's a /usr/seer/backend/daemon.py, replace that one with
42# the local one.
43if [ -e /usr/seer/backend/daemon.py ] && [ -e $SCRIPTDIR/daemon.py ]; then
44        /bin/cp $SCRIPTDIR/daemon.py /usr/seer/backend/daemon.py
45fi
46
47if [ -e /usr/seer/backend/experiment-setup.py ] && [ -e $SCRIPTDIR/experiment-setup.py ]; then
48        /bin/cp $SCRIPTDIR/experiment-setup.py /usr/seer/backend/experiment-setup.py
49fi
50
51# Copy the seer.conf to the local /tmp if there is one
52
[9c166cf]53if [ -e $CONFIGDIR/seer.conf ]; then
54        /bin/cp $CONFIGDIR/seer.conf /tmp
[9d207bd]55fi
56
57
[7c3008e]58# SEER feels pain and confusion if times are wrong.  This lays a big lick on
59# ntp sets the time directly and then restarts it.  XXX FreeBSD incantation is
60# untested.
61
62case `uname` in
63        "FreeBSD")
64                /etc/rc.d/ntpd stop
65                /usr/sbin/ntpdate boss
66                /etc/rc.d/ntpd start
67                ;;
68        "Linux")
69                /etc/rc.d/init.d/ntpd stop
70                /usr/sbin/ntpdate boss
71                /etc/rc.d/init.d/ntpd start
72                ;;
73esac
[6c1981f]74
75# If we need to configure an interface up for a DRAGON embedding, do it here.
76if [ -e $SCRIPTDIR/config_from_tunnelip.pl ]; then
77        $PERL $SCRIPTDIR/config_from_tunnelip.pl
78fi
[7add1a3]79# I remain unclear why ospfd seems screwed up after the resetting of accounts
80# and mounts.  This seems to fix it, but it's not very satisfying.  At this
81# point the federated topology is complete, so any problems with routing in a
82# partial topology -e.g. failed or partial bridging - that might have confused
83# the router should be gone.
84$PKILL ospf
85$PKILL gated
86
87# XXX Danger, hack ahead.  Apparently our FC6-SMB image and emulab disagree
88# about where gated lives.  This will alias it.
89if [ ! -x /usr/sbin/gated ] ; then 
90        if [ -x /sbin/gated ] ; then
91                ln /sbin/gated /usr/sbin/gated
92        fi
93fi
94/usr/local/etc/emulab/rc/rc.route
95
[7c3008e]96
97# Execute any command passed in as a startcmd.  This basically daisy chains the
98# startcmd.  This needs to become a perl script to have uniform behavior here.
[b4624b2]99echo "*$1* *$2*"
100if [ ! -z "$1" ]; then 
101        echo "calling *$1* *$2*"
[7c3008e]102        case `uname` in
103                "FreeBSD")
[b4624b2]104                        su -l "$1" -c "$2"
[7c3008e]105                        ;;
106                "Linux")
[b4624b2]107                        su "$1" --command="$2"
[7c3008e]108                        ;;
109        esac
[e06b224]110fi
Note: See TracBrowser for help on using the repository browser.