From 1d566d10c194ef5eb06b051437e0821d61f2dba8 Mon Sep 17 00:00:00 2001 From: Volara Date: Sat, 27 Jul 2024 16:30:01 -0400 Subject: [PATCH] Fixes to shell scripting --- bin/volara | 2 +- bin/volara_miner | 2 +- pyproject.toml | 1 + setup.sh | 29 +++++++++++++++++++++++++++-- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/bin/volara b/bin/volara index b984787..af03987 100755 --- a/bin/volara +++ b/bin/volara @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR/.. diff --git a/bin/volara_miner b/bin/volara_miner index e4706ba..b5cf639 100755 --- a/bin/volara_miner +++ b/bin/volara_miner @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR/.. diff --git a/pyproject.toml b/pyproject.toml index ab302be..f52c996 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ version = "0.1.0" description = "Scrape tweets from the web and upload to the Volara DLP" authors = ["Volara"] readme = "README.md" +package-mode=false [tool.poetry.dependencies] python = ">=3.11,<3.13" diff --git a/setup.sh b/setup.sh index b0da179..f598ec8 100755 --- a/setup.sh +++ b/setup.sh @@ -1,14 +1,39 @@ #!/bin/bash +# Function to check if a command exists +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + +# 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 + +# 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 "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 -echo 'Volara setup successful.' \ No newline at end of file +# 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 `./bin/volara mine start`' \ No newline at end of file