From 28801914fc6eeb4635091a37f4dd8b40f38472ae Mon Sep 17 00:00:00 2001 From: Sebastian Luna Valero Date: Fri, 1 Dec 2017 15:40:47 +0000 Subject: [PATCH] check whether git is available --- install-CGAT-tools.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/install-CGAT-tools.sh b/install-CGAT-tools.sh index 2ea07fb0..6825d866 100755 --- a/install-CGAT-tools.sh +++ b/install-CGAT-tools.sh @@ -530,6 +530,19 @@ fi } +# test whether --git and --git-ssh download is doable +test_git() { + git --version >& /dev/null || GIT_AVAIL=$? + if [[ $GIT_AVAIL -ne 0 ]] ; then + echo + echo " Git is not available but --git or --git-ssh option was given." + echo " Please rerun this script on a computer with git installed " + echo " or try again without --git or --git-ssh" + report_error " " + fi +} + + # test whether --git-ssh download is doable test_git_ssh() { ssh-add -L >& /dev/null || SSH_KEYS_LOADED=$? @@ -647,11 +660,13 @@ case $key in --git) CODE_DOWNLOAD_TYPE=1 shift + test_git ;; --git-ssh) CODE_DOWNLOAD_TYPE=2 shift + test_git test_git_ssh ;;