check for existence of the node-config file
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 8 Apr 2009 15:20:27 +0000 (15:20 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 8 Apr 2009 15:20:27 +0000 (15:20 +0000)
also make the command robust to relative paths, as we change dir over time and thus need abs. paths

build.sh

index cfce5e2..0d7dff1 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -174,6 +174,18 @@ function parse_command_line () {
     [ -z "$VARIANT" ] && VARIANT="build"
     [ "$CONSOLE_INFO" == "default" ] && CONSOLE_INFO=$SERIAL_CONSOLE
 
+    if [ -n "$NODE_CONFIGURATION_FILE" ] ; then
+    # check existence of NODE_CONFIGURATION_FILE and normalize as we will change directory
+       if [ ! -f "$NODE_CONFIGURATION_FILE" ] ; then
+           echo "Node configuration file $NODE_CONFIGURATION_FILE not found - exiting"
+           exit 1
+       fi
+       cf_dir="$(dirname $NODE_CONFIGURATION_FILE)"
+       cf_dir="$(cd $cf_dir; pwd -P)"
+       cf_file="$(basename $NODE_CONFIGURATION_FILE)"
+       NODE_CONFIGURATION_FILE="$cf_dir"/"$cf_file"
+    fi
+
     # check TYPES 
     local matcher="XXX$(echo $ALL_TYPES | sed -e 's,\W,XXX,g')XXX"
     for t in $TYPES; do