@@ 8,12 8,26 @@ current_os() {
uname | tr '[:upper:]' '[:lower:]'
}
+current_arch() {
+ uname -m | tr '[:upper:]' '[:lower:]'
+}
+
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
TARGET_VERSION=${1:-latest}
PREFIX=${PREFIX:-$(dirname "$SCRIPT_DIR")}
mkdir -p "$PREFIX"/lib "$PREFIX"/bin
GOOS=$(current_os)
-GOARCH=amd64 # TODO: find a portable way to determine this without go installed
+
+GOARCH=$(current_arch)
+if [ $GOARCH = "x86_64" ]; then
+ GOARCH="amd64"
+elif [ $GOARCH = "arm64" ]; then
+ # Do nothing, this is supported.
+ true;
+else
+ echo "Unsupported architecture: $GOARCH"
+ exit 1
+fi
major() {
out=$(echo "$1" | cut -d. -f1)