mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-08-23 22:16:48 +00:00
ref(sh): check exit code rather than stdout
This commit is contained in:
+12
-11
@@ -4,20 +4,21 @@ set -u
|
||||
|
||||
__init_git() {
|
||||
|
||||
if [ -z "$(command -v git)" ]; then
|
||||
if [ "Darwin" = "$(uname -s)" ]; then
|
||||
echo >&2 "Error: 'git' not found. You may have to re-install 'git' on Mac after every major update."
|
||||
echo >&2 " for example, try: xcode-select --install"
|
||||
# sudo xcodebuild -license accept
|
||||
else
|
||||
echo >&2 "Error: to install 'git' on Linux use the built-in package manager."
|
||||
echo >&2 " for example, try: sudo apt install -y git"
|
||||
fi
|
||||
exit 1
|
||||
else
|
||||
if command -v git > /dev/null; then
|
||||
echo "'git' already installed"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "Darwin" = "$(uname -s)" ]; then
|
||||
echo >&2 "Error: 'git' not found. You may have to re-install 'git' on Mac after every major update."
|
||||
echo >&2 " for example, try: xcode-select --install"
|
||||
# sudo xcodebuild -license accept
|
||||
else
|
||||
echo >&2 "Error: to install 'git' on Linux use the built-in package manager."
|
||||
echo >&2 " for example, try: sudo apt install -y git"
|
||||
fi
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
__init_git
|
||||
|
||||
Reference in New Issue
Block a user