Created
March 15, 2021 11:43
-
-
Save khorevaa/b303d9288922ba553774cd90a5af6b2b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
TAR_FILE="/tmp/oneget.tar.gz" | |
RELEASES_URL="https://github.com/v8platform/oneget/releases" | |
test -z "$TMPDIR" && TMPDIR="$(mktemp -d)" | |
last_version() { | |
curl -sL -o /dev/null -w %{url_effective} "$RELEASES_URL/latest" | | |
rev | | |
cut -f1 -d'/'| | |
rev | |
} | |
download() { | |
test -z "$ONEGET_VERSION" && ONEGET_VERSION="$(last_version)" | |
test -z "$ONEGET_VERSION" && { | |
echo "Unable to get oneget version." >&2 | |
exit 1 | |
} | |
rm -f "$TAR_FILE" | |
curl -s -L -o "$TAR_FILE" \ | |
"$RELEASES_URL/download/$ONEGET_VERSION/oneget_$(uname -s)_$(uname -m).tar.gz" | |
} | |
download | |
tar -xf "$TAR_FILE" -C "$TMPDIR" | |
"${TMPDIR}/oneget" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment