]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Import testing.conf file in function.sh
authorReto Buerki <reet@codelabs.ch>
Thu, 6 Dec 2012 18:03:45 +0000 (19:03 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 17 Jan 2013 14:22:10 +0000 (15:22 +0100)
This is needed to have access to $LOGFILE and possibly other config
settings.

testing/scripts/build-baseimage
testing/scripts/build-umlhostfs
testing/scripts/build-umlkernel
testing/scripts/build-umlrootfs
testing/scripts/function.sh
testing/scripts/install-shared
testing/scripts/load-testconfig
testing/scripts/restore-defaults
testing/scripts/shutdown-umls
testing/scripts/start-umls

index 08da30f08352ef76317471c3f3fd64a12a1b9313..4b81c5cdbc50b596da48371c69296b76054f9884 100755 (executable)
@@ -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"
index ada9696c7672cfe6ae1f6164a7a6e514d5108609..e5355988cd7db2e14a8afbe42d2be491f7253cfc 100755 (executable)
 
 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"
index 3947e4ab1a211f8858cff948e29465a2620f7c73..6e17af430dce328589f2190033cdcf06452b9ade 100755 (executable)
 # 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"
 
index a0444de38508d2d96943db681c26fc1f153483ec..6c67a25342d76bfa2030b10e4fae243335bca29f 100755 (executable)
 
 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
index a04490aeccc61380acdb2037e11a6d119c5d3d03..3e0560a46c1da689f226085ea6da9abfa5a149cf 100755 (executable)
 # 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
index 4cfac9e77effbff8384050fa0accda6715cb8625..0f961aef94f72563878b4834dd91525c3291e07c 100755 (executable)
 # 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: "
index d73b3127539031a0724e08953df30b9c5deb067c..1abe5985c470ca3f048aac82abd482528b6a18a3 100755 (executable)
 # 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
index 6bad3c5f0b383c9a932d4ea8081f0e3b8be532c8..16714db26340341bf9b2622dfd69b37c7305a225 100755 (executable)
 # 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"
index e71e4660253e916a28ef2c1e7a0e43e93acbd557..9d37ab1d83a9b19ea8f82e63a67658a6b265a2cf 100755 (executable)
 # 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 "  "
index 470bdc61b5200e769e67c5dedeeaf9ad6df18924..f9578d751f4ad3b54153f0230ef6947725a14eb8 100755 (executable)
 # 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