1
0

Added scripts/build.sh (missed with last xe-solutions update)

Signed-off-by: James P. Ketrenos <james.p.ketrenos@intel.com>
This commit is contained in:
James P. Ketrenos 2019-12-03 10:55:11 -08:00
parent c19f0d2371
commit 9394564918

50
scripts/build.sh Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
# Bring in the variables from SOLUTION file, supporting
# nested substitution
. SOLUTION
function fail {
>&2 echo "$*"
exit -1
}
case "${OS_DISTRO}" in
rhel)
SOLUTION_SUFFIX=".rhel-8.0"
;;
ubuntu)
SOLUTION_SUFFIX=""
;;
*)
SOLUTION_SUFFIX=".${OS_DISTRO}-${OS_RELEASE}"
[[ -d "templates/${OS_DISTRO}" ]] || {
echo "Unrecognized OS_DISTRO: '${OS_DISTRO}'"
exit -1
}
[[ ! -e "Dockerfile.solution.${SOLUTION_SUFFIX}" ]] && {
SOLUTION_SUFFIX=""
}
;;
esac
[[ ! -e "Dockerfile${SOLUTION_SUFFIX}" ]] && {
cat << EOF
'${OS_DISTRO}' set as OS_DISTRO, but Dockerfile${SOLUTION_SUFFIX} does
not exist.
Using Dockerfile instead.
EOF
SOLUTION_SUFFIX=""
}
export DOCKERFILE="Dockerfile${SOLUTION_SUFFIX}"
export SOLUTION="Dockerfile.solution${SOLUTION_SUFFIX}"
[[ "${SOLUTION}" -nt "${DOCKERFILE}" ]] && {
echo "${SOLUTION} is newer than ${DOCKERFILE}. Running scripts/build-dockerfile.sh"
scripts/build-dockerfile.sh || fail "Unable to update ${DOCKERFILE}"
}
scripts/build-image.sh || fail "Unable to build ${DOCKERFILE}"