git: show either the Mac or the Linux message (not both)
[webi-installers/.git] / git / install.sh
index 68e66d654b5ed969b68652b15cc634182733068c..98bcf63f26bf1bbc34ed30290f8ba78847d29d2a 100644 (file)
@@ -1,8 +1,23 @@
 #!/bin/bash
-{
-    set -e
-    set -u
+set -e
+set -u
+
+function __init_git() {
+
+    if [ -z "$(command -v git)" ]; then
+        if [[ -n "$(uname -a | grep -i darwin)" ]]; then
+            >&2 echo "Error: 'git' not found. You may have to re-install 'git' on Mac after every major update."
+            >&2 echo "       for example, try: xcode-select --install"
+            # sudo xcodebuild -license accept
+        else
+            >&2 echo "Error: to install 'git' on Linux use the built-in package manager."
+            >&2 echo "       for example, try: xcode-select --install"
+        fi
+        exit 1
+    else
+        echo "'git' already installed"
+    fi
 
-    echo "This package doesn't work for Mac or Linux yet - only Windows 10"
-    exit 1
 }
+
+__init_git()