-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·142 lines (119 loc) · 5.22 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
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
142
#!/usr/bin/env bash
# Check if running on Linux
if [[ "$(uname -s)" == "Linux" ]]; then
echo -e "\033[1;33m\nRunning on Linux. Proceeding...\n\033[0m"
else
echo -e "\033[1;31m\nOnly Linux Is Supported. Exiting script.\n\033[0m"
exit 1;
fi
echo -e "\033[1;34m\nChecking For Required Binaries\n\033[0m"
if command -v git &> /dev/null; then
echo -e "\033[1;35m\ngit is installed and available on the PATH.\n\033[0m"
else
echo -e "\033[1;31mgit is not installed or not available on the PATH.\033[0m"
echo -e "\033[1;33m sudo apt install -y git \033[0m"
exit 1;
fi
if command -v tar &> /dev/null; then
echo -e "\033[1;35m\ntar is installed and available on the PATH.\n\033[0m"
else
echo -e "\033[1;31mtar is not installed or not available on the PATH.\033[0m"
echo -e "\033[1;33m sudo apt install -y tar \033[0m"
exit 1;
fi
if command -v zip &> /dev/null; then
echo -e "\033[1;35m\nzip is installed and available on the PATH.\n\033[0m"
else
echo -e "\033[1;31mzip is not installed or not available on the PATH.\033[0m"
echo -e "\033[1;33m sudo apt install -y zip unzip \033[0m"
exit 1;
fi
if command -v wget &> /dev/null; then
echo -e "\033[1;35m\nwget is installed and available on the PATH.\n\033[0m"
else
echo -e "\033[1;31mwget is not installed or not available on the PATH.\033[0m"
echo -e "\033[1;33m sudo apt install -y wget \033[0m"
exit 1;
fi
if command -v jq &> /dev/null; then
echo -e "\033[1;35m\njq is installed and available on the PATH.\n\033[0m"
else
echo -e "\033[1;31mjq is not installed or not available on the PATH.\033[0m"
echo -e "\033[1;33m sudo apt install -y jq \033[0m"
exit 1;
fi
if command -v yq &> /dev/null; then
echo -e "\033[1;35m\nyq is installed and available on the PATH.\n\033[0m"
else
echo -e "\033[1;31myq is not installed or not available on the PATH.\033[0m"
echo -e "\033[1;33m sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \033[0m"
echo -e "\033[1;33m sudo chmod a+x /usr/local/bin/yq \033[0m"
exit 1;
fi
if command -v python3 &> /dev/null; then
echo -e "\033[1;35m\npython3 is installed and available on the PATH.\n\033[0m"
else
echo -e "\033[1;31mpython3 is not installed or not available on the PATH.\033[0m"
echo -e "\033[1;33m sudo apt install -y python3 python3-venv \033[0m"
exit 1;
fi
if dpkg -s python3-venv &> /dev/null; then
echo -e "\033[1;35m\npython3-venv is installed.\n\033[0m"
else
echo -e "\033[1;31mpython3-venv is not installed or not available on the PATH.\033[0m"
echo -e "\033[1;33m sudo apt install -y python3-venv \033[0m"
exit 1;
fi
echo -e "\033[1;34m\nSetup Virtual Environment\n\033[0m"
# Create a Python virtual environment
python3 -m venv venv
# Activate the virtual environment
source venv/bin/activate
# Install required Python packages
pip install -r requirements.txt
echo -e "\033[1;34m\nDownloading Required Binaries\n\033[0m"
if [ -x "bin/oura" ]; then
echo -e "\033[1;31mOura Exists!\033[0m"
else
wget -P bin https://github.com/txpipe/oura/releases/download/v1.9.1/oura-x86_64-unknown-linux-gnu.tar.gz
tar -xzf bin/oura-x86_64-unknown-linux-gnu.tar.gz -C bin --wildcards --no-anchored oura
rm bin/oura-x86_64-unknown-linux-gnu.tar.gz
echo -e "\033[1;37mOura: $(./bin/oura --version)\033[0m"
fi
if [ -x "bin/ogmios" ]; then
echo -e "\033[1;31mOgmios Exists!\033[0m"
else
wget -P bin https://github.com/CardanoSolutions/ogmios/releases/download/v6.6.2/ogmios-v6.6.2-x86_64-linux.zip
unzip -j bin/ogmios-v6.6.2-x86_64-linux.zip "bin/ogmios" -d bin
rm bin/ogmios-v6.6.2-x86_64-linux.zip
chmod +x bin/ogmios
echo -e "\033[1;37mOgmios: $(./bin/ogmios --version)\033[0m"
fi
if [ -x "bin/aiken" ]; then
echo -e "\033[1;31mAiken Exists!\033[0m"
else
wget -P bin https://github.com/aiken-lang/aiken/releases/download/v1.1.3/aiken-x86_64-unknown-linux-gnu.tar.gz
tar -xzf bin/aiken-x86_64-unknown-linux-gnu.tar.gz -C bin --strip-components=1 aiken-x86_64-unknown-linux-gnu/aiken
rm bin/aiken-x86_64-unknown-linux-gnu.tar.gz
echo -e "\033[1;37mAiken: $(./bin/aiken --version)\033[0m"
fi
if [ -x "bin/cardano-cli" ]; then
echo -e "\033[1;31mCli Exists!\033[0m"
else
wget -P bin https://github.com/IntersectMBO/cardano-cli/releases/download/cardano-cli-9.4.1.0/cardano-cli-9.4.1.0-x86_64-linux.tar.gz
tar -xzf bin/cardano-cli-9.4.1.0-x86_64-linux.tar.gz -C bin
chmod +x bin/cardano-cli-x86_64-linux
mv bin/cardano-cli-x86_64-linux ./bin/cardano-cli
rm bin/cardano-cli-9.4.1.0-x86_64-linux.tar.gz
echo -e "\033[1;37mCardano CLI: $(./bin/cardano-cli --version)\033[0m"
fi
if [ -x "bin/cardano-address" ]; then
echo -e "\033[1;31mAddr Exists!\033[0m"
else
wget -P bin https://github.com/IntersectMBO/cardano-addresses/releases/download/3.12.0/cardano-addresses-3.12.0-linux64.tar.gz
tar -xzf bin/cardano-addresses-3.12.0-linux64.tar.gz -C bin --strip-components=1 bin/cardano-address
rm bin/cardano-addresses-3.12.0-linux64.tar.gz
chmod +x bin/cardano-address
echo -e "\033[1;37mCardano Address: $(./bin/cardano-address --version)\033[0m"
fi
echo -e "\033[1;36m\nCreate The Batcher and Collateral Keys Then Update The config.yaml File\n\033[0m"