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:
committed by
Tobias Brunner
parent
0080daa787
commit
aa5803e0e3
Executable
+66
@@ -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"
|
||||
@@ -41,9 +41,19 @@ then
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
@@ -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
|
||||
@@ -23,8 +23,9 @@ source $DIR/function.sh
|
||||
source $DIR/../testing.conf
|
||||
|
||||
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 ]
|
||||
then
|
||||
@@ -33,17 +34,6 @@ then
|
||||
cgecho "done"
|
||||
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 ]
|
||||
then
|
||||
mkdir $LOOPDIR
|
||||
@@ -61,17 +51,22 @@ fi
|
||||
for host in $HOSTS
|
||||
do
|
||||
cecho-n "$host.."
|
||||
cp gentoo-fs gentoo-fs-$host
|
||||
mount -o loop gentoo-fs-$host $LOOPDIR
|
||||
cp $BASE $host.img
|
||||
mount -o loop $host.img $LOOPDIR
|
||||
cp -rf $BUILDDIR/hosts/${host}/etc $LOOPDIR
|
||||
if [ "$host" = "winnetou" ]
|
||||
then
|
||||
mkdir $LOOPDIR/var/log/apache2/ocsp
|
||||
cp -rf $UMLTESTDIR/testing/images $LOOPDIR/var/www/localhost/htdocs
|
||||
chroot $LOOPDIR ln -s /etc/openssl/certs /var/www/localhost/htdocs/certs
|
||||
chroot $LOOPDIR /etc/openssl/generate-crl >> $LOGFILE 2>&1
|
||||
mkdir $LOOPDIR/var/log/apache2/ocsp
|
||||
cp -rf $UMLTESTDIR/testing/images $LOOPDIR/var/www/
|
||||
chroot $LOOPDIR ln -s /etc/openssl/certs /var/www/certs
|
||||
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
|
||||
chroot $LOOPDIR /etc/init.d/depscan.sh --update >> $LOGFILE 2>&1
|
||||
sync
|
||||
umount $LOOPDIR
|
||||
done
|
||||
|
||||
|
||||
@@ -67,15 +67,6 @@ fi
|
||||
cecho " * Changing to directory '$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.."
|
||||
tar xjf $KERNEL >> $LOGFILE 2>&1
|
||||
cgecho "done"
|
||||
@@ -119,10 +110,10 @@ cp $KERNELCONFIG .config
|
||||
cecho "!!"
|
||||
cecho "!! Making .config for kernel. You might be prompted for new parameters!"
|
||||
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.."
|
||||
make linux ARCH=um SUBARCH=i386 >> $LOGFILE 2>&1
|
||||
make -j5 linux ARCH=um >> $LOGFILE 2>&1
|
||||
cgecho "done"
|
||||
|
||||
cecho-n " * Copying uml kernel to '${BUILDDIR}/linux-uml-${KERNELVERSION}'.."
|
||||
|
||||
@@ -34,7 +34,7 @@ else
|
||||
exit
|
||||
fi
|
||||
|
||||
cecho-n " * Looking for gentoo root filesystem at '$ROOTFS'.."
|
||||
cecho-n " * Looking for root image at '$ROOTFS'.."
|
||||
if [ -f "$ROOTFS" ]
|
||||
then
|
||||
cecho "found it"
|
||||
@@ -45,19 +45,6 @@ fi
|
||||
|
||||
[ -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
|
||||
|
||||
if [ ! -d $ROOTFSDIR ]
|
||||
@@ -69,22 +56,18 @@ fi
|
||||
|
||||
cd $ROOTFSDIR
|
||||
|
||||
LOOPDIR=$ROOTFSDIR/loop
|
||||
|
||||
if [ ! -d $LOOPDIR ]
|
||||
then
|
||||
mkdir $LOOPDIR
|
||||
fi
|
||||
|
||||
######################################################
|
||||
# creating reiser-based uml root filesystem
|
||||
# mount root image
|
||||
#
|
||||
|
||||
cecho-n " * Building basic root filesystem (gentoo).."
|
||||
dd if=/dev/zero of=gentoo-fs count=$ROOTFSSIZE bs=1M >> $LOGFILE 2>&1
|
||||
mkreiserfs -q -f gentoo-fs >> $LOGFILE 2>&1
|
||||
mount -o loop gentoo-fs $LOOPDIR >> $LOGFILE 2>&1
|
||||
tar xjpf $ROOTFS -C $LOOPDIR >> $LOGFILE 2>&1
|
||||
BASE=$BUILDDIR/base.img
|
||||
cecho-n " * Mounting base image $BASE.."
|
||||
cp $ROOTFS $BASE
|
||||
mount -o loop $BASE $LOOPDIR >> $LOGFILE 2>&1
|
||||
cgecho "done"
|
||||
|
||||
######################################################
|
||||
@@ -93,12 +76,6 @@ cgecho "done"
|
||||
cecho " * Removing /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
|
||||
#
|
||||
@@ -291,7 +268,7 @@ if [ "$USE_KERNEL_PFKEY" = "yes" ]
|
||||
then
|
||||
echo -n " --enable-kernel-pfkey" >> $INSTALLSHELL
|
||||
fi
|
||||
|
||||
|
||||
if [ "$USE_INTEGRITY_TEST" = "yes" ]
|
||||
then
|
||||
echo -n " --enable-integrity-test" >> $INSTALLSHELL
|
||||
@@ -408,7 +385,7 @@ then
|
||||
fi
|
||||
|
||||
echo "" >> $INSTALLSHELL
|
||||
echo "make -j" >> $INSTALLSHELL
|
||||
echo "make -j5" >> $INSTALLSHELL
|
||||
echo "make install" >> $INSTALLSHELL
|
||||
echo "ldconfig" >> $INSTALLSHELL
|
||||
|
||||
@@ -417,16 +394,50 @@ chroot $LOOPDIR /bin/bash /install.sh >> $LOGFILE 2>&1
|
||||
rm -f $INSTALLSHELL
|
||||
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"
|
||||
cp -fp $HOSTCONFIGDIR/default/etc/ipsec.d/tables.sql $LOOPDIR/etc/ipsec.d/tables.sql
|
||||
if [ ! -d ~/.ssh ]
|
||||
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
|
||||
#
|
||||
|
||||
if [ ! -d $LOOPDIR/root/.ssh ]
|
||||
then
|
||||
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
|
||||
do
|
||||
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 "`cat $HOSTCONFIGDIR/ssh_host_rsa_key.pub` root@$host" >> $LOOPDIR/root/.ssh/authorized_keys
|
||||
echo "$host,$ip `cat $LOOPDIR/etc/ssh/ssh_host_rsa_key.pub`" >> $LOOPDIR/root/.ssh/known_hosts
|
||||
echo "`cat $LOOPDIR/etc/ssh/ssh_host_rsa_key.pub` root@$host" >> $LOOPDIR/root/.ssh/authorized_keys
|
||||
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
|
||||
|
||||
@@ -55,13 +55,6 @@ function searchandreplace {
|
||||
[ -d "$DESTDIR" ] || die "$DESTDIR is not a directory!"
|
||||
|
||||
|
||||
#########################
|
||||
# create a temporary file
|
||||
#
|
||||
|
||||
TMPFILE="/tmp/sr.$$"
|
||||
|
||||
|
||||
###########################################
|
||||
# search and replace in each found file the
|
||||
# given string
|
||||
@@ -69,17 +62,9 @@ function searchandreplace {
|
||||
|
||||
for eachfoundfile in `find $DESTDIR -type f`
|
||||
do
|
||||
sed -e "s/$SEARCHSTRING/$REPLACESTRING/g" "$eachfoundfile" > "$TMPFILE"
|
||||
cp -f "$TMPFILE" "$eachfoundfile"
|
||||
sed -i -e "s/$SEARCHSTRING/$REPLACESTRING/g" "$eachfoundfile"
|
||||
done
|
||||
|
||||
|
||||
###########################
|
||||
# delete the temporary file
|
||||
#
|
||||
|
||||
rm -f "$TMPFILE"
|
||||
|
||||
}
|
||||
|
||||
#############################################
|
||||
|
||||
@@ -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"
|
||||
@@ -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"
|
||||
@@ -58,17 +58,16 @@ for host in $IPSECHOSTS
|
||||
do
|
||||
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; \
|
||||
kill -SIGHUP `cat /var/run/syslogd.pid`' > /dev/null 2>&1
|
||||
kill -SIGHUP `cat /var/run/rsyslogd.pid`' > /dev/null 2>&1
|
||||
done
|
||||
|
||||
|
||||
##########################################################################
|
||||
# clear radius.log and daemon.log on FreeRadius servers
|
||||
# clear radius.log on FreeRadius servers
|
||||
#
|
||||
|
||||
for host in $RADIUSHOSTS
|
||||
do
|
||||
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; \
|
||||
kill -SIGHUP `cat /var/run/syslogd.pid`' > /dev/null 2>&1
|
||||
ssh $SSHCONF $HOSTLOGIN 'rm -f /var/log/freeradius/radius.log' > /dev/null 2>&1
|
||||
done
|
||||
|
||||
@@ -42,7 +42,7 @@ do
|
||||
pid=`cat ~/.uml/${host}/pid`
|
||||
up=`ps up $pid | wc -l`
|
||||
fi
|
||||
|
||||
|
||||
if [ $up -eq 2 ]
|
||||
then
|
||||
cecho " * Great, ${host} is already running!"
|
||||
@@ -51,16 +51,12 @@ do
|
||||
BOOTING_HOSTS="$BOOTING_HOSTS ${host}"
|
||||
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"
|
||||
|
||||
cecho-n " * Starting ${host}.."
|
||||
eval screen -dmS ${host} "$UMLKERNEL \
|
||||
umid=${host} \
|
||||
ubda=$UMLHOSTFS \
|
||||
\$SWITCH_${host} \
|
||||
mem=${MEM}M con=pty con0=fd:0,fd:1"
|
||||
cgecho "done"
|
||||
eval setsid $UMLKERNEL umid=${host} ubda=$UMLHOSTFS \$SWITCH_${host} mem=${MEM}M con=null con1=xterm >>$LOGFILE 2>&1 &
|
||||
cgecho "done"
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -106,12 +102,6 @@ do
|
||||
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"
|
||||
|
||||
@@ -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"
|
||||
Reference in New Issue
Block a user