-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
58 lines (50 loc) · 1.44 KB
/
setup.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
#!/bin/bash
# Check if ta-lib is already installed
if [ -d "/usr/local/lib/ta-lib" ]; then
echo "ta-lib is already installed, skipping installation"
exit 0
fi
# Check if a C compiler is already installed
if command -v gcc &> /dev/null; then
echo "C compiler is already installed, skipping installation"
else
echo "Installing GCC..."
sudo apt-get update
sudo apt-get install -y build-essential
fi
# Install Python3 development headers
sudo apt-get install libpython3-dev
# prompt if user wants to reinstall
echo "Do you want to reinstall ta-lib? (y/n)"
read answer
if [ "$answer" == "y" ]; then
# uninstall ta-lib
sudo rm -rf /usr/local/lib/ta-lib
sudo rm -rf /usr/local/include/ta-lib
sudo rm -rf /usr/local/bin/ta-lib-config
fi
# Configure TA-Lib and make only if not already installed
if [ -d "/usr/local/lib/ta-lib" ]; then
echo "ta-lib is already installed, skipping installation"
else
# Download and extract the tarball
if [ -f "ta-lib-0.4.0-src.tar.gz" ]; then
echo "ta-lib tarball is already downloaded, skipping download"
else
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
fi
if [ -d "ta-lib" ]; then
echo "ta-lib is already extracted, skipping extraction"
else
tar -xzf ta-lib-0.4.0-src.tar.gz
fi
# Install TA-Lib
echo "Installing ta-lib..."
cd ta-lib
./configure --prefix=/usr/local
make
sudo make install
cd ..
rm -rf ta-lib
rm ta-lib-0.4.0-src.tar.gz
fi