forked from voxel51/fiftyone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.bash
126 lines (112 loc) · 3.05 KB
/
install.bash
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
#!/bin/bash
# Installs the `fiftyone` package and its dependencies.
#
# Usage:
# bash install.bash
#
# Copyright 2017-2020, Voxel51, Inc.
# voxel51.com
#
# Show usage information
usage() {
echo "Usage: bash $0 [-h] [-d]
Getting help:
-h Display this help message.
Custom installations:
-d Install developer dependencies. The default is false.
"
}
# Parse flags
SHOW_HELP=false
DEV_INSTALL=false
while getopts "hd" FLAG; do
case "${FLAG}" in
h) SHOW_HELP=true ;;
d) DEV_INSTALL=true ;;
*) usage ;;
esac
done
[ ${SHOW_HELP} = true ] && usage && exit 0
set -e
OS=$(uname -s)
echo "***** INSTALLING ETA *****"
if [[ ! -d "eta" ]]; then
echo "Cloning ETA repository"
git clone https://github.com/voxel51/eta
fi
cd eta
git checkout develop
git pull
pip install -e .
if [[ ! -f eta/config.json ]]; then
echo "Installing default ETA config"
cp config-example.json eta/config.json
fi
cd ..
echo "***** INSTALLING PLAYER51 *****"
git submodule update --init
echo "***** INSTALLING MONGODB *****"
mkdir -p ~/.fiftyone/bin
cd ~/.fiftyone
mkdir -p var/lib/mongo
INSTALL_MONGODB=true
if [ -x bin/mongod ]; then
VERSION_FULL=$(bin/mongod --version | grep 'db version')
VERSION="${VERSION_FULL:12}"
if [ ${VERSION} != "4.4.2" ]; then
echo "Upgrading MongoDB v${VERSION} to v4.4.2"
else
echo "MongoDB v4.4.2 already installed"
INSTALL_MONGODB=false
fi
else
echo "Installing MongoDB v4.4.2"
fi
if [ ${INSTALL_MONGODB} = true ]; then
if [ "${OS}" == "Darwin" ]; then
MONGODB_BUILD=mongodb-macos-x86_64-4.4.2
curl https://fastdl.mongodb.org/osx/${MONGODB_BUILD}.tgz --output mongodb.tgz
tar -zxvf mongodb.tgz
mv ${MONGODB_BUILD}/bin/* ./bin/
rm mongodb.tgz
rm -rf ${MONGODB_BUILD}
elif [ "${OS}" == "Linux" ]; then
MONGODB_BUILD=mongodb-linux-x86_64-ubuntu1804-4.4.2
curl https://fastdl.mongodb.org/linux/${MONGODB_BUILD}.tgz --output mongodb.tgz
tar -zxvf mongodb.tgz
mv ${MONGODB_BUILD}/bin/* ./bin/
rm mongodb.tgz
rm -rf ${MONGODB_BUILD}
else
echo "WARNING: unsupported OS, skipping MongoDB installation"
fi
fi
cd -
echo "***** INSTALLING FIFTYONE *****"
if [ ${DEV_INSTALL} = true ]; then
echo "Performing dev install"
pip install -r requirements/dev.txt
pre-commit install
else
pip install -r requirements.txt
fi
pip install -e .
echo "***** INSTALLING APP *****"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm install v12.16.2
nvm use v12.16.2
npm -g install yarn
if [ -f ~/.bashrc ]; then
source ~/.bashrc
elif [ -f ~/.bash_profile ]; then
source ~/.bash_profile
else
echo "WARNING: unable to locate a bash profile to 'source'; you may need to start a new shell"
fi
cd app
yarn
yarn build-web
cd ..
echo "***** INSTALLATION COMPLETE *****"