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

importexp: support for /bin/bash scripts (no echoing of here docs)

parent 8136e010
No related branches found
No related tags found
No related merge requests found
......@@ -39,19 +39,35 @@ do
echo "Analyzing '$RUN_SCRIPT'" >&2
# New style scripts will make sure that helper scripts are found.
# So no need to hack the . ./* calls
# So no need to hack the . ./* calls (see 4. below)
if grep '^ *cd *\$BUILD_DIR/run' $RUN_SCRIPT > /dev/null
then
RUN_BASE_DIR=.
fi
# "Normalize" run script
# 1. get rid of possible +x settings
# 2. to handle external scripts, replace script dir with tmp dir
# 3. to handle external scripts, replace working dir with tmp dir
# 4. to handle external scripts, replace ./ calls appropriately
# 5. levante scripts use bash, where -x does not show here-docs
SHOW_HERE_DOCS='\
for x in $master_namelist $atm_namelist $jsbach_namelist $oce_namelist\
do\
echo "cat > $x << EOF"\
cat $x\
echo EOF\
done\
'
sed -r '
s:^(\s*)(set\s+\+x\s*$|(set\s+\+\w+)x):\1\3:
s:^(\s*)SCRIPT_DIR=.*$:\1SCRIPT_DIR='$WORK_DIR':
s:^(\s*)EXPDIR=.*$:\1EXPDIR='$WORK_DIR':
s:^(\s*\.\s+)\./:\1'$RUN_BASE_DIR'/:
s:^\s*cat\s+\$thisscript\s*$:'"$SHOW_HERE_DOCS"':
' "$RUN_SCRIPT" > $RUN_FILE
# Get script shell without possible +x settings to handle
COMMAND=$(perl -ne '
/^\#!\s*(\/\S+)(
\s+\+x\s*$|
......
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