forked from ArduPilot/ardupilot_wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sphinxsetup.sh
executable file
·54 lines (43 loc) · 1.48 KB
/
Sphinxsetup.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
#!/bin/bash
set -e
set -x
if [ "$UID" -eq 0 ]; then
echo "Sorry, this script must NOT be run as ROOT!"
exit 1
fi
DISTRIBUTION_ID=$(lsb_release -i -s)
if [ ${DISTRIBUTION_ID} = 'Ubuntu' ]; then
DISTRIBUTION_CODENAME=$(lsb_release -c -s)
if [ ${DISTRIBUTION_CODENAME} = 'focal' ] || [ ${DISTRIBUTION_CODENAME} = 'bionic' ]; then
sudo add-apt-repository universe
fi
fi
sudo apt-get -y update
sudo apt-get install -y unzip git imagemagick curl wget make python3
# Install packages release specific
if [ ${DISTRIBUTION_CODENAME} = 'bionic' ]; then
sudo apt-get install -y python3-distutils
fi
# For WSL (esp. version 2) make DISPLAY empty to allow pip to run
STORED_DISPLAY_VALUE=$DISPLAY
if grep -qi -E '(Microsoft|WSL)' /proc/version; then
echo "Temporarily clearing the DISPLAY variable because this is WSL"
export DISPLAY=
fi
# Get pip through the official website to get the latest release
GET_PIP_URL="https://bootstrap.pypa.io/get-pip.py"
# accomodate default Python on bionic:
if [ "$(python --version)" == "Python 3.6.9" ]; then
GET_PIP_URL="https://bootstrap.pypa.io/pip/3.6/get-pip.py"
fi
curl "$GET_PIP_URL" -o get-pip.py
python3 get-pip.py
rm -f get-pip.py
# Install required python packages
python3 -m pip install --user --upgrade -r requirements.txt
# Reset the value of DISPLAY
if grep -qi -E '(Microsoft|WSL)' /proc/version; then
echo "Returning DISPLAY to the previous value in WSL"
export DISPLAY=$STORED_DISPLAY_VALUE
fi
echo "Setup completed successfully!"