This repository was archived by the owner on Jul 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.envrc
More file actions
72 lines (58 loc) · 1.64 KB
/
.envrc
File metadata and controls
72 lines (58 loc) · 1.64 KB
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
ETCD_VER=v3.3.12
GOREMAN_VER=v0.0.10
# choose either URL
ETCD_GITHUB_URL=https://github.com/etcd-io/etcd/releases/download
GOREMAN_GITHUB_URL=https://github.com/mattn/goreman/releases/download
# If bin folder does not exist create it
if [ ! -d ${PWD}/bin ]; then
mkdir -p ${PWD}/bin;
fi
# if etcd does not exist download it
function download_etcd {
if [ ! -f bin/etcd ]
then
if [ ! -d ${PWD}/tmp ]; then
mkdir -p ${PWD}/tmp;
fi
##
# Download etcd
curl -sLo ${PWD}/tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz ${ETCD_GITHUB_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz
tar xzvf ${PWD}/tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C ${PWD}/bin/ --strip-components=1 --exclude='Documentation' --exclude='*.md'
# cleanup tmp
rm -f ${PWD}/tmp/
fi
}
# if goreman does not exist download it
function download_goreman {
if [ ! -f bin/goreman ]
then
create_tmp
##
# Download goreman
curl -sLo ${PWD}/tmp/goreman_linux_amd64.zip ${GOREMAN_GITHUB_URL}/${GOREMAN_VER}/goreman_linux_amd64.zip
unzip ${PWD}/tmp/goreman_linux_amd64.zip -d ${PWD}/bin
# cleanup goreman
rm ${PWD}/tmp/goreman_linux_amd64.zip
fi
}
# clean-up function
function cleanup {
rm -rf ${PWD}/infra* ${PWD}/tmp ${PWD}/default.etcd
}
# if PWD/tmp dir does not exist create it
function create_tmp {
[[ -d ${PWD}/tmp ]] || mkdir ${PWD}/tmp
}
case "$OSTYPE" in
linux*)
download_etcd
download_goreman
cleanup
;;
*)
echo "unsupported OS : $OSTYPE"
;;
esac
export HostIP=$(hostname -I | awk '{ print $1 }')
# set env PATH
export PATH="${PATH}:${PWD}/bin"