Implement optional changing of git remotes to HTTPS

This commit is contained in:
Kristóf Tóth 2018-05-03 14:32:23 +02:00
parent 65ce63c2cd
commit f56de6aef4
2 changed files with 28 additions and 5 deletions

View File

@ -9,6 +9,7 @@ pushd() { command pushd "$@" > /dev/null; }
popd() { command popd "$@" > /dev/null; }
TFWDEV="${TFWDEV:-0}"
HTTPS_REMOTES="${HTTPS_REMOTES:-}"
TFW_POSTFIX=tutorial-framework
BASEDIR="$(pwd)"
BASEIMAGE=baseimage-${TFW_POSTFIX}
@ -23,7 +24,7 @@ run()
: > $LOGFILE
check_dependencies
clone_repos
clone_repos_ask_ssh_or_https
install_frontend_deps
if [ "$TFWDEV" == "0" ]; then
LATESTTAG="$(fetch_latest_tag)"
@ -73,12 +74,34 @@ check_dependencies()
fi
}
clone_repos_ask_ssh_or_https()
{
if [[ -z "$HTTPS_REMOTES" ]]; then
read -p "Repos are pulled over SSH by default. Should I use HTTPS instead? [y/N]" -r -t 5 || :
echo
if [[ $REPLY =~ ^(y|Y|yes|Yes|YES)$ ]]; then
HTTPS_REMOTES=1 clone_repos
else
HTTPS_REMOTES=0 clone_repos
fi
else
clone_repos
fi
}
clone_repos()
{
remotebase="git@github.com:"
spinned_or_not="spinned"
if [[ "$HTTPS_REMOTES" == "1" ]]; then
remotebase="https://github.com/"
spinned_or_not=""
fi
echo -n "Cloning TFW repositories... "
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 -n "baseimage... " && ${spinned_or_not} logged git clone ${remotebase}avatao-content/${BASEIMAGE}.git
echo -n "frontend... " && ${spinned_or_not} logged git clone ${remotebase}avatao-content/${FRONTEND}.git
echo -n "test... " && ${spinned_or_not} logged git clone ${remotebase}avatao-content/${TEST}.git
echo "Done!"
}

View File

@ -1 +1 @@
URL=https://git.io/vxBfj SHA=ec150859770843f4f8b4f5a16e08cc133c003b209272e715cfcfcd465b3b36e6 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=839906a1d2fce5a2fd4c01129dc03a90b520cf004009ebe431938e4ed835f240 bash -c 'cmd="$(curl -fsSL $URL)" && [ $(echo "$cmd" | sha256sum | cut -d " " -f1) == $SHA ] && echo "$cmd" | bash || echo Checksum mismatch!'