-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·141 lines (119 loc) · 4.42 KB
/
install.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/bash
# Check if the directory already exists
if [ -d "$HOME/telliot-feeds-alt" ]; then
echo "The folder 'telliot-feeds-alt' already exists. Please remove or rename it to save old configs."
exit 1
fi
echo
echo " ╔═════════════════════════════════════════════════════════════════════════╗"
echo " ║ This script will install Python, Telliot-feeds-alt and Telliot-core-alt ║"
echo " ║ (Optionally you can also choose to install DVM-alt) ║"
echo " ╚═════════════════════════════════════════════════════════════════════════╝"
echo "If installing in your main machine, please read the install.sh before install!"
echo
cd "$HOME/"
echo "Choose the environment to clone and install: "
echo "1 - Testnet/Main (Default)"
echo "2 - Staging (QA tests only)"
echo
read -p "Enter 1-testnet or 2-staging: " environment_choice
case $environment_choice in
1)
branch="testnet"
;;
2)
branch="staging"
;;
*)
echo "Invalid choice. Please enter 1 for testnet/main or 2 for staging."
exit 1
;;
esac
echo "You entered: $branch"
echo
read -p "Do you want to install DVM (Disputable Values Monitor), too? " install_dvm
# Treat empty response (just pressing Enter) as "yes"
install_dvm=${install_dvm:-yes}
case $install_dvm in
[Yy][Ee][Ss]|[Yy]) # Matches yes, Yes, YES, y, or Y
dvm="yes"
echo "Will install Telliot and DVM."
;;
[Nn][Oo]|[Nn]) # Matches no, No, NO, n, or N
dvm="no"
echo "Installing only Telliot."
;;
*)
echo "Invalid choice. Please enter 'y' or 'n'."
exit 1
;;
esac
echo "Cloning branch: $branch"
echo
# Clone the repository with the selected branch
echo "Cloning telliot-feeds-alt..."
git clone -b "$branch" https://github.com/fetchoracle/telliot-feeds-alt.git
if [ $? -eq 0 ]; then
echo "Telliot-feeds cloned successfully."
else
echo "Failed to clone telliot-feeds."
exit 1
fi
echo
echo "Moving to telliot-feeds folder..."
cd "$HOME/telliot-feeds-alt" || { echo "Failed to change directory. Make sure to install it from HOME."; exit 1; }
echo
echo "Installing Python 3.9 and venv..."
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install -y python3.9 python3.9-venv #python3-pip
# Create and activate the virtual environment
echo
echo "Creating and entering virtual environment..."
python3.9 -m venv venv
source venv/bin/activate
echo
echo "Installing telliot feeds"
pip install -e .
echo
echo "Cloning telliot-core-alt..."
git clone -b "$branch" https://github.com/fetchoracle/telliot-core-alt.git
if [ $? -eq 0 ]; then
echo "Telliot-core cloned successfully."
else
echo "Failed to clone telliot-core."
exit 1
fi
echo
echo "Moving to telliot-core folder..."
cd "$HOME/telliot-feeds-alt/telliot-core-alt" || { echo "Failed to change directory."; exit 1; }
echo
echo "Installing telliot core"
pip install -e .
telliot config init
cd "$HOME/telliot-feeds-alt/" || { echo "Failed to change directory."; exit 1; }
if [ "$dvm" = "yes" ]; then
echo
echo "Cloning DVM-alt..."
git clone -b "$branch" https://github.com/fetchoracle/disputable-values-monitor-alt.git
if [ $? -eq 0 ]; then
echo "DVM cloned successfully."
else
echo "Failed to clone DVM."
exit 1
fi
echo
echo "Moving to DVM folder..."
cd "$HOME/telliot-feeds-alt/disputable-values-monitor-alt" || { echo "Failed to change directory."; exit 1; }
echo
echo "Installing DVM"
pip install -e .
fi
echo
echo "╔══════════════════════════════════════════════════════════════════════════╗"
echo "║Installation complete! Confirm you're inside venv before running anything.║"
if [ "$dvm" = "yes" ]; then
echo "║ To run the DVM: ║"
echo "║Always run 'source vars.sh' from DVM folder to load the Discord variables ║"
fi
echo "╚══════════════════════════════════════════════════════════════════════════╝"
exit 0