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:
parent
08fc0b9a82
commit
65aceb849f
|
@ -41,7 +41,7 @@ if test -z "${CONFIG_FILE}"; then
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source ${CONFIG_FILE}
|
source "${CONFIG_FILE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CONTAINER_NAME=${CONTAINER_NAME:-pigen_work}
|
CONTAINER_NAME=${CONTAINER_NAME:-pigen_work}
|
||||||
|
|
7
build.sh
7
build.sh
|
@ -229,7 +229,10 @@ fi
|
||||||
mkdir -p "${WORK_DIR}"
|
mkdir -p "${WORK_DIR}"
|
||||||
log "Begin ${BASE_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
|
for STAGE_DIR in $STAGE_LIST; do
|
||||||
STAGE_DIR=$(realpath "${STAGE_DIR}")
|
STAGE_DIR=$(realpath "${STAGE_DIR}")
|
||||||
|
@ -261,3 +264,5 @@ if [ -x ${BASE_DIR}/postrun.sh ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "End ${BASE_DIR}"
|
log "End ${BASE_DIR}"
|
||||||
|
|
||||||
|
IFS=$SAVEIFS
|
||||||
|
|
Loading…
Reference in New Issue
Block a user