Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create start mining #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions start mining
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}

# Check if git is installed
if ! command_exists git; then
echo "Git is not installed. Please install Git and try again."
exit 1
fi

# Check if Python is installed
if ! command_exists python3; then
echo "Python 3 is not installed. Please install Python 3 and try again."
exit 1
fi

# Check if Poetry is installed
if ! command_exists poetry; then
echo "Poetry is not installed. Installing Poetry..."
curl -sSL https://install.python-poetry.org | python3 -
fi

# Clone the Volara repository
echo "Cloning Volara repository..."
mkdir -p ~/.volara/install
git clone https://github.com/volaradlp/minercli.git ~/.volara/install
cd ~/.volara/install

# Install dependencies using Poetry
echo "Installing dependencies..."
poetry install

# Get the absolute directory of this script
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

# Add the bin directory to PATH in both .zshrc and .bashrc
echo "Adding Volara to PATH..."
echo "export PATH=$SCRIPT_DIR/bin:\$PATH" >> ~/.zshrc
echo "export PATH=$SCRIPT_DIR/bin:\$PATH" >> ~/.bashrc

# Update current session's PATH
export PATH=$SCRIPT_DIR/bin:$PATH

# Inform success
GREEN='\033[0;32m'
NC='\033[0m' # No Color
printf "${GREEN}### Volara setup successful ###${NC}\n"
echo 'Please restart your terminal or run 'source ~/.zshrc' or 'source ~/.bashrc' to use the 'volara' command.'
echo 'Start mining with `volara mine start`'