From d36c1099a99cb49a5e58e66efdd2f196c4cf4910 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Mon, 28 Oct 2019 15:27:53 -0700 Subject: [PATCH] Modify build-dockerfile to only replace variables as set in in SOLUTIONS / MANIFEST Signed-off-by: James Ketrenos --- scripts/build-dockerfile | 20 +++++++++++++++----- templates/05-intel-proxy.in | 8 ++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/scripts/build-dockerfile b/scripts/build-dockerfile index c0a1acc..ad4ec22 100755 --- a/scripts/build-dockerfile +++ b/scripts/build-dockerfile @@ -11,9 +11,19 @@ fi . SOLUTION . MANIFEST -export $(sed -nE "s,(^[^#][^=]*).*$,\1,pg" SOLUTION | ${CMD} -d '\n') -export $(sed -nE "s,(^[^#][^=]*).*$,\1,pg" MANIFEST | ${CMD} -d '\n') +VARS=($(sed -nE "s,(^[^#][^=]*).*$,\1,pg" SOLUTION)) +VARS+=($(sed -nE "s,(^[^#][^=]*).*$,\1,pg" MANIFEST)) +for var in ${VARS[@]}; do + export ${var} +done +# Build a SHELL-FORMAT value to pass to envsubst. +# Only those variables matched in SHELL-FORMAT will +# be escaped by envsubst. +ENV='' +for var in ${VARS[@]}; do + ENV=${ENV}'$'${var} +done # Remove the Dockerfile if it exists; should check # if it is clean first, and abort if not. @@ -42,7 +52,7 @@ for snippet in templates/??-*.in; do # Template from templates/${snippet} # EOM - envsubst < $snippet >> Dockerfile + envsubst ${ENV} < $snippet >> Dockerfile done cat << EOM >> Dockerfile @@ -52,7 +62,7 @@ cat << EOM >> Dockerfile # EOM -envsubst < Dockerfile.solution >> Dockerfile +envsubst ${ENV} < Dockerfile.solution >> Dockerfile cat << EOM >> Dockerfile @@ -61,7 +71,7 @@ cat << EOM >> Dockerfile # EOM -envsubst < templates/ending.in >> Dockerfile +envsubst ${ENV} < templates/ending.in >> Dockerfile cat << EOM diff --git a/templates/05-intel-proxy.in b/templates/05-intel-proxy.in index 1a2c73c..6ab17ae 100644 --- a/templates/05-intel-proxy.in +++ b/templates/05-intel-proxy.in @@ -1,6 +1,14 @@ # Pre-install proxy configuration values # # This uses the linux-ftp.ostc.intel.com as a mirror. +RUN { \ + for suite in ${OS_RELEASE} ${OS_RELEASE}-updates ${OS_RELEASE}-security ${OS_RELEASE}-backports; do \ + for component in main restricted universe multiverse; do \ + echo "deb http://linux-ftp.ostc.intel.com/pub/mirrors/${OS_DISTRO} ${suite} ${component}" ; \ + done \ + done \ +} > /etc/apt/sources.list + RUN { \ echo "Acquire::http::proxy \"http://proxy-chain.intel.com:911/\";\n" ; \ echo "Acquire::https::proxy \"http://proxy-chain.intel.com:912/\";\n" ; \