Import testing.conf file in function.sh

This is needed to have access to $LOGFILE and possibly other config
settings.
This commit is contained in:
Reto Buerki 2012-12-06 19:03:45 +01:00 committed by Tobias Brunner
parent 261cf0e395
commit 7c2ef58e86
10 changed files with 26 additions and 72 deletions

View File

@ -2,15 +2,10 @@
echo "Building base image"
DIR=`dirname $0`
. $DIR/function.sh
. $PWD/scripts/function.sh
[ `id -u` -eq 0 ] || die "You must be root to run $0"
[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found"
. $DIR/../testing.conf
# 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,cmake,libxerces-c2-dev,libltdl-dev,liblog4cxx10-dev,libboost-thread-dev,libboost-system-dev,git-core
SERVICES="isc-dhcp-server apache2 slapd"

View File

@ -16,18 +16,13 @@
echo "Creating guest images"
DIR=`dirname $0`
. $DIR/function.sh
. $PWD/scripts/function.sh
[ `id -u` -eq 0 ] || die "You must be root to run $0"
[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found"
. $DIR/../testing.conf
BASE=$BUILDDIR/base.img
ROOTFSDIR=$BUILDDIR/root-fs
HOSTSDIR=$DIR/../hosts
HOSTSDIR=$PWD/hosts
[ -f $BASE ] || die "Base image $BASE not found"
[ -f $HOSTDIR ] || die "Hosts directory $HOSTSDIR not found"

View File

@ -14,12 +14,7 @@
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
DIR=`dirname $0`
. $DIR/function.sh
[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found"
. $DIR/../testing.conf
. $PWD/scripts/function.sh
echo "Building guest kernel version $KERNELVERSION"

View File

@ -16,15 +16,10 @@
echo "Building root image"
DIR=`dirname $0`
. $DIR/function.sh
. $PWD/scripts/function.sh
[ `id -u` -eq 0 ] || die "You must be root to run $0"
[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found"
. $DIR/../testing.conf
[ -f "$ROOTFS" ] || die "Root image $ROOTFS not found"
ROOTFSDIR=$BUILDDIR/root-fs

View File

@ -14,6 +14,21 @@
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
export TERM=xterm
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
NORMAL=$(tput op)
# exit with given error message
# $1 - error message
die() {
echo -e "${RED}$1${NORMAL}"
exit 1
}
[ -f testing.conf ] || die "Configuration file 'testing.conf' not found"
. testing.conf
# execute command
# $1 - command to execute
# $2 - whether or not to log command exit status
@ -40,11 +55,6 @@ execute_chroot()
execute "chroot $LOOPDIR $@"
}
export TERM=xterm
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
NORMAL=$(tput op)
function cecho {
echo -e "\033[1;31m$1\033[0m"
}
@ -76,13 +86,6 @@ log_status()
echo
}
# exit with given error message
# $1 - error message
die() {
echo -e "${RED}$1${NORMAL}"
exit 1
}
#############################################
# search and replace strings throughout a
# whole directory

View File

@ -17,13 +17,7 @@
# 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
. $PWD/scripts/function.sh
cecho "installing strongSwan from shared tree"
cecho-n " on: "

View File

@ -14,13 +14,7 @@
# 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
. $PWD/scripts/function.sh
##########################################################################
# load-testconfig requires a testname as an argument

View File

@ -14,12 +14,7 @@
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
DIR=`dirname $0`
. $DIR/function.sh
[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found"
. $DIR/../testing.conf
. $PWD/scripts/function.sh
##########################################################################
# load-testconfig requires a testname as an argument
@ -27,7 +22,7 @@ DIR=`dirname $0`
testname=$1
HOSTCONFIGDIR=$DIR/../hosts
HOSTCONFIGDIR=$PWD/hosts
TESTSDIR=$BUILDDIR/tests
[ -d $TESTSDIR ] || die "Directory '$TESTSDIR' not found"

View File

@ -17,13 +17,7 @@
# 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
. $PWD/scripts/function.sh
cecho "shutting down"
cecho-n " "

View File

@ -14,13 +14,7 @@
# 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
. $PWD/scripts/function.sh
if [ "$#" -eq 0 ]
then