2 # build the hosts configuration directory with the actual IP addresses
4 # Copyright (C) 2004 Eric Marchionni, Patrik Rayo
5 # Zuercher Hochschule Winterthur
7 # This program is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by the
9 # Free Software Foundation; either version 2 of the License, or (at your
10 # option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 # RCSID $Id: build-hostconfig,v 1.3 2005/02/08 10:40:48 as Exp $
21 source $DIR/function.sh
23 [ -f $DIR/..
/testing.conf
] || die
"!! Configuration file 'testing.conf' not found"
24 [ -d $DIR/..
/hosts
] || die
"!! Directory 'hosts' not found"
26 source $DIR/..
/testing.conf
30 cecho
" * Creating directory '$BUILDDIR'"
34 ########################################
35 # copy default host configs to $BUILDDIR
38 HOSTCONFIGDIR
=${BUILDDIR}/hosts
40 if [ -d $HOSTCONFIGDIR ]
46 cp -rfp ${UMLTESTDIR}/testing
/hosts
$BUILDDIR
48 cecho
" * Copied default host config directory to '$HOSTCONFIGDIR'"
50 ########################################
51 # assign IP for each host to hostname
54 cecho-n
" * Generate default config for.."
56 HOSTIP
=`ifconfig eth0 |grep inet |sed -e "s/.*inet addr://" -e "s/ Bcast.*//"`
58 for host in $STRONGSWANHOSTS
61 eval ip_
${host}="`echo $HOSTNAMEIPS | sed -n -e "s/^.*${host}://gp" | awk -F : '{ print $1 }' | awk '{ print
$1 }'`"
63 [ "`eval echo \\\$ip_${host}`" != "$HOSTIP" ] || die "$host has the same IP as eth0 (Host)! Please change that."
67 eval ip1_${host}="`echo $HOSTNAMEIPS | sed -n -e "s/^.*${host}://gp" | awk -F : '{ print $2 }' |
awk '{ print $1 }'`"
68 [ "`eval echo \\\
$ip1_${host}`" != "$HOSTIP" ] || die "eth1 of $host has the same IP as eth0 (Host)! Please change that."
69 searchandreplace PH_IP_MOON $ip_moon $HOSTCONFIGDIR
70 searchandreplace PH_IP1_MOON $ip1_moon $HOSTCONFIGDIR
73 eval ip1_${host}="`echo $HOSTNAMEIPS | sed -n -e "s/^.*${host}://gp" | awk -F : '{ print $2 }' | awk '{ print $1 }'`"
74 [ "`eval echo \\\$ip1_${host}`" != "$HOSTIP" ] || die "eth1 of
$host has the same IP as eth0
(Host
)! Please change that.
"
75 searchandreplace PH_IP_SUN $ip_sun $HOSTCONFIGDIR
76 searchandreplace PH_IP1_SUN $ip1_sun $HOSTCONFIGDIR
79 searchandreplace PH_IP_ALICE $ip_alice $HOSTCONFIGDIR
82 searchandreplace PH_IP_VENUS $ip_venus $HOSTCONFIGDIR
85 searchandreplace PH_IP_BOB $ip_bob $HOSTCONFIGDIR
88 eval ip1_${host}="`echo $HOSTNAMEIPS | sed -n -e "s/^.*${host}://gp" | awk -F : '{ print $2 }' | awk '{ print $1 }'`"
89 searchandreplace PH_IP_CAROL
$ip_carol $HOSTCONFIGDIR
90 searchandreplace PH_IP1_CAROL
$ip1_carol $HOSTCONFIGDIR
93 eval ip1_
${host}="`echo $HOSTNAMEIPS | sed -n -e "s/^.*${host}://gp" | awk -F : '{ print $2 }' | awk '{ print
$1 }'`"
94 searchandreplace PH_IP_DAVE $ip_dave $HOSTCONFIGDIR
95 searchandreplace PH_IP1_DAVE $ip1_dave $HOSTCONFIGDIR
98 searchandreplace PH_IP_WINNETOU $ip_winnetou $HOSTCONFIGDIR