From a20f9c63b9fc868e47c59bfaee9e73680e705a16 Mon Sep 17 00:00:00 2001 From: Mayur Chougule Date: Sun, 17 Sep 2023 16:42:03 -0400 Subject: [PATCH] install script added --- Makefile | 5 +++-- install.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100755 install.sh diff --git a/Makefile b/Makefile index 8939764..9070804 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,8 @@ all: build # Compiles the binary for mac build: @echo "Building for Mac..." - mkdir -p ${BINARY_NAME}-mac - GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -o ${BINARY_NAME}-mac -v ./... + mkdir -p ${BINARY_NAME}-darwin-arm64 + GOOS=darwin GOARCH=arm64 go build ${LDFLAGS} -o ${BINARY_NAME}-darwin-arm64 -v ./... mkdir -p ${HOME}/.vimana cp config.toml ${HOME}/.vimana/config.toml @@ -48,3 +48,4 @@ build-linux: cp config.toml ${HOME}/.vimana/config.toml .PHONY: all build clean test install build-linux +# tar -czvf vimana_bins21.tar.gz vimana-linux-amd64/ \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..e0ffe2f --- /dev/null +++ b/install.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -e +OS=$(uname -s | tr '[:upper:]' '[:lower:]') +ARCH=$(uname -m) +if [[ "$ARCH" == "x86_64" ]]; then + ARCH="amd64" +elif [[ "$ARCH" == "arm64" ]] || [[ "$ARCH" == "aarch64" ]]; then + ARCH="arm64" +fi +VIMANA_RELEASE_TAG="0.0.1" +GZ_URL="https://github.com/Vistara-Labs/vimana/releases/download/vimana-${VIMANA_RELEASE_TAG}/vimana-${OS}-${ARCH}.tar.gz" +# echo "💻 OS: $OS" +# echo "🏗️ ARCH: $ARCH" + +INTERNAL_DIR="/usr/local/bin/" +VIMANA_BIN_PATH="/usr/local/bin/vimana" +if [ -f "$VIMANA_BIN_PATH" ] || [ -f "$INTERNAL_DIR" ]; then + sudo rm -f "$VIMANA_BIN_PATH" + sudo rm -rf "$INTERNAL_DIR" +fi +sudo mkdir -p "$INTERNAL_DIR" +sudo mkdir -p "/tmp/vimana_bins" +echo "💿Downloading vimana..." +curl -O -L $GZ_URL --progress-bar + +sudo tar -xzf vimana-${OS}-${ARCH}.tar.gz -C "/tmp/vimana_bins" + +echo "🔨Installing vimana..." +sudo cp "/tmp/vimana_bins/vimana-${OS}-${ARCH}/vimana" "$INTERNAL_DIR/vimana" +sudo chmod +x "$INTERNAL_DIR/vimana" +sudo rm -rf "/tmp/vimana_bins" +echo "✅ vimana installed!" \ No newline at end of file