From 26751352b83234c0f319355fc01f1e53a3eaf8cf Mon Sep 17 00:00:00 2001 From: Paul Caskey Date: Fri, 3 Nov 2017 06:06:56 -0500 Subject: [PATCH] add functionality for reteiving docker build files --- configBuilder.sh | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/configBuilder.sh b/configBuilder.sh index 7dde422..3713443 100644 --- a/configBuilder.sh +++ b/configBuilder.sh @@ -8,9 +8,13 @@ cd /scriptrun # script config items SHB_CFG_URL=https://github.internet2.edu/docker/shib-idp-conftree/archive/3.3release.zip -TOM_CFG_URL=https://github.internet2.edu/docker/shib-idp-tomcat-config/archive/master.zip +TOM_CFG_URL=https://github.intrnet2.edu/docker/shib-idp-tomcat-config/archive/master.zip TMP_DIR_S=/tmp/3.3release TMP_DIR_T=/tmp/tomcfg +TMP_DIR_D=/tmp/buildfiles +LINUX_BUILD_FILES_URL=https://github.internet2.edu/docker/shib-idp_noVM/archive/master.zip +WINDOWS_BUILD_FILES_URL=https://github.internet2.edu/docker/ShibbIdP_noVM_Windows/archive/master.zip + # default directories TOMCFG=config/tomcat @@ -56,16 +60,44 @@ mkdir -p config/shib-idp/messages mkdir -p config/shib-idp/metadata mkdir -p logs/shib-idp -#grab copy of Dockerfile (from host filesystem mount) + +########################################################### +### grab the docker build files, depending on OS choice ### +########################################################### +# first, check for wget +command -v wget >/dev/null 2>&1 || { echo >&2 "ERROR: wget is required, but doesn't appear to be installed. Aborting..."; exit 1; } + + +case "$BUILD_ENV" in +LINUX | linux) + echo "Getting build files for a Linux container" + wget -q -O ${TMP_DIR_D}.zip ${LINUX_BUILD_FILES_URL} > /dev/null + ;; +WINDOWS | windows) + echo "Getting build files for a Windows container" + wget -q -O ${TMP_DIR_D}.zip ${WINDOWS_BUILD_FILES_URL} > /dev/null + ;; +*) + echo "Environment variable BUILD_ENV was not found or had an incorrect value (only LINUX|WINDOWS is supported). Terminating." + exit 1 + ;; +esac + +unzip -o -d ${TMP_DIR_D} ${TMP_DIR_D}.zip > /dev/null 2>&1 + +cp -rf ${TMP_DIR_D}/* /output +rm -f /output/configBuilder.sh > /dev/null 2>&1 +rm -f /output/setup.log > /dev/null 2>&1 + +#grab copy of Dockerfile in working dir cp -f /output/Dockerfile . + + ############################################################## ### download default/TIER config for both shibb and tomcat ### ############################################################## # -# first, check for wget -command -v wget >/dev/null 2>&1 || { echo >&2 "ERROR: wget is required, but doesn't appear to be installed. Aborting..."; exit 1; } - wget -q -O ${TMP_DIR_S}.zip ${SHB_CFG_URL} > /dev/null wget -q -O ${TMP_DIR_T}.zip ${TOM_CFG_URL} > /dev/null @@ -680,7 +712,9 @@ rm -f ${TMP_DIR_T}.zip rm -rf ${TMP_DIR_T}/* rmdir ${TMP_DIR_T} - +rm -f ${TMP_DIR_D}.zip +rm -rf ${TMP_DIR_D}/* +rmdir ${TMP_DIR_D} #copy config to output directory