From: Kyle J. McKay Date: Sat, 24 Aug 2013 00:01:01 +0000 (-0700) Subject: install.sh: verify git_bin exists and is git X-Git-Url: https://repo.or.cz/w/girocco.git/commitdiff_plain/8696759799fa36ccaecf92419fd62adcafadeced install.sh: verify git_bin exists and is git As part of the initial installation, verify that $Girocco::Config::git_bin actually exists, is executable, and produces a sane '--version' result. --- diff --git a/install.sh b/install.sh index c8d62ca..302f9fb 100755 --- a/install.sh +++ b/install.sh @@ -37,6 +37,23 @@ if [ ! -f ezcert.git/CACreateCert ]; then fi +echo "*** Checking for git..." +if [ ! -x "$cfg_git_bin" ]; then + echo "ERROR: $cfg_git_bin does not exist or is not executable" >&2 + exit 1 +fi +if ! git_version="$("$cfg_git_bin" --version)"; then + echo "ERROR: $cfg_git_bin --version failed" >&2 + exit 1 +fi +case "$git_version" in + "git version "*) :;; + *) + echo "ERROR: '$cfg_git_bin --version' output does not start with 'git version '" >&2 + exit 1 +esac + + echo "*** Setting up basedir..." rm -fr "$cfg_basedir" mkdir -p "$cfg_basedir"