testing: Switch to Debian based guest images

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.
This commit is contained in:
Reto Buerki
2012-12-18 16:00:21 +01:00
committed by Tobias Brunner
parent 0080daa787
commit aa5803e0e3
16 changed files with 189 additions and 655 deletions
+3 -16
View File
@@ -558,14 +558,14 @@ do
for file in clients.conf eap.conf radiusd.conf proxy.conf users for file in clients.conf eap.conf radiusd.conf proxy.conf users
do do
scp $SSHCONF $HOSTLOGIN:/etc/raddb/$file \ scp $SSHCONF $HOSTLOGIN:/etc/freeradius/$file \
$TESTRESULTDIR/${host}.$file > /dev/null 2>&1 $TESTRESULTDIR/${host}.$file > /dev/null 2>&1
done done
scp $SSHCONF $HOSTLOGIN:/etc/strongswan.conf \ scp $SSHCONF $HOSTLOGIN:/etc/strongswan.conf \
$TESTRESULTDIR/${host}.strongswan.conf > /dev/null 2>&1 $TESTRESULTDIR/${host}.strongswan.conf > /dev/null 2>&1
scp $SSHCONF $HOSTLOGIN:/var/log/radius/radius.log \ scp $SSHCONF $HOSTLOGIN:/var/log/freeradius/radius.log \
$TESTRESULTDIR/${host}.radius.log > /dev/null 2>&1 $TESTRESULTDIR/${host}.radius.log > /dev/null 2>&1
chmod a+r $TESTRESULTDIR/* chmod a+r $TESTRESULTDIR/*
@@ -584,7 +584,6 @@ do
<ul> <ul>
<li><a href="$host.eap.conf">eap.conf</a></li> <li><a href="$host.eap.conf">eap.conf</a></li>
<li><a href="$host.radius.log">radius.log</a></li> <li><a href="$host.radius.log">radius.log</a></li>
<li><a href="$host.daemon.log">daemon.log</a></li>
</ul> </ul>
</td> </td>
<td valign="top"> <td valign="top">
@@ -648,18 +647,6 @@ do
done done
##########################################################################
# get a copy of /var/log/daemon.log
#
for host in $RADIUSHOSTS
do
eval HOSTLOGIN=root@\$ipv4_${host}
ssh $SSHCONF $HOSTLOGIN grep imcv /var/log/daemon.log \
>> $TESTRESULTDIR/${host}.daemon.log
done
########################################################################## ##########################################################################
# stop tcpdump if necessary # stop tcpdump if necessary
# #
@@ -777,7 +764,7 @@ cecho ""
# copy the test results to the apache server # copy the test results to the apache server
# #
HTDOCS="/var/www/localhost/htdocs" HTDOCS="/var/www"
cecho-n "Copying test results to winnetou.." cecho-n "Copying test results to winnetou.."
ssh $SSHCONF root@${ipv4_winnetou} mkdir -p $HTDOCS/testresults > /dev/null 2>&1 ssh $SSHCONF root@${ipv4_winnetou} mkdir -p $HTDOCS/testresults > /dev/null 2>&1
+17 -15
View File
@@ -21,6 +21,7 @@ source $DIR/scripts/function.sh
[ -f $DIR/testing.conf ] || die "!! Configuration file 'testing.conf' not found." [ -f $DIR/testing.conf ] || die "!! Configuration file 'testing.conf' not found."
source $DIR/testing.conf source $DIR/testing.conf
rm -f $LOGFILE
if [ "$#" -eq 0 ] if [ "$#" -eq 0 ]
then then
@@ -29,6 +30,16 @@ else
HOSTS=$* HOSTS=$*
fi fi
##########################################################################
# build base image
#
if [ $ENABLE_BUILD_BASEIMAGE = "yes" ]
then
cecho "Building base image"
$DIR/scripts/build-baseimage
fi
########################################################################## ##########################################################################
# build the UML kernel based on a vanilla kernel form kernel.org # build the UML kernel based on a vanilla kernel form kernel.org
# and a matching UML patch from user-mode-linux.sourceforge.net # and a matching UML patch from user-mode-linux.sourceforge.net
@@ -40,12 +51,13 @@ then
fi fi
########################################################################## ##########################################################################
# Adding the ssh RSA public keys to ~/.ssh/known_hosts # build a generic UML root file system based on a Gentoo root file system.
# compile and install a specified strongSwan release into the file system.
# #
if [ $ENABLE_BUILD_SSHKEYS = "yes" ] if [ $ENABLE_BUILD_UMLROOTFS = "yes" ]
then then
cecho "Adding ssh public keys of the uml instances (scripts/build-sshkeys)" cecho "Building uml base image (scripts/build-umlrootfs)"
$DIR/scripts/build-sshkeys $DIR/scripts/build-umlrootfs
fi fi
########################################################################## ##########################################################################
@@ -58,22 +70,12 @@ then
$DIR/scripts/build-hostconfig $DIR/scripts/build-hostconfig
fi fi
##########################################################################
# build a generic UML root file system based on a Gentoo root file system.
# compile and install a specified strongSwan release into the file system.
#
if [ $ENABLE_BUILD_UMLROOTFS = "yes" ]
then
cecho "Building uml root file system with strongSwan (scripts/build-umlrootfs)"
$DIR/scripts/build-umlrootfs
fi
########################################################################## ##########################################################################
# Creating the root filesystems for the specified UML instances # Creating the root filesystems for the specified UML instances
# #
if [ $ENABLE_BUILD_UMLHOSTFS = "yes" ] if [ $ENABLE_BUILD_UMLHOSTFS = "yes" ]
then then
cecho "Building uml host root file systems (scripts/build-umlhostfs)" cecho "Building uml host images (scripts/build-umlhostfs)"
$DIR/scripts/build-umlhostfs $HOSTS $DIR/scripts/build-umlhostfs $HOSTS
fi fi
+66
View File
@@ -0,0 +1,66 @@
#!/bin/bash
if [ `id -u` != 0 ];
then
echo "! you must be root to run $0"
exit
fi
DIR=`dirname $0`
. $DIR/function.sh
[ -f $DIR/../testing.conf ] || die "!! Configuration file 'testing.conf' not found"
. $DIR/../testing.conf
execute()
{
cmd=${1}
echo $cmd >>$LOGFILE
$cmd >>$LOGFILE 2>&1
status=$?
if [ $status != 0 ]; then
echo "! command $cmd failed, exiting (status $status)"
echo "! check why here $LOGFILE"
exit 1
fi
}
# additional packages
EXTRAS=build-essential,gperf,libgmp-dev,libldap2-dev,libcurl4-openssl-dev,libxml2-dev,libtspi-dev,libsqlite3-dev,openssh-server,tcpdump,psmisc,openssl,vim,sqlite3,conntrack,gdb
SERVICES="isc-dhcp-server apache2 slapd"
PACKAGES=$EXTRAS,${SERVICES// /,}
CACHEDIR=$BUILDDIR/cache
APTCACHE=$LOOPDIR/var/cache/apt/archives
mkdir -p $LOOPDIR
mkdir -p $BUILDDIR
mkdir -p $CACHEDIR
rm -f $ROOTFS
echo "`date`, building $ROOTFS" >>$LOGFILE
echo " * Creating sparse image $ROOTFS ..."
execute "dd if=/dev/null of=$ROOTFS bs=1M seek=$ROOTFSSIZE count=1"
echo " * Creating ext3 filesystem ..."
execute "mkfs.ext3 -F $ROOTFS"
execute "mount -o loop $ROOTFS $LOOPDIR"
mkdir -p $APTCACHE
execute "mount -o bind $CACHEDIR $APTCACHE"
echo " * Running debootstrap ..."
execute "debootstrap --arch=$ROOTFSARCH --include=$PACKAGES $ROOTFSSUITE $LOOPDIR $ROOTFSMIRROR"
echo " * Setting root password to '$ROOTFSPW' ..."
echo root:$ROOTFSPW | chroot $LOOPDIR chpasswd
echo " * Disabling services ..."
for service in $SERVICES
do
echo -n " - $service ... "
execute "chroot $LOOPDIR /etc/init.d/$service stop"
execute "chroot $LOOPDIR update-rc.d -f $service remove"
echo "done"
done
execute "umount -l $APTCACHE"
execute "umount -l $LOOPDIR"
+12 -2
View File
@@ -41,9 +41,19 @@ then
fi fi
mkdir $HOSTCONFIGDIR mkdir $HOSTCONFIGDIR
cp -rfp ${UMLTESTDIR}/testing/hosts $BUILDDIR
cecho " * Copied default host config directory to '$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 # assign IP for each host to hostname
-86
View File
@@ -1,86 +0,0 @@
#!/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
LOGFILE=${BUILDDIR}/testing.log
if [ ! -f $LOGFILE ]
then
cecho-n " * Logfile '$LOGFILE' does not exist..creating.."
touch $LOGFILE
cgecho "done"
fi
if [ ! -d ~/.ssh ]
then
cecho-n " * Creating directory '~/.ssh'.."
mkdir ~/.ssh
cgecho "done"
fi
if [ -f ~/.ssh/known_hosts ]
then
cecho-n " * Backing up ~/.ssh/known_hosts to '~/.ssh/known_hosts.before_uml'.."
cp -fp ~/.ssh/known_hosts ~/.ssh/known_hosts.before_uml
cgecho "done"
else
cecho-n " * Creating '~/.ssh/known_hosts'"
touch ~/.ssh/known_hosts
cgecho "done"
fi
for host in $HOSTNAMEIPV4
do
HOSTNAME=`echo $host | awk -F, '{ print $1 }'`
IP=`echo $host | awk -F, '{ print $2 }'`
if [ `grep "$IP " ~/.ssh/known_hosts | wc -l` != "0" ]
then
cecho "!! Warning: An entry exists for the following IP address: $IP"
else
cecho-n " * Adding uml host $HOSTNAME ($IP) to '~/.ssh/known_hosts'.."
echo "$HOSTNAME,$IP `cat $DIR/../hosts/ssh_host_rsa_key.pub`" >> ~/.ssh/known_hosts
cgecho "done"
fi
done
#####################################
# preparing ssh for PK authentication
#
cecho-n " * Checking for ssh rsa key '~/.ssh/id_rsa.pub'.."
if [ -f ~/.ssh/id_rsa.pub ]
then
cecho "already exists"
else
cecho "not found"
cecho-n " * Generating ssh rsa key pair.."
echo "" | ssh-keygen -N "" -t rsa -f ~/.ssh/id_rsa >> $LOGFILE 2>&1
cgecho "done"
fi
+14 -19
View File
@@ -23,8 +23,9 @@ source $DIR/function.sh
source $DIR/../testing.conf source $DIR/../testing.conf
cd $BUILDDIR/root-fs cd $BUILDDIR/root-fs
BASE=$BUILDDIR/base.img
[ -f gentoo-fs ] || die "!! Root file system 'gentoo-fs' not found." [ -f $BASE ] || die "!! Base image $BASE not found."
if [ ! -d $BUILDDIR ] if [ ! -d $BUILDDIR ]
then then
@@ -33,17 +34,6 @@ then
cgecho "done" cgecho "done"
fi fi
LOGFILE=${BUILDDIR}/testing.log
if [ ! -f $LOGFILE ]
then
cecho-n " * Logfile '$LOGFILE' does not exist..creating.."
touch $LOGFILE
cgecho "done"
fi
LOOPDIR=loop
if [ ! -d $LOOPDIR ] if [ ! -d $LOOPDIR ]
then then
mkdir $LOOPDIR mkdir $LOOPDIR
@@ -61,17 +51,22 @@ fi
for host in $HOSTS for host in $HOSTS
do do
cecho-n "$host.." cecho-n "$host.."
cp gentoo-fs gentoo-fs-$host cp $BASE $host.img
mount -o loop gentoo-fs-$host $LOOPDIR mount -o loop $host.img $LOOPDIR
cp -rf $BUILDDIR/hosts/${host}/etc $LOOPDIR cp -rf $BUILDDIR/hosts/${host}/etc $LOOPDIR
if [ "$host" = "winnetou" ] if [ "$host" = "winnetou" ]
then then
mkdir $LOOPDIR/var/log/apache2/ocsp mkdir $LOOPDIR/var/log/apache2/ocsp
cp -rf $UMLTESTDIR/testing/images $LOOPDIR/var/www/localhost/htdocs cp -rf $UMLTESTDIR/testing/images $LOOPDIR/var/www/
chroot $LOOPDIR ln -s /etc/openssl/certs /var/www/localhost/htdocs/certs chroot $LOOPDIR ln -s /etc/openssl/certs /var/www/certs
chroot $LOOPDIR /etc/openssl/generate-crl >> $LOGFILE 2>&1 chroot $LOOPDIR /etc/openssl/generate-crl >> $LOGFILE 2>&1
chroot $LOOPDIR update-rc.d apache2 defaults >> $LOGFILE 2>&1
chroot $LOOPDIR update-rc.d slapd defaults >> $LOGFILE 2>&1
chroot $LOOPDIR rm -rf /var/lib/ldap/*
chroot $LOOPDIR slapadd -l /etc/ldap/ldif.txt -f /etc/ldap/slapd.conf >> $LOGFILE 2>&1
chroot $LOOPDIR chown -R openldap:openldap /var/lib/ldap >> $LOGFILE 2>&1
fi fi
chroot $LOOPDIR /etc/init.d/depscan.sh --update >> $LOGFILE 2>&1 sync
umount $LOOPDIR umount $LOOPDIR
done done
+2 -11
View File
@@ -67,15 +67,6 @@ fi
cecho " * Changing to directory '$BUILDDIR'" cecho " * Changing to directory '$BUILDDIR'"
cd $BUILDDIR cd $BUILDDIR
LOGFILE=${BUILDDIR}/testing.log
if [ ! -f $LOGFILE ]
then
cecho-n " * Logfile '$LOGFILE' does not exist..creating.."
touch $LOGFILE
cgecho "done"
fi
cecho-n " * Unpacking kernel.." cecho-n " * Unpacking kernel.."
tar xjf $KERNEL >> $LOGFILE 2>&1 tar xjf $KERNEL >> $LOGFILE 2>&1
cgecho "done" cgecho "done"
@@ -119,10 +110,10 @@ cp $KERNELCONFIG .config
cecho "!!" cecho "!!"
cecho "!! Making .config for kernel. You might be prompted for new parameters!" cecho "!! Making .config for kernel. You might be prompted for new parameters!"
cecho "!!" cecho "!!"
make oldconfig ARCH=um SUBARCH=i386 2>&1 | tee -a $LOGFILE make oldconfig ARCH=um 2>&1 | tee -a $LOGFILE
cecho-n " * Now compiling uml kernel.." cecho-n " * Now compiling uml kernel.."
make linux ARCH=um SUBARCH=i386 >> $LOGFILE 2>&1 make -j5 linux ARCH=um >> $LOGFILE 2>&1
cgecho "done" cgecho "done"
cecho-n " * Copying uml kernel to '${BUILDDIR}/linux-uml-${KERNELVERSION}'.." cecho-n " * Copying uml kernel to '${BUILDDIR}/linux-uml-${KERNELVERSION}'.."
+49 -51
View File
@@ -34,7 +34,7 @@ else
exit exit
fi fi
cecho-n " * Looking for gentoo root filesystem at '$ROOTFS'.." cecho-n " * Looking for root image at '$ROOTFS'.."
if [ -f "$ROOTFS" ] if [ -f "$ROOTFS" ]
then then
cecho "found it" cecho "found it"
@@ -45,19 +45,6 @@ fi
[ -d $BUILDDIR ] || die "!! Directory '$BUILDDIR' does not exist" [ -d $BUILDDIR ] || die "!! Directory '$BUILDDIR' does not exist"
HOSTCONFIGDIR=$BUILDDIR/hosts
[ -d $HOSTCONFIGDIR ] || die "!! Directory '$HOSTCONFIGDIR' does not exist"
LOGFILE=$BUILDDIR/testing.log
if [ ! -f $LOGFILE ]
then
cecho-n " * Logfile '$LOGFILE' does not exist..creating.."
touch $LOGFILE
cgecho "done"
fi
ROOTFSDIR=$BUILDDIR/root-fs ROOTFSDIR=$BUILDDIR/root-fs
if [ ! -d $ROOTFSDIR ] if [ ! -d $ROOTFSDIR ]
@@ -69,22 +56,18 @@ fi
cd $ROOTFSDIR cd $ROOTFSDIR
LOOPDIR=$ROOTFSDIR/loop
if [ ! -d $LOOPDIR ] if [ ! -d $LOOPDIR ]
then then
mkdir $LOOPDIR mkdir $LOOPDIR
fi fi
###################################################### ######################################################
# creating reiser-based uml root filesystem # mount root image
# #
BASE=$BUILDDIR/base.img
cecho-n " * Building basic root filesystem (gentoo).." cecho-n " * Mounting base image $BASE.."
dd if=/dev/zero of=gentoo-fs count=$ROOTFSSIZE bs=1M >> $LOGFILE 2>&1 cp $ROOTFS $BASE
mkreiserfs -q -f gentoo-fs >> $LOGFILE 2>&1 mount -o loop $BASE $LOOPDIR >> $LOGFILE 2>&1
mount -o loop gentoo-fs $LOOPDIR >> $LOGFILE 2>&1
tar xjpf $ROOTFS -C $LOOPDIR >> $LOGFILE 2>&1
cgecho "done" cgecho "done"
###################################################### ######################################################
@@ -93,12 +76,6 @@ cgecho "done"
cecho " * Removing /etc/resolv.conf" cecho " * Removing /etc/resolv.conf"
rm -f $LOOPDIR/etc/resolv.conf rm -f $LOOPDIR/etc/resolv.conf
######################################################
# copying default /etc/hosts to the root filesystem
#
cecho " * Copying '$HOSTCONFIGDIR/default/etc/hosts' to the root filesystem"
cp -fp $HOSTCONFIGDIR/default/etc/hosts $LOOPDIR/etc/hosts
##################################################### #####################################################
# extracting strongSwan into the root filesystem # extracting strongSwan into the root filesystem
# #
@@ -291,7 +268,7 @@ if [ "$USE_KERNEL_PFKEY" = "yes" ]
then then
echo -n " --enable-kernel-pfkey" >> $INSTALLSHELL echo -n " --enable-kernel-pfkey" >> $INSTALLSHELL
fi fi
if [ "$USE_INTEGRITY_TEST" = "yes" ] if [ "$USE_INTEGRITY_TEST" = "yes" ]
then then
echo -n " --enable-integrity-test" >> $INSTALLSHELL echo -n " --enable-integrity-test" >> $INSTALLSHELL
@@ -408,7 +385,7 @@ then
fi fi
echo "" >> $INSTALLSHELL echo "" >> $INSTALLSHELL
echo "make -j" >> $INSTALLSHELL echo "make -j5" >> $INSTALLSHELL
echo "make install" >> $INSTALLSHELL echo "make install" >> $INSTALLSHELL
echo "ldconfig" >> $INSTALLSHELL echo "ldconfig" >> $INSTALLSHELL
@@ -417,16 +394,50 @@ chroot $LOOPDIR /bin/bash /install.sh >> $LOGFILE 2>&1
rm -f $INSTALLSHELL rm -f $INSTALLSHELL
cgecho "done" cgecho "done"
###################################################### #####################################
# copying default /etc/ipsec.d/tables.sql to the root filesystem # preparing ssh for PK authentication
# #
cecho " * Copying '$HOSTCONFIGDIR/default/etc/ipsec.d/tables.sql' to the root filesystem" if [ ! -d ~/.ssh ]
cp -fp $HOSTCONFIGDIR/default/etc/ipsec.d/tables.sql $LOOPDIR/etc/ipsec.d/tables.sql then
cecho-n " * Creating directory '~/.ssh'.."
mkdir ~/.ssh
cgecho "done"
fi
cecho-n " * Checking for ssh rsa key '~/.ssh/id_rsa.pub'.."
if [ -f ~/.ssh/id_rsa.pub ]
then
cecho "already exists"
else
cecho "not found"
cecho-n " * Generating ssh rsa key pair.."
echo "" | ssh-keygen -N "" -t rsa -f ~/.ssh/id_rsa >> $LOGFILE 2>&1
cgecho "done"
fi
if [ -f ~/.ssh/known_hosts ]
then
cecho-n " * Backing up ~/.ssh/known_hosts to '~/.ssh/known_hosts.before_uml'.."
cp -fp ~/.ssh/known_hosts ~/.ssh/known_hosts.before_uml
cgecho "done"
fi
rm ~/.ssh/known_hosts
cecho-n " * Creating new '~/.ssh/known_hosts'.."
touch ~/.ssh/known_hosts
cgecho "done"
for host in $HOSTNAMEIPV4
do
HOSTNAME=`echo $host | awk -F, '{ print $1 }'`
IP=`echo $host | awk -F, '{ print $2 }'`
cecho-n " * Adding uml host $HOSTNAME ($IP) to '~/.ssh/known_hosts'.."
echo "$HOSTNAME,$IP `cat $LOOPDIR/etc/ssh/ssh_host_rsa_key.pub`" >> ~/.ssh/known_hosts
cgecho "done"
done
###################################################### ######################################################
# copying the host's ssh public key # copying the host's ssh public key
# #
if [ ! -d $LOOPDIR/root/.ssh ] if [ ! -d $LOOPDIR/root/.ssh ]
then then
mkdir $LOOPDIR/root/.ssh mkdir $LOOPDIR/root/.ssh
@@ -441,21 +452,8 @@ cp $LOOPDIR/etc/ssh/ssh_host_rsa_key $LOOPDIR/root/.ssh/id_rsa
for host in $STRONGSWANHOSTS for host in $STRONGSWANHOSTS
do do
eval ip="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F- '{ print $1 }' | awk '{ print $1 }'`" eval ip="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F- '{ print $1 }' | awk '{ print $1 }'`"
echo "$host,$ip `cat $HOSTCONFIGDIR/ssh_host_rsa_key.pub`" >> $LOOPDIR/root/.ssh/known_hosts echo "$host,$ip `cat $LOOPDIR/etc/ssh/ssh_host_rsa_key.pub`" >> $LOOPDIR/root/.ssh/known_hosts
echo "`cat $HOSTCONFIGDIR/ssh_host_rsa_key.pub` root@$host" >> $LOOPDIR/root/.ssh/authorized_keys echo "`cat $LOOPDIR/etc/ssh/ssh_host_rsa_key.pub` root@$host" >> $LOOPDIR/root/.ssh/authorized_keys
done done
######################################################
# defining an empty modules.dep
#
if [ $UMLPATCH ]
then
mkdir $LOOPDIR/lib/modules/`basename $UMLPATCH .bz2 | sed s/uml-patch-//`um
touch $LOOPDIR/lib/modules/`basename $UMLPATCH .bz2 | sed s/uml-patch-//`um/modules.dep
else
mkdir $LOOPDIR/lib/modules/$KERNELVERSION
touch $LOOPDIR/lib/modules/$KERNELVERSION/modules.dep
fi
umount $LOOPDIR umount $LOOPDIR
+1 -16
View File
@@ -55,13 +55,6 @@ function searchandreplace {
[ -d "$DESTDIR" ] || die "$DESTDIR is not a directory!" [ -d "$DESTDIR" ] || die "$DESTDIR is not a directory!"
#########################
# create a temporary file
#
TMPFILE="/tmp/sr.$$"
########################################### ###########################################
# search and replace in each found file the # search and replace in each found file the
# given string # given string
@@ -69,17 +62,9 @@ function searchandreplace {
for eachfoundfile in `find $DESTDIR -type f` for eachfoundfile in `find $DESTDIR -type f`
do do
sed -e "s/$SEARCHSTRING/$REPLACESTRING/g" "$eachfoundfile" > "$TMPFILE" sed -i -e "s/$SEARCHSTRING/$REPLACESTRING/g" "$eachfoundfile"
cp -f "$TMPFILE" "$eachfoundfile"
done done
###########################
# delete the temporary file
#
rm -f "$TMPFILE"
} }
############################################# #############################################
-126
View File
@@ -1,126 +0,0 @@
#!/bin/bash
# starts the UML instances in an gnome-terminal (requires X11R6)
#
# 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"
source $DIR/../testing.conf
if [ "$#" -eq 0 ]
then
HOSTS=$STRONGSWANHOSTS
else
HOSTS=$*
fi
BOOTING_HOSTS=""
count_max=12
count=0
#position of xterm window on the desktop
x0=8
y0=52
dx=12
dy=24
for host in $HOSTS
do
up=0
if [ -d ~/.uml/${host} ]
then
pid=`cat ~/.uml/${host}/pid`
up=`ps up $pid | wc -l`
fi
if [ $up -eq 2 ]
then
cecho " * Great, ${host} is already running!"
else
rm -rf ~/.uml/${host}
BOOTING_HOSTS="$BOOTING_HOSTS ${host}"
let "count_max += 12"
UMLHOSTFS=$BUILDDIR/root-fs/gentoo-fs-${host}
[ -f $UMLHOSTFS ] || die "!! uml root file system '$UMLHOSTFS' not found"
cecho-n " * Starting ${host}.."
eval gnome-terminal --title=${host} --geometry="+${x0}+${y0}" --show-menubar --execute "$UMLKERNEL \
umid=${host} \
ubda=$UMLHOSTFS \
\$SWITCH_${host} \
mem=${MEM}M con=pty con0=fd:0,fd:1" &
cgecho "done"
sleep 15
fi
let "x0+=dx"
let "y0+=dy"
done
if [ -z "$BOOTING_HOSTS" ]
then
exit 0
fi
cecho " * Waiting for the uml instances to finish booting"
for host in $BOOTING_HOSTS
do
cecho-n " * Checking on $host.."
while [ $count -lt $count_max ] && [ ! -d ~/.uml/$host ]
do
cecho-n "."
sleep 5
let "count+=1"
done
if [ $count -ge $count_max ]
then
cecho "exit"
exit 1
fi
up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l`
while [ $count -lt $count_max ] && [ $up -eq 0 ]
do
cecho-n "."
sleep 5
up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l`
let "count+=1"
done
if [ $count -ge $count_max ]
then
cecho "exit"
exit 1
else
cgecho "up"
fi
if [ "$host" = "alice" ]
then
sleep 5
eval ipv4_${host}="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
ssh root@$ipv4_alice /etc/init.d/net.eth1 stop
fi
done
cecho " * All uml instances are up now"
-126
View File
@@ -1,126 +0,0 @@
#!/bin/bash
# starts the UML instances in a konsole (requires KDE)
#
# 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"
source $DIR/../testing.conf
if [ "$#" -eq 0 ]
then
HOSTS=$STRONGSWANHOSTS
else
HOSTS=$*
fi
BOOTING_HOSTS=""
count_max=12
count=0
#position of konsole window on the desktop
x0=8
y0=8
dx=12
dy=24
for host in $HOSTS
do
up=0
if [ -d ~/.uml/${host} ]
then
pid=`cat ~/.uml/${host}/pid`
up=`ps up $pid | wc -l`
fi
if [ $up -eq 2 ]
then
cecho " * Great, ${host} is already running!"
else
rm -rf ~/.uml/${host}
BOOTING_HOSTS="$BOOTING_HOSTS ${host}"
let "count_max += 12"
UMLHOSTFS=$BUILDDIR/root-fs/gentoo-fs-${host}
[ -f $UMLHOSTFS ] || die "!! uml root file system '$UMLHOSTFS' not found"
cecho-n " * Starting ${host}.."
eval konsole -title ${host} --geometry "+${x0}+${y0}" -e "$UMLKERNEL \
umid=${host} \
ubda=$UMLHOSTFS \
\$SWITCH_${host} \
mem=${MEM}M con=pty con0=fd:0,fd:1" &
cgecho "done"
sleep 15
fi
let "x0+=dx"
let "y0+=dy"
done
if [ -z "$BOOTING_HOSTS" ]
then
exit 0
fi
cecho " * Waiting for the uml instances to finish booting"
for host in $BOOTING_HOSTS
do
cecho-n " * Checking on $host.."
while [ $count -lt $count_max ] && [ ! -d ~/.uml/$host ]
do
cecho-n "."
sleep 5
let "count+=1"
done
if [ $count -ge $count_max ]
then
cecho "exit"
exit 1
fi
up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l`
while [ $count -lt $count_max ] && [ $up -eq 0 ]
do
cecho-n "."
sleep 5
up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l`
let "count+=1"
done
if [ $count -ge $count_max ]
then
cecho "exit"
exit 1
else
cgecho "up"
fi
if [ "$host" = "alice" ]
then
sleep 5
eval ipv4_${host}="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
ssh root@$ipv4_alice /etc/init.d/net.eth1 stop
fi
done
cecho " * All uml instances are up now"
+3 -4
View File
@@ -58,17 +58,16 @@ for host in $IPSECHOSTS
do do
eval HOSTLOGIN="root@`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" eval HOSTLOGIN="root@`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
ssh $SSHCONF $HOSTLOGIN 'rm -f /var/log/auth.log /var/log/daemon.log; \ ssh $SSHCONF $HOSTLOGIN 'rm -f /var/log/auth.log /var/log/daemon.log; \
kill -SIGHUP `cat /var/run/syslogd.pid`' > /dev/null 2>&1 kill -SIGHUP `cat /var/run/rsyslogd.pid`' > /dev/null 2>&1
done done
########################################################################## ##########################################################################
# clear radius.log and daemon.log on FreeRadius servers # clear radius.log on FreeRadius servers
# #
for host in $RADIUSHOSTS for host in $RADIUSHOSTS
do do
eval HOSTLOGIN="root@`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" eval HOSTLOGIN="root@`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
ssh $SSHCONF $HOSTLOGIN 'rm -f /var/log/radius/radius.log /var/log/daemon.log; \ ssh $SSHCONF $HOSTLOGIN 'rm -f /var/log/freeradius/radius.log' > /dev/null 2>&1
kill -SIGHUP `cat /var/run/syslogd.pid`' > /dev/null 2>&1
done done
+4 -14
View File
@@ -42,7 +42,7 @@ do
pid=`cat ~/.uml/${host}/pid` pid=`cat ~/.uml/${host}/pid`
up=`ps up $pid | wc -l` up=`ps up $pid | wc -l`
fi fi
if [ $up -eq 2 ] if [ $up -eq 2 ]
then then
cecho " * Great, ${host} is already running!" cecho " * Great, ${host} is already running!"
@@ -51,16 +51,12 @@ do
BOOTING_HOSTS="$BOOTING_HOSTS ${host}" BOOTING_HOSTS="$BOOTING_HOSTS ${host}"
let "count_max += 12" let "count_max += 12"
UMLHOSTFS=$BUILDDIR/root-fs/gentoo-fs-${host} UMLHOSTFS=$BUILDDIR/root-fs/${host}.img
[ -f $UMLHOSTFS ] || die "!! uml root file system '$UMLHOSTFS' not found" [ -f $UMLHOSTFS ] || die "!! uml root file system '$UMLHOSTFS' not found"
cecho-n " * Starting ${host}.." cecho-n " * Starting ${host}.."
eval screen -dmS ${host} "$UMLKERNEL \ eval setsid $UMLKERNEL umid=${host} ubda=$UMLHOSTFS \$SWITCH_${host} mem=${MEM}M con=null con1=xterm >>$LOGFILE 2>&1 &
umid=${host} \ cgecho "done"
ubda=$UMLHOSTFS \
\$SWITCH_${host} \
mem=${MEM}M con=pty con0=fd:0,fd:1"
cgecho "done"
fi fi
done done
@@ -106,12 +102,6 @@ do
cgecho "up" cgecho "up"
fi fi
if [ "$host" = "alice" ]
then
sleep 5
eval ipv4_${host}="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
ssh root@$ipv4_alice /etc/init.d/net.eth1 stop
fi
done done
cecho " * All uml instances are up now" cecho " * All uml instances are up now"
-126
View File
@@ -1,126 +0,0 @@
#!/bin/bash
# starts the UML instances in an xterm (requires X11R6)
#
# 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"
source $DIR/../testing.conf
if [ "$#" -eq 0 ]
then
HOSTS=$STRONGSWANHOSTS
else
HOSTS=$*
fi
BOOTING_HOSTS=""
count_max=12
count=0
#position of xterm window on the desktop
x0=8
y0=8
dx=12
dy=24
for host in $HOSTS
do
up=0
if [ -d ~/.uml/${host} ]
then
pid=`cat ~/.uml/${host}/pid`
up=`ps up $pid | wc -l`
fi
if [ $up -eq 2 ]
then
cecho " * Great, ${host} is already running!"
else
rm -rf ~/.uml/${host}
BOOTING_HOSTS="$BOOTING_HOSTS ${host}"
let "count_max += 12"
UMLHOSTFS=$BUILDDIR/root-fs/gentoo-fs-${host}
[ -f $UMLHOSTFS ] || die "!! uml root file system '$UMLHOSTFS' not found"
cecho-n " * Starting ${host}.."
eval xterm -title ${host} -geometry "+${x0}+${y0}" -rightbar -sb -sl 500 -e "$UMLKERNEL \
umid=${host} \
ubda=$UMLHOSTFS \
\$SWITCH_${host} \
mem=${MEM}M con=pty con0=fd:0,fd:1" &
cgecho "done"
sleep 15
fi
let "x0+=dx"
let "y0+=dy"
done
if [ -z "$BOOTING_HOSTS" ]
then
exit 0
fi
cecho " * Waiting for the uml instances to finish booting"
for host in $BOOTING_HOSTS
do
cecho-n " * Checking on $host.."
while [ $count -lt $count_max ] && [ ! -d ~/.uml/$host ]
do
cecho-n "."
sleep 5
let "count+=1"
done
if [ $count -ge $count_max ]
then
cecho "exit"
exit 1
fi
up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l`
while [ $count -lt $count_max ] && [ $up -eq 0 ]
do
cecho-n "."
sleep 5
up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l`
let "count+=1"
done
if [ $count -ge $count_max ]
then
cecho "exit"
exit 1
else
cgecho "up"
fi
if [ "$host" = "alice" ]
then
sleep 5
eval ipv4_${host}="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
ssh root@$ipv4_alice /etc/init.d/net.eth1 stop
fi
done
cecho " * All uml instances are up now"
+2 -21
View File
@@ -40,27 +40,8 @@ $DIR/scripts/start-bridges
##################################################### #####################################################
# start the uml instances # start the uml instances
# #
case $UMLSTARTMODE in cecho "Start the uml instances (scripts/start-umls)"
konsole) $DIR/scripts/start-umls $HOSTS
cecho "Start the uml instances (scripts/kstart-umls)"
$DIR/scripts/kstart-umls $HOSTS
;;
gnome-terminal)
cecho "Start the uml instances (scripts/gstart-umls)"
$DIR/scripts/gstart-umls $HOSTS
;;
xterm)
cecho "Start the uml instances (scripts/xstart-umls)"
$DIR/scripts/xstart-umls $HOSTS
;;
screen)
cecho "Start the uml instances (scripts/start-umls)"
$DIR/scripts/start-umls $HOSTS
;;
*)
die "The start mode is unknown! Please set $UMLSTARTMODE properly."
;;
esac
##################################################### #####################################################
+16 -22
View File
@@ -27,7 +27,6 @@ KERNELVERSION=`basename $KERNEL .tar.bz2 | sed -e 's/linux-//'`
# Kernel configuration file # Kernel configuration file
KERNELCONFIG=$UMLTESTDIR/.config-3.5 KERNELCONFIG=$UMLTESTDIR/.config-3.5
# Bzipped uml patch for kernel # Bzipped uml patch for kernel
UMLPATCH=$UMLTESTDIR/ha-3.0.patch.bz2 UMLPATCH=$UMLTESTDIR/ha-3.0.patch.bz2
@@ -91,12 +90,6 @@ USE_IFMAP="no"
USE_CISCO_QUIRKS="no" USE_CISCO_QUIRKS="no"
USE_UNITY="yes" USE_UNITY="yes"
# Gentoo linux root filesystem
ROOTFS=$UMLTESTDIR/gentoo-fs-20111212.tar.bz2
# Size of the finished root filesystem in MB
ROOTFSSIZE=850
# Amount of Memory to use per UML [MB]. # Amount of Memory to use per UML [MB].
# If "auto" is stated 1/12 of total host ram will be used. # If "auto" is stated 1/12 of total host ram will be used.
# Examples: MEM=64, MEM="128", MEM="auto" # Examples: MEM=64, MEM="128", MEM="auto"
@@ -105,6 +98,20 @@ MEM=96
# Directory where the UML kernels and file system will be built # Directory where the UML kernels and file system will be built
BUILDDIR=$UMLTESTDIR/umlbuild BUILDDIR=$UMLTESTDIR/umlbuild
# Logfile
LOGFILE=$BUILDDIR/testing.log
# Directory used for loop-mounts
LOOPDIR=$BUILDDIR/loop
# Base image settings
ROOTFSSIZE=950
ROOTFSSUITE=wheezy
ROOTFSARCH=amd64
ROOTFS=$BUILDDIR/debian-$ROOTFSSUITE-$ROOTFSARCH.img
ROOTFSMIRROR=http://cdn.debian.net/debian
ROOTFSPW=root
# Filename of the built UML Kernel # Filename of the built UML Kernel
UMLKERNEL=$BUILDDIR/linux-uml-$KERNELVERSION UMLKERNEL=$BUILDDIR/linux-uml-$KERNELVERSION
@@ -126,28 +133,15 @@ TZUML="Europe/Zurich"
# Enable particular steps in the make-testing and # Enable particular steps in the make-testing and
# start-testing scripts # start-testing scripts
# #
ENABLE_BUILD_BASEIMAGE="yes"
ENABLE_BUILD_UMLKERNEL="yes" ENABLE_BUILD_UMLKERNEL="yes"
ENABLE_BUILD_SSHKEYS="yes"
ENABLE_BUILD_HOSTCONFIG="yes"
ENABLE_BUILD_UMLROOTFS="yes" ENABLE_BUILD_UMLROOTFS="yes"
ENABLE_BUILD_HOSTCONFIG="yes"
ENABLE_BUILD_UMLHOSTFS="yes" ENABLE_BUILD_UMLHOSTFS="yes"
ENABLE_START_TESTING="yes" ENABLE_START_TESTING="yes"
ENABLE_DO_TESTS="no" ENABLE_DO_TESTS="no"
ENABLE_STOP_TESTING="no" ENABLE_STOP_TESTING="no"
##############################################################
# How to start the UMLs?
#
# Start the UML instance in KDE konsole (requires KDE)
# UMLSTARTMODE="konsole"
# Start the UML instance in a gnome-terminal (requires gnome)
UMLSTARTMODE="gnome-terminal"
# Start the UML instance in an xterm (requires X11R6)
# UMLSTARTMODE="xterm"
# Start the UML instance without a terminal window
# but screen -r <host> can open a window anytime
# UMLSTARTMODE="screen"
############################################################## ##############################################################
# If set to "yes" only the tests stated at $SELECTEDTESTS # If set to "yes" only the tests stated at $SELECTEDTESTS
# will be executed. (use "yes" or "no") # will be executed. (use "yes" or "no")