-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstaller.sh
202 lines (192 loc) · 6.62 KB
/
installer.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
get_auth () {
INSTALL=0
DEFAULT="no"
echo -n "$1 [yes|no]
[$DEFAULT] >>> "
read -r ans
if [[ $ans == "" ]]; then
ans=$DEFAULT
fi
if [[ ($ans != "yes") && ($ans != "Yes") && ($ans != "YES") && ($ans != "y") && ($ans != "Y")]]; then
echo "Skipping..."
INSTALL=0
else
INSTALL=1
fi
}
dwldata () {
get_auth "Download data to the current directory?"
if [[ $INSTALL == 1 ]]; then
curl -O http://83.169.39.135/ssd_detectors/ssd512_voc_weights_fixed.zip
curl -O http://83.169.39.135/ssd_detectors/ssd300_voc_weights_fixed.zip
curl -O https://s3.amazonaws.com/herox-alphapilot/Data_LeaderboardTesting.zip
curl -O https://s3.amazonaws.com/herox-alphapilot/Data_Training.zip
curl -O https://d253pvgap36xx8.cloudfront.net/challenges/resources/f1e5a35031ae11e9a27e0242ac110002/training_GT_labels.json
fi
}
mountdata () {
get_auth "Mount external disk on /data?"
if [[ $INSTALL == 1 ]]; then
NAME=`lsblk | grep 100G | cut -d ' ' -f 1`
if [ -d "/data" ]; then
sudo mkdir /data
fi
sudo mount /dev/$NAME /data
fi
}
pyinstall () {
# Python 3.7
get_auth "Download and install Python3.7?"
if [[ $INSTALL == 1 ]]; then
# Step 1 – Requirements
sudo apt-get -y install gcc openssl-devel bzip2-devel
sudo apt-get install libffi-devel
# Step 2 – Download Python 3.7
cd /usr/src ; sudo wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz ; \
sudo tar xzf Python-3.7.2.tgz
# Step 3 – Install Python 3.7
cd /usr/src/Python-3.7.2 ; sudo ./configure --enable-optimizations ; \
sudo make altinstall
# Step 4 – Check Python Version
sudo rm /usr/src/Python-3.7.2.tgz
fi
# Install Miniconda3
get_auth "Download and install Miniconda3?"
if [[ $INSTALL == 1 ]]; then
sudo apt-get -y install zip
# Download and install
wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \
-O /tmp/miniconda.sh
bash /tmp/miniconda.sh -b -p $HOME/anaconda
# Exports
export PATH=$HOME/anaconda/bin:$PATH # add to PATH
echo 'export PATH=$HOME/anaconda/bin:$PATH' >> ~/.bashrc # add to bashrc for future use
hash -r
# some configuration to make it easy to install things
conda config --set always_yes yes --set changeps1 no
conda update -q conda
# add channels to look for packages
conda config --add channels r # for backward compatibility with old r packages
conda config --add channels defaults
conda config --add channels conda-forge # additional common tools
conda config --add channels bioconda # useful bioinformatics
# Installs of conda
conda install -n root _license
# display info
conda info -a
fi
}
rosinstall () {
echo -n "Which terminal are you using on this device?"
DEFAULT="bash"
echo -n " [zsh|bash]
[$DEFAULT] >>>"
read -r term
if [[ $term == "zsh" ]]; then
rc="zshrc"
else
term=$DEFAULT
rc="bashrc"
fi
# ROS Préinstalls
get_auth "Download and install ROS préinstalls?"
if [[ $INSTALL == 1 ]]; then
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
sudo apt-get update
sudo apt-get install ros-kinetic-desktop-full
sudo rosdep init
rosdep update
echo "source /opt/ros/kinetic/setup.$term" >> ~/.$rc
source ~/.$rc
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
sudo apt-get install python-catkin-tools
sudo apt install python-wstool
pip install catkin_pkg
echo "
Préinstall done...
"
fi
# ROS Préinstalls
get_auth "Download and install ROS?"
if [[ $INSTALL == 1 ]]; then
# Setup catkin workspace
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/ ; catkin init
# Add workspace to bashrc.
echo "source ~/catkin_ws/devel/setup.$term" >> ~/.$rc
cd ~/catkin_ws/src ; wstool init
# Install FlightGoggles nodes and deps from rosinstall file
cd ~/catkin_ws/src ; wstool merge https://raw.githubusercontent.com/mit-fast/FlightGoggles/master/flightgoggles.rosinstall
cd ~/catkin_ws/src ; wstool update
# Install required libraries.
cd ~/catkin_ws/ ; rosdep install --from-paths src --ignore-src --rosdistro kinetic -y
# Install external libraries for flightgoggles_ros_bridge
sudo apt install -y libzmqpp-dev libeigen3-dev
# Install dependencies for flightgoggles renderer
sudo apt install -y libvulkan1 mesa-vulkan-drivers vulkan-utils
# Build nodes
cd ~/catkin_ws/ ; catkin build
# Refresh workspace
source ~/.$rc
echo "
Install done...
"
fi
}
lfsinstall () {
get_auth "Download and install git-lfs?"
if [[ $INSTALL == 1 ]]; then
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
git lfs install
fi
}
pipinstall () {
get_auth "Install AlphaPilot requirements?"
if [[ $INSTALL == 1 ]]; then
pip install -r requirements.txt
fi
}
while true;
do
COLUMNS=0
PS3='Choose an option: '
options=("Download data" "Mount" "PYinstall" "ROSinstall" "LFSinstall" "PIPinstall" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Download data")
# echo "Download data"
dwldata; break ;;
"Mount")
# echo "Mount disk"
mountdata; break ;;
"PYinstall")
# echo "Python installer"
pyinstall; break ;;
"ROSinstall")
# echo "ROS installer"
rosinstall; break ;;
"LFSinstall")
# echo "Git-LFS installer"
lfsinstall; break ;;
"PIPinstall")
# echo "Pip requirements installer"
pipinstall; break ;;
"Quit")
break 2 ;;
*) echo "invalid option $REPLY" >&2
esac
done
echo "Are we done?"
PS3='>>> '
select opt in "Yes" "No"
do
case $REPLY in
1) break 2 ;;
2) break ;;
*) echo "Enter 1 (Yes) OR 2 (No)." >&2
esac
done
done