forked from lukasloetkolben/openpilot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_ubuntu_dependencies.sh
executable file
·171 lines (161 loc) · 4.07 KB
/
install_ubuntu_dependencies.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
#!/usr/bin/env bash
set -e
SUDO=""
# Use sudo if not root
if [[ ! $(id -u) -eq 0 ]]; then
if [[ -z $(which sudo) ]]; then
echo "Please install sudo or run as root"
exit 1
fi
SUDO="sudo"
fi
# Install common packages
function install_ubuntu_common_requirements() {
$SUDO apt-get update
$SUDO apt-get install -y --no-install-recommends \
ca-certificates \
clang \
cppcheck \
build-essential \
gcc-arm-none-eabi \
liblzma-dev \
capnproto \
libcapnp-dev \
curl \
libcurl4-openssl-dev \
git \
git-lfs \
ffmpeg \
libavformat-dev \
libavcodec-dev \
libavdevice-dev \
libavutil-dev \
libavfilter-dev \
libbz2-dev \
libeigen3-dev \
libffi-dev \
libglew-dev \
libgles2-mesa-dev \
libglfw3-dev \
libglib2.0-0 \
libqt5charts5-dev \
libncurses5-dev \
libssl-dev \
libusb-1.0-0-dev \
libzmq3-dev \
libsqlite3-dev \
libsystemd-dev \
locales \
opencl-headers \
ocl-icd-libopencl1 \
ocl-icd-opencl-dev \
portaudio19-dev \
qtmultimedia5-dev \
qtlocation5-dev \
qtpositioning5-dev \
qttools5-dev-tools \
libqt5svg5-dev \
libqt5serialbus5-dev \
libqt5x11extras5-dev \
libqt5opengl5-dev
}
# Install extra packages
function install_extra_packages() {
echo "Installing extra packages..."
$SUDO apt-get install -y --no-install-recommends \
casync \
cmake \
make \
clinfo \
libqt5sql5-sqlite \
libreadline-dev \
libdw1 \
autoconf \
libtool \
bzip2 \
libarchive-dev \
libncursesw5-dev \
libportaudio2 \
locales
}
# Install Ubuntu 24.04 LTS packages
function install_ubuntu_lts_latest_requirements() {
install_ubuntu_common_requirements
$SUDO apt-get install -y --no-install-recommends \
g++-12 \
qtbase5-dev \
qtchooser \
qt5-qmake \
qtbase5-dev-tools \
python3-dev
}
# Install Ubuntu 20.04 packages
function install_ubuntu_focal_requirements() {
install_ubuntu_common_requirements
install_deadsnakes_ppa
$SUDO apt-get install -y --no-install-recommends \
libavresample-dev \
qt5-default \
python-dev
}
# Remove once on Ubuntu 24.04
function install_deadsnakes_ppa(){
if [[ -z "$INSTALL_DEADSNAKES_PPA" ]]; then
read -p "Do you want to use deadsnakes python@3.11? [Y/n]: " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
INSTALL_DEADSNAKES_PPA="yes"
export VIRTUAL_ENV_ROOT=".venv"
fi
fi
if [[ "$INSTALL_DEADSNAKES_PPA" == "yes" ]]; then
$SUDO apt-get install software-properties-common -y --no-install-recommends
$SUDO add-apt-repository ppa:deadsnakes/ppa
$SUDO apt-get install -y --no-install-recommends \
python3.11-dev \
python3.11 \
python3.11-venv \
python3.11-distutils \
python3-pip
$SUDO update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 20
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11
fi
}
# Detect OS using /etc/os-release file
if [ -f "/etc/os-release" ]; then
source /etc/os-release
case "$VERSION_CODENAME" in
"jammy" | "kinetic" | "noble")
install_ubuntu_lts_latest_requirements
;;
"focal")
install_ubuntu_focal_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
if [ "$UBUNTU_CODENAME" = "focal" ]; then
install_ubuntu_focal_requirements
else
install_ubuntu_lts_latest_requirements
fi
esac
# Install extra packages
if [[ -z "$INSTALL_EXTRA_PACKAGES" ]]; then
read -p "Base setup done. Do you want to install extra development packages? [Y/n]: " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
INSTALL_EXTRA_PACKAGES="yes"
fi
fi
if [[ "$INSTALL_EXTRA_PACKAGES" == "yes" ]]; then
install_extra_packages
fi
else
echo "No /etc/os-release in the system. Make sure you're running on Ubuntu, or similar."
exit 1
fi