mirror of
https://github.com/strongswan/strongswan.git
synced 2025-12-08 00:00:29 -05:00
Instead of extracting a downloaded Gentoo filesystem tree into a file containing a reiserfs filesystem, create an ext3 filesystem inside a sparse file, mount it and debootstrap an up-to-date Debian system. Use this image as base for all UML guest images. Also, drop support for the various consoles and use xterm unconditionally.
133 lines
5.4 KiB
Bash
Executable File
133 lines
5.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# build the hosts configuration directory with the actual IP addresses
|
|
#
|
|
# Copyright (C) 2004 Eric Marchionni, Patrik Rayo
|
|
# Zuercher Hochschule Winterthur
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by the
|
|
# Free Software Foundation; either version 2 of the License, or (at your
|
|
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
#
|
|
# This program is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
# for more details.
|
|
|
|
DIR=`dirname $0`
|
|
|
|
source $DIR/function.sh
|
|
|
|
[ -f $DIR/../testing.conf ] || die "!! Configuration file 'testing.conf' not found"
|
|
[ -d $DIR/../hosts ] || die "!! Directory 'hosts' not found"
|
|
|
|
source $DIR/../testing.conf
|
|
|
|
if [ ! -d $BUILDDIR ]
|
|
then
|
|
cecho " * Creating directory '$BUILDDIR'"
|
|
mkdir $BUILDDIR
|
|
fi
|
|
|
|
########################################
|
|
# copy default host configs to $BUILDDIR
|
|
#
|
|
|
|
HOSTCONFIGDIR=${BUILDDIR}/hosts
|
|
|
|
if [ -d $HOSTCONFIGDIR ]
|
|
then
|
|
rm -r $HOSTCONFIGDIR
|
|
fi
|
|
|
|
mkdir $HOSTCONFIGDIR
|
|
|
|
cecho-n " * Copying default host config for.."
|
|
|
|
for host in $STRONGSWANHOSTS
|
|
do
|
|
cecho-n "$host.."
|
|
HOSTDIR=${HOSTCONFIGDIR}/$host
|
|
mkdir $HOSTDIR
|
|
cp -rfp $UMLTESTDIR/testing/hosts/default/* $HOSTDIR
|
|
cp -rfp $UMLTESTDIR/testing/hosts/$host/* $HOSTDIR
|
|
done
|
|
|
|
cgecho "done"
|
|
|
|
########################################
|
|
# assign IP for each host to hostname
|
|
#
|
|
|
|
cecho-n " * Generate default config for.."
|
|
|
|
HOSTIP=`ifconfig eth0 |grep inet |sed -e "s/.*inet addr://" -e "s/ Bcast.*//"`
|
|
|
|
for host in $STRONGSWANHOSTS
|
|
do
|
|
cecho-n "${host}.."
|
|
eval ipv4_${host}="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
|
|
eval ipv6_${host}="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
|
|
|
|
[ "`eval echo \\\$ipv4_${host}`" != "$HOSTIP" ] || die "$host has the same IP as eth0 (Host)! Please change that."
|
|
|
|
case $host in
|
|
moon)
|
|
eval ipv4_moon1="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
|
|
[ "`eval echo \\\$ipv4_moon1`" != "$HOSTIP" ] || die "eth1 of $host has the same IP as eth0 (Host)! Please change that."
|
|
searchandreplace PH_IP_MOON1 $ipv4_moon1 $HOSTCONFIGDIR
|
|
searchandreplace PH_IP_MOON $ipv4_moon $HOSTCONFIGDIR
|
|
eval ipv6_moon1="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
|
|
searchandreplace PH_IP6_MOON1 $ipv6_moon1 $HOSTCONFIGDIR
|
|
searchandreplace PH_IP6_MOON $ipv6_moon $HOSTCONFIGDIR
|
|
;;
|
|
sun)
|
|
eval ipv4_sun1="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
|
|
[ "`eval echo \\\$ipv4_sun1`" != "$HOSTIP" ] || die "eth1 of $host has the same IP as eth0 (Host)! Please change that."
|
|
searchandreplace PH_IP_SUN1 $ipv4_sun1 $HOSTCONFIGDIR
|
|
searchandreplace PH_IP_SUN $ipv4_sun $HOSTCONFIGDIR
|
|
eval ipv6_sun1="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
|
|
searchandreplace PH_IP6_SUN1 $ipv6_sun1 $HOSTCONFIGDIR
|
|
searchandreplace PH_IP6_SUN $ipv6_sun $HOSTCONFIGDIR
|
|
;;
|
|
alice)
|
|
eval ipv4_alice1="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
|
|
searchandreplace PH_IP_ALICE1 $ipv4_alice1 $HOSTCONFIGDIR
|
|
searchandreplace PH_IP_ALICE $ipv4_alice $HOSTCONFIGDIR
|
|
eval ipv6_alice1="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
|
|
searchandreplace PH_IP6_ALICE1 $ipv6_alice1 $HOSTCONFIGDIR
|
|
searchandreplace PH_IP6_ALICE $ipv6_alice $HOSTCONFIGDIR
|
|
;;
|
|
venus)
|
|
searchandreplace PH_IP_VENUS $ipv4_venus $HOSTCONFIGDIR
|
|
searchandreplace PH_IP6_VENUS $ipv6_venus $HOSTCONFIGDIR
|
|
;;
|
|
bob)
|
|
searchandreplace PH_IP_BOB $ipv4_bob $HOSTCONFIGDIR
|
|
searchandreplace PH_IP6_BOB $ipv6_bob $HOSTCONFIGDIR
|
|
;;
|
|
carol)
|
|
eval ipv4_carol1="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
|
|
searchandreplace PH_IP_CAROL1 $ipv4_carol1 $HOSTCONFIGDIR
|
|
searchandreplace PH_IP_CAROL $ipv4_carol $HOSTCONFIGDIR
|
|
eval ipv6_carol1="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
|
|
searchandreplace PH_IP6_CAROL1 $ipv6_carol1 $HOSTCONFIGDIR
|
|
searchandreplace PH_IP6_CAROL $ipv6_carol $HOSTCONFIGDIR
|
|
;;
|
|
dave)
|
|
eval ipv4_dave1="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
|
|
searchandreplace PH_IP_DAVE1 $ipv4_dave1 $HOSTCONFIGDIR
|
|
searchandreplace PH_IP_DAVE $ipv4_dave $HOSTCONFIGDIR
|
|
eval ipv6_dave1="`echo $HOSTNAMEIPV6 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $2 }' | awk '{ print $1 }'`"
|
|
searchandreplace PH_IP6_DAVE1 $ipv6_dave1 $HOSTCONFIGDIR
|
|
searchandreplace PH_IP6_DAVE $ipv6_dave $HOSTCONFIGDIR
|
|
;;
|
|
winnetou)
|
|
searchandreplace PH_IP_WINNETOU $ipv4_winnetou $HOSTCONFIGDIR
|
|
searchandreplace PH_IP6_WINNETOU $ipv6_winnetou $HOSTCONFIGDIR
|
|
;;
|
|
esac
|
|
done
|
|
|
|
cgecho "done"
|