forked from Onixs50/gaianet-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgaianet.sh
61 lines (51 loc) · 1.91 KB
/
gaianet.sh
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
#!/bin/bash
# Define colors
BLUE='\033[0;34m'
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Function to print colored messages
print_color() {
printf "${1}${2}${NC}\n"
}
# Clear the screen
clear
print_color "$BLUE" "Welcome to GaiaNet Node Installer"
print_color "$BLUE" "======================================="
echo
# Check and set port
print_color "$BLUE" "Checking if port 8080 is available..."
if lsof -i :8080 > /dev/null 2>&1; then
print_color "$RED" "Port 8080 is currently in use. Please choose a different port."
read -p "Enter a new port: " port
else
port=8080
fi
print_color "$GREEN" "Using port: $port"
echo
# Download and run the official GaiaNet installation script
print_color "$BLUE" "Downloading and running the official GaiaNet installation script..."
curl -sSfL 'https://raw.githubusercontent.com/GaiaNet-AI/gaianet-node/main/install.sh' | bash
# Update port in configuration file
config_file="$HOME/gaianet/config.json"
if [ -f "$config_file" ]; then
print_color "$BLUE" "Updating port in config file..."
sed -i "s/\"llamaedge_port\": \"[0-9]*\"/\"llamaedge_port\": \"$port\"/" "$config_file"
print_color "$GREEN" "Port updated successfully in config file."
else
print_color "$RED" "Config file not found. Please check your installation."
fi
print_color "$GREEN" "GaiaNet installation process completed."
print_color "$BLUE" "Please check the output above for any errors or additional instructions."
# Additional commands with appropriate spacing
source /root/.bashrc
sleep 2
gaianet init
sleep 2
gaianet start
sleep 2
gaianet info
echo
print_color "$GREEN" "╔════════════════════════════════════╗"
print_color "$GREEN" "║ Edited by Onixia ║"
print_color "$GREEN" "╚════════════════════════════════════╝"