Skip to content

Commit

Permalink
install script added
Browse files Browse the repository at this point in the history
  • Loading branch information
mmchougule committed Sep 17, 2023
1 parent 521558c commit a20f9c6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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/
32 changes: 32 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -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!"

0 comments on commit a20f9c6

Please sign in to comment.