Skip to content
Snippets Groups Projects
Commit 8798fb06 authored by Karl-Hermann Wieners's avatar Karl-Hermann Wieners
Browse files

Import: model/build dirs for external scripts

parent 8cb43763
No related branches found
No related tags found
No related merge requests found
......@@ -78,7 +78,7 @@ do
echo "Analyzing '$RUN_SCRIPT'" >&2
# Get current directory settings
eval $(perl -lne 'if(/^\s*((?:BUILD|MODEL)_DIR)=(.*?)\s*$/) {print "OLD_$1='\''$2'\''"}' $RUN_SCRIPT)
eval $(perl -lne 'if(/^\s*((?:BUILD|MODEL)_DIR|basedir)=["'\'']?(.*?)["'\'']?\s*$/) {print "OLD_$1='\''$2'\''"}' $RUN_SCRIPT)
# New style scripts will make sure that helper scripts are found.
# So no need to hack the . ./* calls (see 4. below)
......@@ -93,7 +93,8 @@ do
# 3. to handle external scripts, replace script dir with tmp dir
# 4. to handle external scripts, replace working dir with tmp dir
# 5. to handle external scripts, replace ./ calls appropriately
# 6. use original model base for executable
# 6. to handle external scripts, replace build and model dirs appropriately
# 7. use original model base for executable
if $IGNORE_ERRORS
then
......@@ -107,6 +108,7 @@ s:^(\s*)\$\{START\}:\1exit # ${START}:
[ "$OLD_BUILD_DIR" ] && SUBST_BUILD_DIR="s:$OLD_BUILD_DIR:$BUILD_DIR:"
[ "$OLD_MODEL_DIR" ] && SUBST_MODEL_DIR="s:$OLD_MODEL_DIR:$MODEL_BASE_DIR:"
[ "$OLD_basedir" ] && SUBST_basedir="s:$OLD_basedir:$MODEL_BASE_DIR:"
EXEC_SHELL=$(perl -ne '/^\#!\s*(\/\S+)/x and print($1); exit' $RUN_SCRIPT)
case $EXEC_SHELL in
......@@ -133,9 +135,10 @@ cd '$WORK_DIR'
s:^(\s*)BUILD_DIR=.*$:\1BUILD_DIR='$BUILD_DIR':
s:^(\s*)EXPDIR=.*$:\1EXPDIR='$WORK_DIR':
s:^(\s*\.\s+)\./:\1'$RUN_BASE_DIR'/:
s:^(\s*(export\s+)?basedir=).*$:\1'$BUILD_DIR':
s:^(\s*(export\s+)?basedir=).*$:\1'$MODEL_BASE_DIR':
'${SUBST_BUILD_DIR-}'
'${SUBST_MODEL_DIR-}'
'${SUBST_basedir-}'
' "$RUN_SCRIPT" > $RUN_FILE
# Get script shell without possible +x/-e settings
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment