
Modified loading of SOLUTION and MANIFEST so they support nested substitution Signed-off-by: James Ketrenos <james.p.ketrenos@intel.com>
73 lines
1.4 KiB
Bash
Executable File
73 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Determine if it is Mac OS and switch to use gxargs instead
|
|
CMD=xargs
|
|
if [ $(which system_profiler) ]; then
|
|
CMD=gxargs
|
|
fi
|
|
|
|
# Bring in the variables from SOLUTION file, supporting
|
|
# nested substitution
|
|
. SOLUTION
|
|
. MANIFEST
|
|
|
|
export $(sed -nE "s,(^[^#][^=]*).*$,\1,pg" SOLUTION | ${CMD} -d '\n')
|
|
export $(sed -nE "s,(^[^#][^=]*).*$,\1,pg" MANIFEST | ${CMD} -d '\n')
|
|
|
|
|
|
# Remove the Dockerfile if it exists; should check
|
|
# if it is clean first, and abort if not.
|
|
#
|
|
[ -e Dockerfile ] && rm Dockerfile
|
|
|
|
cat << EOM > Dockerfile
|
|
#
|
|
# DO NOT EDIT THIS DOCKERFILE
|
|
#
|
|
# This file is auto-generated via scripts/build-dockerfile
|
|
# by using environment substitution while concatenating the
|
|
# contents of templates/*, and then adding the contents
|
|
# of Dockerfile.solution
|
|
#
|
|
# Most solution specific changes should be isolated in
|
|
# Dockerfile.solution. After making changes, you can
|
|
# then re-run scripts/build-dockerfile
|
|
#
|
|
EOM
|
|
|
|
for snippet in templates/??-*.in; do
|
|
cat << EOM >> Dockerfile
|
|
|
|
#
|
|
# Template from templates/${snippet}
|
|
#
|
|
EOM
|
|
envsubst < $snippet >> Dockerfile
|
|
done
|
|
|
|
cat << EOM >> Dockerfile
|
|
|
|
#
|
|
# Solution begins here (from Dockerfile.solution)
|
|
#
|
|
EOM
|
|
|
|
envsubst < Dockerfile.solution >> Dockerfile
|
|
|
|
cat << EOM >> Dockerfile
|
|
|
|
#
|
|
# Standard ending begins here (from templates/ending.in)
|
|
#
|
|
EOM
|
|
|
|
envsubst < templates/ending.in >> Dockerfile
|
|
|
|
cat << EOM
|
|
|
|
Dockerfile has been updated.
|
|
|
|
To build the image, you can run scripts/build-images
|
|
|
|
EOM
|