Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
philip-linaro committed Aug 14, 2019
1 parent cccb037 commit 900ee7f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions build-site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ check_multi_repo() {
#
# We then build up a list of mounts for Docker so that it can
# access those repo copies.
DOCKER_MOUNTS=""
#
# Use -g to make this a global variable (i.e. it lasts after
# the function finishes).
declare -a -g DOCKER_MOUNTS
DOCKER_MOUNTS=()
if [ ! -f "manifest.json" ]; then
echo "No multi-repo configuration to manage."
return
fi
#
Expand All @@ -29,14 +34,14 @@ check_multi_repo() {
# Need to strip extraneous chars off the tag string
tag="${tags[$i]}"
# Strip the leading " and the trailing ",
tag="${tag:1:-3}"
tag="${tag:1:-2}"
# Does that tag name exist as a variable and have a value?
tag_val="${!tag}"
if [ "$tag_val" != "" ]; then
# Does the value point to a directory?
if [ -d "$tag_val" ]; then
# Construct a Docker mount command
DOCKER_MOUNTS="$DOCKER_MOUNTS -v $tag_val:/$tag"
DOCKER_MOUNTS+=(-v $tag_val:/srv/$tag)
fi
fi
done
Expand Down Expand Up @@ -79,7 +84,7 @@ docker run \
-e JEKYLL_ENV \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/group:/etc/group:ro \
"$DOCKER_MOUNTS" \
"${DOCKER_MOUNTS[@]}" \
-u "$(id -u)":"$(id -g)" \
-v "$(pwd)":/srv/source \
linaroits/jekyllsitebuild:"$JEKYLLSITEBUILD" \
Expand Down

0 comments on commit 900ee7f

Please sign in to comment.