aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2020-05-11 20:27:10 +0300
committerromkatv <roman.perepelitsa@gmail.com>2020-05-11 20:27:10 +0300
commitf43d8b9e0ef48326e68fd627a016f94ab1c3585e (patch)
treeb4e58ba3f63c49f954b1d0d9e6199e7e3a963ca4
parente27a8fbcbf57bad399e74a78770ca89eb600db64 (diff)
parentbda74564e3b1b9bbaa77f840215f7d99d0b77ed8 (diff)
Merge commit 'bda74564e3b1b9bbaa77f840215f7d99d0b77ed8'v1.8.2
-rwxr-xr-xgitstatus/install43
1 files changed, 21 insertions, 22 deletions
diff --git a/gitstatus/install b/gitstatus/install
index 1ae8d8dd..1ef27cbb 100755
--- a/gitstatus/install
+++ b/gitstatus/install
@@ -205,31 +205,30 @@ END
[ -d "$cache_dir" ] || mkdir -p -- "$cache_dir" || return
local url="https://github.com/romkatv/gitstatus/releases/download/$version/$file.tar.gz"
- local archive="$cache_dir"/"$file".tmp.$$.tar.gz
- if command -v curl >/dev/null 2>&1; then
- # `cd` is a workaround for Cygwin. It cannot handle -o with slashes.
- if ! err="$(cd ${ZSH_VERSION:+-q} -- "$cache_dir" 2>&1 &&
- command curl -fsSLo "${archive##*/}" -- "$url" 2>&1)"; then
- >&2 printf "%s\n" "$err"
- >&2 echo "[gitstatus] error: failed to download gitstatusd: $url"
- return 1
- fi
- elif command -v wget >/dev/null 2>&1; then
- if ! err="$(command wget -O "$archive" -- "$url" 2>&1)"; then
- >&2 printf "%s\n" "$err"
- >&2 echo "[gitstatus] error: failed to download gitstatusd: $url"
- return 1
- fi
- else
- >&2 echo "[gitstatus] error: please install curl or wget"
- return 1
- fi
(
if [ -n "${ZSH_VERSION:-}" ]; then
- builtin cd -q -- "$cache_dir" || return
+ builtin cd -q -- "$cache_dir" || exit
+ else
+ cd -- "$cache_dir" || exit
+ fi
+
+ local archive="$file".tmp.$$.tar.gz
+ local err
+
+ if command -v curl >/dev/null 2>&1; then
+ err="$(command curl -fsSLo "$archive" -- "$url" 2>&1)"
+ elif command -v wget >/dev/null 2>&1; then
+ err="$(command wget -O "$archive" -- "$url" 2>&1)"
else
- cd -- "$cache_dir" || return
+ >&2 echo "[gitstatus] error: please install curl or wget"
+ exit 1
+ fi
+
+ if [ $? != 0 ]; then
+ >&2 printf "%s\n" "$err"
+ >&2 echo "[gitstatus] error: failed to download gitstatusd: $url"
+ exit 1
fi
local old=
@@ -240,7 +239,7 @@ END
[ -e "$old" ] || break
i="$((i+1))"
done
- command mv -f -- "$daemon" "$old" || return
+ command mv -f -- "$daemon" "$old" || exit
fi
command tar -xzf "$archive"