-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·110 lines (96 loc) · 3.05 KB
/
install.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
#!/bin/bash -eEu
PYTHON_VERSION=3.6.12
PYTHON_REQUIREMENTS="awscli~=1.18.0 cmd2~=0.9.0 git+git://github.com/arcivanov/docker-squash@docker_rebase git+ssh://[email protected]/Traiana/nex-daemon@develop"
INSTALL_PREREQS=x
INSTALL_ENV=x
for arg in "$@"; do
case "$arg" in
--prereqs-only)
INSTALL_PREREQS=x
INSTALL_ENV=""
;;
--env-only)
INSTALL_PREREQS=""
INSTALL_ENV=x
;;
esac
done
if apt-get --help > /dev/null 2>&1; then
echo "Found APT-based Linux distro"
CMD=apt-get
elif dnf --help > /dev/null 2>&1; then
echo "Found DNF-based Linux distro"
CMD=dnf
elif yum --help > /dev/null 2>&1; then
echo "Found YUM-based Linux distro"
CMD=yum
elif brew --help > /dev/null 2>&1; then
echo "Found Darwin/OSX"
CMD=brew
elif [ "$(uname -s)" == "Darwin" ]; then
echo "Found Darwin/OSX, Installing Homebrew"
CMD=brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
echo "Have no idea what OS I'm running on!" >&2
exit 1
fi
SUDO="sudo"
if [ $(id -u) == "0" ]; then
SUDO=""
fi
if [ -n "$INSTALL_PREREQS" ]; then
if [ "$CMD" == "yum" -o "$CMD" == "dnf" ]; then
# cat > /libs <<EOF
# libev libevent bzip2 xz readline jemalloc c-ares pcre
# EOF
# cat > /devtools <<EOF
# git autoconf automake libtool mercurial wget unix2dos gcc gcc-c++ file findutils diffutils
# unzip patch jemalloc-devel openssl-devel libev-devel c-ares-devel jemalloc-devel libevent-devel
# ruby24 bison zlib-devel bzip2-devel readline-devel sqlite-devel openssl-devel xz-devel
# readline-devel pcre-devel lua-devel systemtap-sdt-devel
# EOF
$SUDO $CMD install -y --skip-broken gcc gcc-c++ git make zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel
if [[ "$(git --version)" == "git version 1"* ]]; then
$SUDO $CMD remove -y git
set +e
curl -Ls https://raw.githubusercontent.com/Traiana/nex-env/master/enable-ius.sh | $SUDO bash
set -e
$SUDO $CMD install -y git2u
fi
fi
if [ "$CMD" == "apt-get" ]; then
$SUDO $CMD update
$SUDO $CMD install -y git make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev
fi
fi
if [ -n "$INSTALL_ENV" ]; then
if [ "$CMD" == "brew" ]; then
brew update
brew install gdbm sqlite xz
if ! brew upgrade pyenv; then
brew install pyenv
brew install pyenv-virtualenv
fi
else
if [ ! -d ~/.pyenv ]; then
curl -Ls "https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer" | bash
fi
$HOME/.pyenv/bin/pyenv update
fi
set +u
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
set -u
pyenv install -s $PYTHON_VERSION
set +u
pyenv virtualenv-delete -f nex || true
pyenv virtualenv -f $PYTHON_VERSION nex
pyenv activate nex
set -u
pip install -U pip setuptools
pip install -U $PYTHON_REQUIREMENTS
fi