forked from commaai/openpilot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ubuntu_setup.sh
executable file
·155 lines (140 loc) · 3.38 KB
/
ubuntu_setup.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
#!/bin/bash -e
OP_ROOT=$(git rev-parse --show-toplevel)
# Install packages present in all supported versions of Ubuntu
function install_ubuntu_common_requirements() {
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
autoconf \
build-essential \
clang \
cmake \
make \
cppcheck \
libtool \
libstdc++-arm-none-eabi-newlib \
gcc-arm-none-eabi \
bzip2 \
liblzma-dev \
libarchive-dev \
libbz2-dev \
capnproto \
libcapnp-dev \
curl \
libcurl4-openssl-dev \
wget \
git \
git-lfs \
ffmpeg \
libavformat-dev \
libavcodec-dev \
libavdevice-dev \
libavutil-dev \
libavfilter-dev \
libeigen3-dev \
libffi-dev \
libglew-dev \
libgles2-mesa-dev \
libglfw3-dev \
libglib2.0-0 \
libomp-dev \
libopencv-dev \
libpng16-16 \
libssl-dev \
libsqlite3-dev \
libusb-1.0-0-dev \
libzmq3-dev \
libsdl1.2-dev \
libsdl-image1.2-dev \
libsdl-mixer1.2-dev \
libsdl-ttf2.0-dev \
libsmpeg-dev \
libportmidi-dev \
libfreetype6-dev \
libsystemd-dev \
locales \
opencl-headers \
ocl-icd-libopencl1 \
ocl-icd-opencl-dev \
clinfo \
python-dev \
python3-pip \
qml-module-qtquick2 \
qtmultimedia5-dev \
qtwebengine5-dev \
qtlocation5-dev \
qtpositioning5-dev \
libqt5sql5-sqlite \
libqt5svg5-dev \
libqt5x11extras5-dev \
libreadline-dev \
libdw1
}
# Install Ubuntu 21.10 packages
function install_ubuntu_latest_requirements() {
install_ubuntu_common_requirements
sudo apt-get install -y --no-install-recommends \
qtbase5-dev \
qtchooser \
qt5-qmake \
qtbase5-dev-tools
}
# Install Ubuntu 20.04 packages
function install_ubuntu_lts_requirements() {
install_ubuntu_common_requirements
sudo apt-get install -y --no-install-recommends \
libavresample-dev \
qt5-default
}
# Detect OS using /etc/os-release file
if [ -f "/etc/os-release" ]; then
source /etc/os-release
case "$ID $VERSION_ID" in
"ubuntu 21.10")
install_ubuntu_latest_requirements
;;
"ubuntu 20.04")
install_ubuntu_lts_requirements
;;
*)
echo "$ID $VERSION_ID is unsupported. This setup script is written for Ubuntu 20.04."
read -p "Would you like to attempt installation anyway? " -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
install_ubuntu_lts_requirements
esac
else
echo "No /etc/os-release in the system"
exit 1
fi
# install pyenv
if ! command -v "pyenv" > /dev/null 2>&1; then
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
fi
# in the openpilot repo
cd $OP_ROOT
source ~/.bashrc
if [ -z "$OPENPILOT_ENV" ]; then
printf "\nsource %s/tools/openpilot_env.sh" "$OP_ROOT" >> ~/.bashrc
source ~/.bashrc
echo "added openpilot_env to bashrc"
fi
# do the rest of the git checkout
git lfs pull
git submodule init
git submodule update
# install python
PYENV_PYTHON_VERSION=$(cat $OP_ROOT/.python-version)
PATH=$HOME/.pyenv/bin:$HOME/.pyenv/shims:$PATH
pyenv install -s ${PYENV_PYTHON_VERSION}
pyenv rehash
eval "$(pyenv init -)"
# **** in python env ****
pip install pip==21.3.1
pip install pipenv==2021.5.29
pipenv install --dev --deploy
echo
echo "---- FINISH OPENPILOT SETUP ----"
echo "Configure your active shell env by running:"
echo "source ~/.bashrc"