forked from octra-labs/octra_pre_client
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·83 lines (70 loc) · 2.41 KB
/
run.sh
File metadata and controls
executable file
·83 lines (70 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
# ==============================================================================
# Menu & Execution
# Purpose:
# - Checks for a virtual environment and sets it up if needed.
# - Displays a menu for the user to select a specific bot.
# - Activates the environment and runs the chosen bot.
# ==============================================================================
# if any command fails program will force stop.
set -e
# --- Colors Output ---
COLOR_GREEN='\033[0;32m'
COLOR_YELLOW='\033[1;33m'
COLOR_BLUE='\033[0;34m'
COLOR_NC='\033[0m'
echo
echo -e "${COLOR_YELLOW}Starting Execution...${COLOR_NC}"
# --- Prerequisite Check & Setup ---
if [ ! -f "venv/bin/activate" ]; then
echo -e "${COLOR_YELLOW}Info: Virtual Environment Not Found. Performing Setup...${COLOR_NC}"
if [ -d "venv" ]; then
echo "Removing Incomplete 'venv' Directory"
sudo -E rm -rf venv
fi
echo "1. Creating Virtual Environment"
python3 -m venv venv
echo "2. Activating Virtual Environment"
source venv/bin/activate
echo "3. Installing Packages Requirements"
sudo -E pip3 install --no-cache-dir -r requirements.txt
echo
echo -e "${COLOR_GREEN}Setup Complete${COLOR_NC}"
else
echo "Activating Virtual Environment"
source venv/bin/activate
echo -e "${COLOR_GREEN}Virtual Environment Activated${COLOR_NC}"
fi
# --- Menu Function ---
display_menu() {
echo
echo -e "${COLOR_BLUE}==================================================${COLOR_NC}"
echo -e " ${COLOR_YELLOW}1)${COLOR_NC} ${COLOR_GREEN}Octra Network CLI${COLOR_NC}"
echo -e " ${COLOR_YELLOW}2)${COLOR_NC} ${COLOR_GREEN}Octra Network Auto Bot${COLOR_NC}"
echo -e " ${COLOR_YELLOW}0)${COLOR_NC} Exit"
echo -e "${COLOR_BLUE}==================================================${COLOR_NC}"
}
# --- Main Loop ---
while true; do
display_menu
read -p "Enter Menu [0, 1-2]: " choice
case $choice in
1)
echo -e "Running | Octra Network CLI"
python cli.py
echo -e "Starting Execution"
;;
2)
echo -e "Running | Octra Network Auto Bot"
python auto_running.py
echo -e "Starting Execution"
;;
0)
echo -e "Info: Run ./run.sh to Restart Program"
break
;;
*)
echo -e "Invalid Option. Please Try Again"
;;
esac
done