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
2013-01-17 15:22:10 +01:00
committed by Tobias Brunner
parent 261cf0e395
commit 7c2ef58e86
10 changed files with 26 additions and 72 deletions
+1 -6
View File
@@ -2,15 +2,10 @@
echo "Building base image" echo "Building base image"
DIR=`dirname $0` . $PWD/scripts/function.sh
. $DIR/function.sh
[ `id -u` -eq 0 ] || die "You must be root to run $0" [ `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 # 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 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" SERVICES="isc-dhcp-server apache2 slapd"
+2 -7
View File
@@ -16,18 +16,13 @@
echo "Creating guest images" echo "Creating guest images"
DIR=`dirname $0` . $PWD/scripts/function.sh
. $DIR/function.sh
[ `id -u` -eq 0 ] || die "You must be root to run $0" [ `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 BASE=$BUILDDIR/base.img
ROOTFSDIR=$BUILDDIR/root-fs ROOTFSDIR=$BUILDDIR/root-fs
HOSTSDIR=$DIR/../hosts HOSTSDIR=$PWD/hosts
[ -f $BASE ] || die "Base image $BASE not found" [ -f $BASE ] || die "Base image $BASE not found"
[ -f $HOSTDIR ] || die "Hosts directory $HOSTSDIR not found" [ -f $HOSTDIR ] || die "Hosts directory $HOSTSDIR not found"
+1 -6
View File
@@ -14,12 +14,7 @@
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details. # for more details.
DIR=`dirname $0` . $PWD/scripts/function.sh
. $DIR/function.sh
[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found"
. $DIR/../testing.conf
echo "Building guest kernel version $KERNELVERSION" echo "Building guest kernel version $KERNELVERSION"
+1 -6
View File
@@ -16,15 +16,10 @@
echo "Building root image" echo "Building root image"
DIR=`dirname $0` . $PWD/scripts/function.sh
. $DIR/function.sh
[ `id -u` -eq 0 ] || die "You must be root to run $0" [ `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" [ -f "$ROOTFS" ] || die "Root image $ROOTFS not found"
ROOTFSDIR=$BUILDDIR/root-fs ROOTFSDIR=$BUILDDIR/root-fs
+15 -12
View File
@@ -14,6 +14,21 @@
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details. # 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 # execute command
# $1 - command to execute # $1 - command to execute
# $2 - whether or not to log command exit status # $2 - whether or not to log command exit status
@@ -40,11 +55,6 @@ execute_chroot()
execute "chroot $LOOPDIR $@" execute "chroot $LOOPDIR $@"
} }
export TERM=xterm
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
NORMAL=$(tput op)
function cecho { function cecho {
echo -e "\033[1;31m$1\033[0m" echo -e "\033[1;31m$1\033[0m"
} }
@@ -76,13 +86,6 @@ log_status()
echo echo
} }
# exit with given error message
# $1 - error message
die() {
echo -e "${RED}$1${NORMAL}"
exit 1
}
############################################# #############################################
# search and replace strings throughout a # search and replace strings throughout a
# whole directory # whole directory
+1 -7
View File
@@ -17,13 +17,7 @@
# for more details. # for more details.
# #
DIR=`dirname $0` . $PWD/scripts/function.sh
source $DIR/function.sh
[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found"
source $DIR/../testing.conf
cecho "installing strongSwan from shared tree" cecho "installing strongSwan from shared tree"
cecho-n " on: " cecho-n " on: "
+1 -7
View File
@@ -14,13 +14,7 @@
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details. # for more details.
DIR=`dirname $0` . $PWD/scripts/function.sh
source $DIR/function.sh
[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found"
source $DIR/../testing.conf
########################################################################## ##########################################################################
# load-testconfig requires a testname as an argument # load-testconfig requires a testname as an argument
+2 -7
View File
@@ -14,12 +14,7 @@
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details. # for more details.
DIR=`dirname $0` . $PWD/scripts/function.sh
. $DIR/function.sh
[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found"
. $DIR/../testing.conf
########################################################################## ##########################################################################
# load-testconfig requires a testname as an argument # load-testconfig requires a testname as an argument
@@ -27,7 +22,7 @@ DIR=`dirname $0`
testname=$1 testname=$1
HOSTCONFIGDIR=$DIR/../hosts HOSTCONFIGDIR=$PWD/hosts
TESTSDIR=$BUILDDIR/tests TESTSDIR=$BUILDDIR/tests
[ -d $TESTSDIR ] || die "Directory '$TESTSDIR' not found" [ -d $TESTSDIR ] || die "Directory '$TESTSDIR' not found"
+1 -7
View File
@@ -17,13 +17,7 @@
# for more details. # for more details.
# #
DIR=`dirname $0` . $PWD/scripts/function.sh
source $DIR/function.sh
[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found"
source $DIR/../testing.conf
cecho "shutting down" cecho "shutting down"
cecho-n " " cecho-n " "
+1 -7
View File
@@ -14,13 +14,7 @@
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details. # for more details.
DIR=`dirname $0` . $PWD/scripts/function.sh
source $DIR/function.sh
[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found"
source $DIR/../testing.conf
if [ "$#" -eq 0 ] if [ "$#" -eq 0 ]
then then