Solve the space in base path problem

If there is a space in the base anywhere, the scripts fails to start. 
This is due to the default separator used in bash (which is a space). 
This default separator can be change by setting the variable $IFS.
In `build.sh`, the old IFS variable is saved and then replaced by 
`\n\b`. At the end of the script, the saved IFS is set back.

In `build-docker.sh`, a simple double quote was enough.
This commit is contained in:
Romain Bazile 2020-05-30 18:56:19 +02:00
parent 08fc0b9a82
commit 65aceb849f
2 changed files with 7 additions and 2 deletions

View File

@ -41,7 +41,7 @@ if test -z "${CONFIG_FILE}"; then
exit 1
else
# shellcheck disable=SC1090
source ${CONFIG_FILE}
source "${CONFIG_FILE}"
fi
CONTAINER_NAME=${CONTAINER_NAME:-pigen_work}

View File

@ -229,7 +229,10 @@ fi
mkdir -p "${WORK_DIR}"
log "Begin ${BASE_DIR}"
STAGE_LIST=${STAGE_LIST:-${BASE_DIR}/stage*}
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
STAGE_LIST=${STAGE_LIST:-"${BASE_DIR}"/stage*}
for STAGE_DIR in $STAGE_LIST; do
STAGE_DIR=$(realpath "${STAGE_DIR}")
@ -261,3 +264,5 @@ if [ -x ${BASE_DIR}/postrun.sh ]; then
fi
log "End ${BASE_DIR}"
IFS=$SAVEIFS