source: fedkit/make_hosts @ 9c166cf

axis_examplecompt_changesinfo-opsversion-1.30version-2.00version-3.01version-3.02
Last change on this file since 9c166cf was 9c166cf, checked in by Ted Faber <faber@…>, 16 years ago

Support for this as a real fedkit. Loads using fedd and establishes connectivity

  • Property mode set to 100755
File size: 2.9 KB
Line 
1#!/bin/sh
2
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";'`
19CONFIGDIR="/proj/$PROJECT/exp/$EXP/tmp"
20SCRIPTDIR="/usr/local/federation/bin"
21
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
26cat $1 >> /tmp/hosts
27cp /tmp/hosts /etc/hosts && rm /tmp/hosts
28
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"
37        fi
38fi
39
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
53if [ -e $CONFIGDIR/seer.conf ]; then
54        /bin/cp $CONFIGDIR/seer.conf /tmp
55fi
56
57
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
74# I remain unclear why ospfd seems screwed up after the resetting of accounts
75# and mounts.  This seems to fix it, but it's not very satisfying.  At this
76# point the federated topology is complete, so any problems with routing in a
77# partial topology -e.g. failed or partial bridging - that might have confused
78# the router should be gone.
79$PKILL ospf
80$PKILL gated
81
82# XXX Danger, hack ahead.  Apparently our FC6-SMB image and emulab disagree
83# about where gated lives.  This will alias it.
84if [ ! -x /usr/sbin/gated ] ; then 
85        if [ -x /sbin/gated ] ; then
86                ln /sbin/gated /usr/sbin/gated
87        fi
88fi
89/usr/local/etc/emulab/rc/rc.route
90
91
92# Execute any command passed in as a startcmd.  This basically daisy chains the
93# startcmd.  This needs to become a perl script to have uniform behavior here.
94echo "*$2* *$3*"
95if [ ! -z "$2" ]; then 
96        echo "calling *$2* *$3*"
97        case `uname` in
98                "FreeBSD")
99                        su -l "$2" -c "$3"
100                        ;;
101                "Linux")
102                        su "$2" --command="$3"
103                        ;;
104        esac
105fi
Note: See TracBrowser for help on using the repository browser.