-
Notifications
You must be signed in to change notification settings - Fork 26
/
.envrc
127 lines (96 loc) · 2.5 KB
/
.envrc
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
direnv_version_major=$(direnv version | cut -d "." -f1 | tr -d '\n')
direnv_version_minor=$(direnv version | cut -d "." -f2 | tr -d '\n')
if [[ $direnv_version_major -lt 2 ]] || [[ $direnv_version_major -eq 2 ]] && [[ $direnv_version_minor -lt 32 ]]; then
echo -e "\033[31munsupported direnv version $(direnv version) < 2.32.x"
exit 1
fi
if [[ "$SHELL" == "bash" ]]; then
if [ "${BASH_VERSINFO:-0}" -lt 4 ]; then
echo -e "\033[31mthe environment needs BASH 4 or above" >&2
exit 1
fi
fi
AP_ROOT=$(pwd)
export AP_ROOT
dotenv
dotenv_if_exists dev.env
path="$AP_DEVCACHE_NODE_BIN:$AP_DEVCACHE_BIN"
if ! has make; then
echo -e "\033[31mmake is not installed"
exit 1
fi
if ! has go; then
echo -e "\033[31mgo is not installed"
exit 1
fi
if ! has kind; then
echo "kind is not installed. dev environment will try to install it"
fi
if ! has unzip; then
echo -e "\033[31munzip is not installed"
exit 1
fi
if ! has wget; then
echo -e "\033[31mwget is not installed"
exit 1
fi
if ! has curl; then
echo -e "\033[31mcurl is not installed"
exit 1
fi
if ! has npm; then
echo -e "\033[31mnpm is not installed"
exit 1
fi
if ! has jq; then
echo -e "\033[31mjq is not installed"
exit 1
fi
if ! has readlink; then
echo -e "\033[31mreadlink is not installed"
exit 1
fi
TOOLS=${AP_ROOT}/script/tools.sh
SEMVER=${AP_ROOT}/script/semver.sh
GOTOOLCHAIN=$(${TOOLS} gotoolchain)
GOTOOLCHAIN_SEMVER=$(echo "${GOTOOLCHAIN}" | sed 's/go*/v/' | tr -d '\n')
GOVERSION=$(${TOOLS} goversion)
GOVERSION_SEMVER=$(echo "${GOVERSION}" | sed 's/go*/v/' | tr -d '\n')
AKASH_DIRENV_SET=1
if [[ "$OSTYPE" == "darwin"* ]]; then
# on MacOS disable deprecation warnings security framework
CGO_CFLAGS=-Wno-deprecated-declarations
export CGO_CFLAGS
if ! has brew; then
echo -e "\033[31mhomebrew is not installed. visit https://brew.sh"
exit 1
fi
if [[ -z $HOMEBREW_PREFIX ]]; then
HOMEBREW_PREFIX=$(brew --prefix)
fi
# don't use brew list, as it is utterly slow
getopt_bin=${HOMEBREW_PREFIX}/opt/gnu-getopt/bin
if [ ! -d "$getopt_bin" ]; then
echo -e "\033[31mgnu-getopt is not installed. to install \"brew install gnu-getopt\""
exit 1
else
path=$path:"$getopt_bin"
fi
fi
if [[ -z "$GOPATH" ]]; then
GOPATH=$(go env GOPATH)
export GOPATH
fi
PATH_add "$path"
PROVIDER_SERVICES=$AP_DEVCACHE_BIN/provider-services
AKASH=$AP_DEVCACHE_BIN/akash
export SEMVER
export GOTOOLCHAIN
export GOTOOLCHAIN_SEMVER
export GOVERSION
export GOVERSION_SEMVER
PATH_add "$path"
export AKASH_DIRENV_SET
export PROVIDER_SERVICES
export AKASH
make cache