forked from crypto-org-chain/cronos
-
Notifications
You must be signed in to change notification settings - Fork 3
/
dependencies.sh
36 lines (30 loc) · 1.08 KB
/
dependencies.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
#!/bin/bash
# Helper-function: adds a line to a file if it doesn't already exist (to prevent duplicates)
add_line_to_file() {
local line="$1"
local file="$2"
local use_sudo="$3"
if ! grep -qF "$line" "$file"; then
if $use_sudo; then
echo "$line" | sudo tee -a "$file" > /dev/null
else
echo "$line" >> "$file"
fi
echo "Line '$line' added to $file."
else
echo "Line '$line' already exists in $file."
fi
}
# System update and installation of dependencies
sudo apt-get update -y
sudo apt-get install jq git wget make gcc build-essential snapd -y
snap install go --channel=1.20/stable --classic
snap refresh go --channel=1.20/stable --classic
# Add GOPATH
export PATH=$PATH:$(go env GOPATH)/bin
add_line_to_file 'export PATH=$PATH:$(go env GOPATH)/bin' ~/.bashrc false
# Global change of open file limits
add_line_to_file "* - nofile 50000" /etc/security/limits.conf false
add_line_to_file "root - nofile 50000" /etc/security/limits.conf false
add_line_to_file "fs.file-max = 50000" /etc/sysctl.conf false
ulimit -n 50000