|
|
@ -205,31 +205,30 @@ END
|
|
|
|
[ -d "$cache_dir" ] || mkdir -p -- "$cache_dir" || return
|
|
|
|
[ -d "$cache_dir" ] || mkdir -p -- "$cache_dir" || return
|
|
|
|
|
|
|
|
|
|
|
|
local url="https://github.com/romkatv/gitstatus/releases/download/$version/$file.tar.gz"
|
|
|
|
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 [ -n "${ZSH_VERSION:-}" ]; then
|
|
|
|
if ! err="$(cd ${ZSH_VERSION:+-q} -- "$cache_dir" 2>&1 &&
|
|
|
|
builtin cd -q -- "$cache_dir" || exit
|
|
|
|
command curl -fsSLo "${archive##*/}" -- "$url" 2>&1)"; then
|
|
|
|
else
|
|
|
|
>&2 printf "%s\n" "$err"
|
|
|
|
cd -- "$cache_dir" || exit
|
|
|
|
>&2 echo "[gitstatus] error: failed to download gitstatusd: $url"
|
|
|
|
|
|
|
|
return 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
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
|
|
|
|
elif command -v wget >/dev/null 2>&1; then
|
|
|
|
if ! err="$(command wget -O "$archive" -- "$url" 2>&1)"; then
|
|
|
|
err="$(command wget -O "$archive" -- "$url" 2>&1)"
|
|
|
|
>&2 printf "%s\n" "$err"
|
|
|
|
|
|
|
|
>&2 echo "[gitstatus] error: failed to download gitstatusd: $url"
|
|
|
|
|
|
|
|
return 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
>&2 echo "[gitstatus] error: please install curl or wget"
|
|
|
|
>&2 echo "[gitstatus] error: please install curl or wget"
|
|
|
|
return 1
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
(
|
|
|
|
if [ $? != 0 ]; then
|
|
|
|
if [ -n "${ZSH_VERSION:-}" ]; then
|
|
|
|
>&2 printf "%s\n" "$err"
|
|
|
|
builtin cd -q -- "$cache_dir" || return
|
|
|
|
>&2 echo "[gitstatus] error: failed to download gitstatusd: $url"
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
cd -- "$cache_dir" || return
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
local old=
|
|
|
|
local old=
|
|
|
@ -240,7 +239,7 @@ END
|
|
|
|
[ -e "$old" ] || break
|
|
|
|
[ -e "$old" ] || break
|
|
|
|
i="$((i+1))"
|
|
|
|
i="$((i+1))"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
command mv -f -- "$daemon" "$old" || return
|
|
|
|
command mv -f -- "$daemon" "$old" || exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
command tar -xzf "$archive"
|
|
|
|
command tar -xzf "$archive"
|
|
|
|