From 4b39a3d5dae3b91ccb5ca2bb27071e9072e35fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Fri, 27 Apr 2018 11:40:34 +0200 Subject: [PATCH] Implement spinning progress bar stuff --- hack/bootstrap_tfw_dev.sh | 29 +++++++++++++++++++++++------ hack/oneline_install.sh | 2 +- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/hack/bootstrap_tfw_dev.sh b/hack/bootstrap_tfw_dev.sh index c94c047..0cffd39 100755 --- a/hack/bootstrap_tfw_dev.sh +++ b/hack/bootstrap_tfw_dev.sh @@ -18,6 +18,23 @@ FRONTEND=frontend-${TFW_POSTFIX} LOGFILE=/tmp/bootstrap_tfw.log logged() { "$@" >> $LOGFILE 2>&1; } +spinned() +{ + "$@" & + pid=$! + spin=("-" "\\" "|" "/") + + echo -n "${spin[0]}" + while kill -0 $pid &> /dev/null; do + for i in "${spin[@]}"; do + echo -ne "\b$i" + sleep 0.1 + done + done + echo -ne "\b" +} + + run() { trap 'err_cleanup; showlog' ERR @@ -45,9 +62,9 @@ err_cleanup() { cd "$BASEDIR" && rm -rf "$BASEIMAGE" "$FRONTEND" "$TEST"; } clone_repos() { echo -n "Cloning TFW repositories... " - echo -n "baseimage... " && logged git clone git@github.com:avatao-content/${BASEIMAGE}.git - echo -n "frontend... " && logged git clone git@github.com:avatao-content/${FRONTEND}.git - echo -n "test... " && logged git clone git@github.com:avatao-content/${TEST}.git + echo -n "baseimage... " && spinned logged git clone git@github.com:avatao-content/${BASEIMAGE}.git + echo -n "frontend... " && spinned logged git clone git@github.com:avatao-content/${FRONTEND}.git + echo -n "test... " && spinned logged git clone git@github.com:avatao-content/${TEST}.git echo "Done!" } @@ -55,7 +72,7 @@ install_frontend_deps() { echo -n "Installing frontend dependencies... " pushd "$FRONTEND" - logged yarn install + spinned logged yarn install popd echo "Done!" } @@ -72,9 +89,9 @@ build_latest_baseimage() { echo -n "Building baseimage at ${LATESTTAG}... " pushd "$BASEIMAGE" - logged git checkout "$LATESTTAG" + spinned logged git checkout "$LATESTTAG" popd - TFWTAG=$LATESTTAG logged ${TEST}/hack/tfw.sh buildtfw + TFWTAG=$LATESTTAG spinned logged ${TEST}/hack/tfw.sh buildtfw echo "Done!" } diff --git a/hack/oneline_install.sh b/hack/oneline_install.sh index 7ba8dd1..9d74971 100644 --- a/hack/oneline_install.sh +++ b/hack/oneline_install.sh @@ -1 +1 @@ -URL=https://git.io/vxBfj SHA=18a2be757b6367c725aaaa1706c12aacf81684e49c3d911c6fa1f59a9ed996da 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=3e44081a8b5eca761b4f180a99d72a88e56e3ddc0f2904106adb8f1266b5bcae bash -c 'cmd="$(curl -fsSL $URL)" && [ $(echo "$cmd" | sha256sum | cut -d " " -f1) == $SHA ] && echo "$cmd" | bash || echo Checksum mismatch!'