From f994815030ae618813b0a80287637b0826b350ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Sat, 31 Mar 2018 01:26:17 +0200 Subject: [PATCH] Implement support to omit cloning of baseimage in bootstrap script --- hack/bootstrap_tfw_dev.sh | 13 ++++++++++++- hack/oneline_install.sh | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/hack/bootstrap_tfw_dev.sh b/hack/bootstrap_tfw_dev.sh index d58ab27..c4c44ef 100755 --- a/hack/bootstrap_tfw_dev.sh +++ b/hack/bootstrap_tfw_dev.sh @@ -7,6 +7,8 @@ TEST=test-${TFW_POSTFIX} FRONTEND=frontend-${TFW_POSTFIX} LOGFILE=/tmp/bootstrap_tfw.log +[ "$(uname)" == "Darwin" ] && sed_cmd="gsed" || sed_cmd="sed" + showlog() { echo && echo "Error! Showing logs:" && cat $LOGFILE; } cleanlog() { rm $LOGFILE; } trap showlog ERR @@ -14,12 +16,21 @@ trap cleanlog EXIT : > $LOGFILE echo -n "Cloning TFW repositories... " -echo -n "baseimage... " && git clone git@github.com:avatao-content/${BASEIMAGE}.git >> $LOGFILE 2>&1 +[ ! -z "$TFWDEV" ] && echo -n "baseimage... " && git clone git@github.com:avatao-content/${BASEIMAGE}.git >> $LOGFILE 2>&1 || : echo -n "frontend... " && git clone git@github.com:avatao-content/${FRONTEND}.git >> $LOGFILE 2>&1 echo -n "test... " && git clone git@github.com:avatao-content/${TEST}.git >> $LOGFILE 2>&1 echo "Done!" echo +if [ -z "$TFWDEV" ]; then + TFWURL=https://registry.hub.docker.com/v1/repositories/avatao/tutorial-framework/tags + PYTHON_PARSEJSON="import sys, json; print json.load(sys.stdin)[-1]['name']" + LATESTTAG="$(curl -fsSL ${TFWURL} | python -c "${PYTHON_PARSEJSON}")" + $sed_cmd -i "1 s/.*/&:${LATESTTAG}/" "${TEST}/solvable/Dockerfile" + rm -rf "${TEST}/.git" + rm -rf "${FRONTEND}/.git" +fi + echo -n "Installing frontend dependencies... " cd ${FRONTEND} yarn install >> $LOGFILE 2>&1 diff --git a/hack/oneline_install.sh b/hack/oneline_install.sh index 515a6ba..6fc582f 100644 --- a/hack/oneline_install.sh +++ b/hack/oneline_install.sh @@ -1 +1 @@ -URL=https://git.io/vxBfj SHA=03471568f3a3e71c072e6b24b69c9cd8620b8fa2b7811c8e12c1c54f45884677 bash -c 'cmd="$(curl -fsSL $URL)" && [ $(echo "$cmd" | sha256sum | cut -d " " -f1) == $SHA ] && echo "$cmd" | bash || echo Checksum mismatch!' +URL=https://git.io/vxBfj SHA=9e6d121bc6cff930a252d00df501a84adbef4df3a0979dddf13949f35ec49006 bash -c 'cmd="$(curl -fsSL $URL)" && [ $(echo "$cmd" | sha256sum | cut -d " " -f1) == $SHA ] && echo "$cmd" | bash || echo Checksum mismatch!'