2013-04-04 14:52:39 -03:00
|
|
|
#!/bin/bash
|
2018-03-01 20:24:06 -04:00
|
|
|
echo "---------- $0 start ----------"
|
2013-04-04 14:52:39 -03:00
|
|
|
set -e
|
2016-11-03 08:09:41 -03:00
|
|
|
set -x
|
2013-04-04 14:52:39 -03:00
|
|
|
|
2019-11-29 17:44:02 -04:00
|
|
|
if [ $EUID == 0 ]; then
|
|
|
|
echo "Please do not run this script as root; don't sudo it!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-07-06 02:40:39 -03:00
|
|
|
OPT="/opt"
|
2020-03-29 11:57:48 -03:00
|
|
|
# Ardupilot Tools
|
|
|
|
ARDUPILOT_TOOLS="Tools/autotest"
|
|
|
|
|
|
|
|
ASSUME_YES=false
|
|
|
|
QUIET=false
|
|
|
|
sep="##############################################"
|
|
|
|
|
|
|
|
OPTIND=1 # Reset in case getopts has been used previously in the shell.
|
|
|
|
while getopts "yq" opt; do
|
|
|
|
case "$opt" in
|
|
|
|
\?)
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
y) ASSUME_YES=true
|
|
|
|
;;
|
|
|
|
q) QUIET=true
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
APT_GET="sudo apt-get"
|
|
|
|
if $ASSUME_YES; then
|
|
|
|
APT_GET="$APT_GET --assume-yes"
|
|
|
|
fi
|
|
|
|
if $QUIET; then
|
|
|
|
APT_GET="$APT_GET -qq"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# update apt package list
|
|
|
|
$APT_GET update
|
|
|
|
|
2020-05-23 12:40:50 -03:00
|
|
|
function package_is_installed() {
|
2020-06-03 13:53:35 -03:00
|
|
|
dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed"
|
2020-05-23 12:40:50 -03:00
|
|
|
}
|
|
|
|
|
2020-11-24 18:18:19 -04:00
|
|
|
function heading() {
|
2020-03-29 11:57:48 -03:00
|
|
|
echo "$sep"
|
2020-11-24 18:18:19 -04:00
|
|
|
echo $*
|
2020-03-29 11:57:48 -03:00
|
|
|
echo "$sep"
|
2020-11-24 18:18:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
# Install lsb-release as it is needed to check Ubuntu version
|
2021-01-21 10:15:12 -04:00
|
|
|
if ! package_is_installed "lsb-release"; then
|
2020-11-24 18:18:19 -04:00
|
|
|
heading "Installing lsb-release"
|
2020-03-29 11:57:48 -03:00
|
|
|
$APT_GET install lsb-release
|
|
|
|
echo "Done!"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Checking Ubuntu release to adapt software version to install
|
2020-01-14 19:39:11 -04:00
|
|
|
RELEASE_CODENAME=$(lsb_release -c -s)
|
2022-10-27 08:42:45 -03:00
|
|
|
|
|
|
|
# translate Mint-codenames to Ubuntu-codenames based on https://www.linuxmint.com/download_all.php
|
|
|
|
case ${RELEASE_CODENAME} in
|
|
|
|
vanessa)
|
|
|
|
RELEASE_CODENAME='jammy'
|
|
|
|
;;
|
2023-03-20 16:56:13 -03:00
|
|
|
una | uma | ulyssa | ulyana | jolnir)
|
2022-10-27 08:42:45 -03:00
|
|
|
RELEASE_CODENAME='focal'
|
|
|
|
;;
|
|
|
|
tricia | tina | tessa | tara)
|
|
|
|
RELEASE_CODENAME='bionic'
|
|
|
|
;;
|
|
|
|
elsie)
|
|
|
|
RELEASE_CODENAME='bullseye'
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2022-03-10 18:04:30 -04:00
|
|
|
PYTHON_V="python3" # starting from ubuntu 20.04, python isn't symlink to default python interpreter
|
|
|
|
PIP=pip3
|
2020-06-03 13:55:04 -03:00
|
|
|
|
2022-06-30 17:05:58 -03:00
|
|
|
if [ ${RELEASE_CODENAME} == 'bionic' ] ; then
|
2022-06-30 03:40:40 -03:00
|
|
|
SITLFML_VERSION="2.4"
|
|
|
|
SITLCFML_VERSION="2.4"
|
2023-08-07 06:32:39 -03:00
|
|
|
PYTHON_V="python3"
|
|
|
|
PIP=pip3
|
2022-06-29 17:57:16 -03:00
|
|
|
elif [ ${RELEASE_CODENAME} == 'buster' ]; then
|
2020-01-14 19:39:11 -04:00
|
|
|
SITLFML_VERSION="2.5"
|
|
|
|
SITLCFML_VERSION="2.5"
|
2023-05-15 05:24:14 -03:00
|
|
|
PYTHON_V="python3"
|
|
|
|
PIP=pip3
|
2022-10-27 08:42:45 -03:00
|
|
|
elif [ ${RELEASE_CODENAME} == 'focal' ]; then
|
2020-03-29 11:57:48 -03:00
|
|
|
SITLFML_VERSION="2.5"
|
|
|
|
SITLCFML_VERSION="2.5"
|
|
|
|
PYTHON_V="python3"
|
2020-06-03 13:55:04 -03:00
|
|
|
PIP=pip3
|
2022-03-05 16:01:26 -04:00
|
|
|
elif [ ${RELEASE_CODENAME} == 'jammy' ]; then
|
|
|
|
SITLFML_VERSION="2.5"
|
|
|
|
SITLCFML_VERSION="2.5"
|
|
|
|
PYTHON_V="python3"
|
|
|
|
PIP=pip3
|
2023-05-01 04:27:03 -03:00
|
|
|
elif [ ${RELEASE_CODENAME} == 'lunar' ]; then
|
|
|
|
SITLFML_VERSION="2.5"
|
|
|
|
SITLCFML_VERSION="2.5"
|
|
|
|
PYTHON_V="python3"
|
|
|
|
PIP=pip3
|
2023-10-13 23:16:28 -03:00
|
|
|
elif [ ${RELEASE_CODENAME} == 'mantic' ]; then
|
|
|
|
SITLFML_VERSION="2.5"
|
|
|
|
SITLCFML_VERSION="2.5"
|
|
|
|
PYTHON_V="python3"
|
|
|
|
PIP=pip3
|
2021-11-15 01:08:36 -04:00
|
|
|
elif [ ${RELEASE_CODENAME} == 'groovy' ] ||
|
2022-08-25 19:00:53 -03:00
|
|
|
[ ${RELEASE_CODENAME} == 'bullseye' ]; then
|
2020-11-24 07:58:16 -04:00
|
|
|
SITLFML_VERSION="2.5"
|
|
|
|
SITLCFML_VERSION="2.5"
|
|
|
|
PYTHON_V="python3"
|
|
|
|
PIP=pip3
|
2020-01-14 19:39:11 -04:00
|
|
|
else
|
2021-01-21 10:07:41 -04:00
|
|
|
# We assume APT based system, so let's try with apt-cache first.
|
|
|
|
SITLCFML_VERSION=$(apt-cache search -n '^libcsfml-audio' | cut -d" " -f1 | head -1 | grep -Eo '[+-]?[0-9]+([.][0-9]+)?')
|
|
|
|
SITLFML_VERSION=$(apt-cache search -n '^libsfml-audio' | cut -d" " -f1 | head -1 | grep -Eo '[+-]?[0-9]+([.][0-9]+)?')
|
|
|
|
# If we cannot retrieve the number with apt-cache, try a last time with dpkg-query
|
|
|
|
re='^[+-]?[0-9]+([.][0-9]+)?$'
|
|
|
|
if ! [[ $SITLCFML_VERSION =~ $re ]] || ! [[ $SITLFML_VERSION =~ $re ]] ; then
|
|
|
|
# Extract the floating point number that is the version of the libcsfml package.
|
|
|
|
SITLCFML_VERSION=$(dpkg-query --search libcsfml-audio | cut -d":" -f1 | grep libcsfml-audio | head -1 | grep -Eo '[+-]?[0-9]+([.][0-9]+)?')
|
|
|
|
# And same for libsfml-audio.
|
|
|
|
SITLFML_VERSION=$(dpkg-query --search libsfml-audio | cut -d":" -f1 | grep libsfml-audio | head -1 | grep -Eo '[+-]?[0-9]+([.][0-9]+)?')
|
|
|
|
fi
|
2020-11-04 07:47:56 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Check whether the specific ARM pkg-config package is available or whether we should emulate the effect of installing it.
|
2021-01-21 10:07:41 -04:00
|
|
|
# Check if we need to manually install libtool-bin
|
|
|
|
ARM_PKG_CONFIG_NOT_PRESENT=0
|
|
|
|
if [ -z "$(apt-cache search -n '^pkg-config-arm-linux-gnueabihf')" ]; then
|
|
|
|
ARM_PKG_CONFIG_NOT_PRESENT=$(dpkg-query --search pkg-config-arm-linux-gnueabihf |& grep -c "dpkg-query:")
|
|
|
|
fi
|
|
|
|
if [ "$ARM_PKG_CONFIG_NOT_PRESENT" -eq 1 ]; then
|
2020-11-04 07:47:56 -04:00
|
|
|
INSTALL_PKG_CONFIG=""
|
|
|
|
# No need to install Ubuntu's pkg-config-arm-linux-gnueabihf, instead install the base pkg-config.
|
2021-09-29 12:37:09 -03:00
|
|
|
$APT_GET install pkg-config
|
2020-11-04 07:47:56 -04:00
|
|
|
if [ -f /usr/share/pkg-config-crosswrapper ]; then
|
|
|
|
# We are on non-Ubuntu so simulate effect of installing pkg-config-arm-linux-gnueabihf.
|
2022-03-05 16:01:26 -04:00
|
|
|
sudo ln -sf /usr/share/pkg-config-crosswrapper /usr/bin/arm-linux-gnueabihf-pkg-config
|
2020-11-04 07:47:56 -04:00
|
|
|
else
|
|
|
|
echo "Warning: unable to link to pkg-config-crosswrapper"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# Package is available so install it later.
|
|
|
|
INSTALL_PKG_CONFIG="pkg-config-arm-linux-gnueabihf"
|
2020-01-14 19:39:11 -04:00
|
|
|
fi
|
|
|
|
|
2020-03-29 11:57:48 -03:00
|
|
|
# Lists of packages to install
|
2023-08-05 15:36:03 -03:00
|
|
|
BASE_PKGS="build-essential ccache g++ gawk git make wget valgrind screen"
|
2023-12-02 20:47:37 -04:00
|
|
|
PYTHON_PKGS="future lxml pymavlink pyserial MAVProxy pexpect geocoder empy==3.3.4 ptyprocess dronecan"
|
2023-10-19 17:38:53 -03:00
|
|
|
PYTHON_PKGS="$PYTHON_PKGS flake8 junitparser"
|
2021-10-04 17:13:42 -03:00
|
|
|
|
2020-01-21 00:13:01 -04:00
|
|
|
# add some Python packages required for commonly-used MAVProxy modules and hex file generation:
|
2020-03-29 11:57:48 -03:00
|
|
|
if [[ $SKIP_AP_EXT_ENV -ne 1 ]]; then
|
2023-08-22 19:23:18 -03:00
|
|
|
PYTHON_PKGS="$PYTHON_PKGS pygame intelhex"
|
2020-03-29 11:57:48 -03:00
|
|
|
fi
|
2020-11-04 07:47:56 -04:00
|
|
|
ARM_LINUX_PKGS="g++-arm-linux-gnueabihf $INSTALL_PKG_CONFIG"
|
2018-03-31 10:23:51 -03:00
|
|
|
# python-wxgtk packages are added to SITL_PKGS below
|
2023-05-01 04:27:03 -03:00
|
|
|
|
2023-10-13 23:16:28 -03:00
|
|
|
if [ ${RELEASE_CODENAME} == 'lunar' ] ||
|
|
|
|
[ ${RELEASE_CODENAME} == 'mantic' ]; then
|
2023-05-01 04:27:03 -03:00
|
|
|
# on Lunar (and presumably later releases), we install in venv, below
|
2023-05-16 05:27:25 -03:00
|
|
|
PYTHON_PKGS+=" numpy pyparsing psutil"
|
2023-05-01 04:27:03 -03:00
|
|
|
SITL_PKGS="python3-dev"
|
|
|
|
else
|
2020-12-27 02:42:31 -04:00
|
|
|
SITL_PKGS="libtool libxml2-dev libxslt1-dev ${PYTHON_V}-dev ${PYTHON_V}-pip ${PYTHON_V}-setuptools ${PYTHON_V}-numpy ${PYTHON_V}-pyparsing ${PYTHON_V}-psutil"
|
2023-05-01 04:27:03 -03:00
|
|
|
fi
|
|
|
|
|
2020-01-05 23:27:21 -04:00
|
|
|
# add some packages required for commonly-used MAVProxy modules:
|
2020-03-29 11:57:48 -03:00
|
|
|
if [[ $SKIP_AP_GRAPHIC_ENV -ne 1 ]]; then
|
2023-10-13 23:16:28 -03:00
|
|
|
if [ ${RELEASE_CODENAME} == 'lunar' ] ||
|
|
|
|
[ ${RELEASE_CODENAME} == 'mantic' ]; then
|
2023-08-11 13:30:44 -03:00
|
|
|
PYTHON_PKGS+=" matplotlib scipy opencv-python pyyaml"
|
2023-05-01 04:27:03 -03:00
|
|
|
SITL_PKGS+=" xterm libcsfml-dev libcsfml-audio${SITLCFML_VERSION} libcsfml-dev libcsfml-graphics${SITLCFML_VERSION} libcsfml-network${SITLCFML_VERSION} libcsfml-system${SITLCFML_VERSION} libcsfml-window${SITLCFML_VERSION} libsfml-audio${SITLFML_VERSION} libsfml-dev libsfml-graphics${SITLFML_VERSION} libsfml-network${SITLFML_VERSION} libsfml-system${SITLFML_VERSION} libsfml-window${SITLFML_VERSION}"
|
|
|
|
else
|
2020-03-29 11:57:48 -03:00
|
|
|
SITL_PKGS="$SITL_PKGS xterm ${PYTHON_V}-matplotlib ${PYTHON_V}-serial ${PYTHON_V}-scipy ${PYTHON_V}-opencv libcsfml-dev libcsfml-audio${SITLCFML_VERSION} libcsfml-dev libcsfml-graphics${SITLCFML_VERSION} libcsfml-network${SITLCFML_VERSION} libcsfml-system${SITLCFML_VERSION} libcsfml-window${SITLCFML_VERSION} libsfml-audio${SITLFML_VERSION} libsfml-dev libsfml-graphics${SITLFML_VERSION} libsfml-network${SITLFML_VERSION} libsfml-system${SITLFML_VERSION} libsfml-window${SITLFML_VERSION} ${PYTHON_V}-yaml"
|
2023-05-01 04:27:03 -03:00
|
|
|
fi
|
2020-03-29 11:57:48 -03:00
|
|
|
fi
|
|
|
|
if [[ $SKIP_AP_COV_ENV -ne 1 ]]; then
|
|
|
|
# Coverage utilities
|
|
|
|
COVERAGE_PKGS="lcov gcovr"
|
2016-11-21 10:55:26 -04:00
|
|
|
fi
|
|
|
|
|
2020-03-29 11:57:48 -03:00
|
|
|
# ArduPilot official Toolchain for STM32 boards
|
|
|
|
function install_arm_none_eabi_toolchain() {
|
2022-05-13 04:57:18 -03:00
|
|
|
# GNU Tools for ARM Embedded Processors
|
|
|
|
# (see https://launchpad.net/gcc-arm-embedded/)
|
|
|
|
ARM_ROOT="gcc-arm-none-eabi-10-2020-q4-major"
|
|
|
|
case $(uname -m) in
|
|
|
|
x86_64)
|
|
|
|
if [ ! -d $OPT/$ARM_ROOT ]; then
|
|
|
|
(
|
|
|
|
cd $OPT
|
|
|
|
heading "Installing toolchain for STM32 Boards"
|
|
|
|
echo "Installing toolchain for STM32 Boards"
|
|
|
|
echo "Downloading from ArduPilot server"
|
2022-06-30 03:41:24 -03:00
|
|
|
sudo wget --progress=dot:giga https://firmware.ardupilot.org/Tools/STM32-tools/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
|
2022-05-13 04:57:18 -03:00
|
|
|
echo "Installing..."
|
|
|
|
sudo chmod -R 777 gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
|
|
|
|
sudo tar xjf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
|
|
|
|
echo "... Cleaning"
|
|
|
|
sudo rm gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
echo "Registering STM32 Toolchain for ccache"
|
|
|
|
sudo ln -s -f $CCACHE_PATH /usr/lib/ccache/arm-none-eabi-g++
|
|
|
|
sudo ln -s -f $CCACHE_PATH /usr/lib/ccache/arm-none-eabi-gcc
|
|
|
|
echo "Done!";;
|
|
|
|
|
|
|
|
aarch64)
|
|
|
|
if [ ! -d $OPT/$ARM_ROOT ]; then
|
|
|
|
(
|
|
|
|
cd $OPT
|
|
|
|
heading "Installing toolchain for STM32 Boards"
|
|
|
|
echo "Installing toolchain for STM32 Boards"
|
|
|
|
echo "Downloading from ArduPilot server"
|
2022-06-30 03:41:24 -03:00
|
|
|
sudo wget --progress=dot:giga https://firmware.ardupilot.org/Tools/STM32-tools/gcc-arm-none-eabi-10-2020-q4-major-aarch64-linux.tar.bz2
|
2022-05-13 04:57:18 -03:00
|
|
|
echo "Installing..."
|
|
|
|
sudo chmod -R 777 gcc-arm-none-eabi-10-2020-q4-major-aarch64-linux.tar.bz2
|
|
|
|
sudo tar xjf gcc-arm-none-eabi-10-2020-q4-major-aarch64-linux.tar.bz2
|
|
|
|
echo "... Cleaning"
|
|
|
|
sudo rm gcc-arm-none-eabi-10-2020-q4-major-aarch64-linux.tar.bz2
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
echo "Registering STM32 Toolchain for ccache"
|
|
|
|
sudo ln -s -f $CCACHE_PATH /usr/lib/ccache/arm-none-eabi-g++
|
|
|
|
sudo ln -s -f $CCACHE_PATH /usr/lib/ccache/arm-none-eabi-gcc
|
|
|
|
echo "Done!";;
|
|
|
|
esac
|
2020-03-29 11:57:48 -03:00
|
|
|
}
|
2014-07-05 20:27:15 -03:00
|
|
|
|
2013-04-04 14:52:39 -03:00
|
|
|
function maybe_prompt_user() {
|
|
|
|
if $ASSUME_YES; then
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
read -p "$1"
|
|
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-11-24 18:18:19 -04:00
|
|
|
heading "Add user to dialout group to allow managing serial ports"
|
2014-07-05 20:27:15 -03:00
|
|
|
sudo usermod -a -G dialout $USER
|
2020-03-29 11:57:48 -03:00
|
|
|
echo "Done!"
|
2014-07-05 20:27:15 -03:00
|
|
|
|
2020-03-29 11:57:48 -03:00
|
|
|
# Add back python symlink to python interpreter on Ubuntu >= 20.04
|
2022-10-27 08:42:45 -03:00
|
|
|
if [ ${RELEASE_CODENAME} == 'focal' ];
|
2021-11-15 01:08:36 -04:00
|
|
|
then
|
2020-03-29 11:57:48 -03:00
|
|
|
BASE_PKGS+=" python-is-python3"
|
|
|
|
SITL_PKGS+=" libpython3-stdlib" # for argparse
|
2021-11-15 01:08:36 -04:00
|
|
|
elif [ ${RELEASE_CODENAME} == 'groovy' ] ||
|
|
|
|
[ ${RELEASE_CODENAME} == 'bullseye' ] ||
|
2022-08-25 19:00:53 -03:00
|
|
|
[ ${RELEASE_CODENAME} == 'jammy' ]; then
|
2020-11-24 07:58:16 -04:00
|
|
|
BASE_PKGS+=" python-is-python3"
|
|
|
|
SITL_PKGS+=" libpython3-stdlib" # for argparse
|
2023-05-01 04:27:03 -03:00
|
|
|
elif [ ${RELEASE_CODENAME} == 'lunar' ]; then
|
|
|
|
SITL_PKGS+=" libpython3-stdlib" # for argparse
|
2023-05-15 05:24:14 -03:00
|
|
|
elif [ ${RELEASE_CODENAME} == 'buster' ]; then
|
|
|
|
SITL_PKGS+=" libpython3-stdlib" # for argparse
|
2023-10-13 23:16:28 -03:00
|
|
|
elif [ ${RELEASE_CODENAME} != 'mantic' ]; then
|
2020-03-29 11:57:48 -03:00
|
|
|
SITL_PKGS+=" python-argparse"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check for graphical package for MAVProxy
|
|
|
|
if [[ $SKIP_AP_GRAPHIC_ENV -ne 1 ]]; then
|
2023-05-15 05:24:14 -03:00
|
|
|
if [ ${RELEASE_CODENAME} == 'bullseye' ] ||
|
|
|
|
[ ${RELEASE_CODENAME} == 'buster' ]; then
|
2021-09-30 09:49:23 -03:00
|
|
|
SITL_PKGS+=" libjpeg62-turbo-dev"
|
2021-11-15 01:08:36 -04:00
|
|
|
elif [ ${RELEASE_CODENAME} == 'groovy' ] ||
|
2022-10-27 08:42:45 -03:00
|
|
|
[ ${RELEASE_CODENAME} == 'focal' ]; then
|
2021-09-30 09:49:23 -03:00
|
|
|
SITL_PKGS+=" libjpeg8-dev"
|
2023-05-01 04:27:03 -03:00
|
|
|
elif [ ${RELEASE_CODENAME} == 'lunar' ]; then
|
|
|
|
SITL_PKGS+=" libgtk-3-dev libwxgtk3.2-dev "
|
2023-10-13 23:16:28 -03:00
|
|
|
elif [ ${RELEASE_CODENAME} == 'mantic' ]; then
|
|
|
|
SITL_PKGS+=" libgtk-3-dev libwxgtk3.2-dev "
|
|
|
|
# see below
|
2020-03-29 11:57:48 -03:00
|
|
|
elif apt-cache search python-wxgtk3.0 | grep wx; then
|
|
|
|
SITL_PKGS+=" python-wxgtk3.0"
|
2021-11-15 01:08:36 -04:00
|
|
|
elif apt-cache search python3-wxgtk4.0 | grep wx; then
|
|
|
|
# see below
|
|
|
|
:
|
2020-03-29 11:57:48 -03:00
|
|
|
else
|
|
|
|
# we only support back to trusty:
|
|
|
|
SITL_PKGS+=" python-wxgtk2.8"
|
|
|
|
SITL_PKGS+=" fonts-freefont-ttf libfreetype6-dev libjpeg8-dev libpng12-0 libportmidi-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev" # for pygame
|
|
|
|
fi
|
2023-05-01 04:27:03 -03:00
|
|
|
|
|
|
|
if [ ${RELEASE_CODENAME} == 'lunar' ]; then
|
2023-05-16 07:30:31 -03:00
|
|
|
PYTHON_PKGS+=" opencv-python"
|
|
|
|
SITL_PKGS+=" python3-wxgtk4.0"
|
2023-05-01 04:27:03 -03:00
|
|
|
SITL_PKGS+=" fonts-freefont-ttf libfreetype6-dev libpng16-16 libportmidi-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev" # for pygame
|
2023-10-13 23:16:28 -03:00
|
|
|
elif [ ${RELEASE_CODENAME} == 'mantic' ]; then
|
|
|
|
PYTHON_PKGS+=" wxpython opencv-python"
|
|
|
|
SITL_PKGS+=" python3-wxgtk4.0"
|
|
|
|
SITL_PKGS+=" fonts-freefont-ttf libfreetype6-dev libpng16-16 libportmidi-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev" # for pygame
|
2023-05-01 04:27:03 -03:00
|
|
|
elif [ ${RELEASE_CODENAME} == 'bullseye' ] ||
|
2021-11-15 01:08:36 -04:00
|
|
|
[ ${RELEASE_CODENAME} == 'groovy' ] ||
|
2023-05-15 05:24:14 -03:00
|
|
|
[ ${RELEASE_CODENAME} == 'buster' ] ||
|
2021-11-15 01:08:36 -04:00
|
|
|
[ ${RELEASE_CODENAME} == 'focal' ] ||
|
2022-08-25 19:00:53 -03:00
|
|
|
[ ${RELEASE_CODENAME} == 'jammy' ]; then
|
2021-09-30 09:49:23 -03:00
|
|
|
SITL_PKGS+=" python3-wxgtk4.0"
|
|
|
|
SITL_PKGS+=" fonts-freefont-ttf libfreetype6-dev libpng16-16 libportmidi-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev" # for pygame
|
|
|
|
fi
|
2018-03-31 10:23:51 -03:00
|
|
|
fi
|
|
|
|
|
2020-03-29 11:57:48 -03:00
|
|
|
# Check if we need to manually install realpath
|
2018-05-15 19:35:54 -03:00
|
|
|
RP=$(apt-cache search -n '^realpath$')
|
2018-05-17 00:30:05 -03:00
|
|
|
if [ -n "$RP" ]; then
|
|
|
|
BASE_PKGS+=" realpath"
|
2018-05-14 23:52:03 -03:00
|
|
|
fi
|
|
|
|
|
2020-03-29 11:57:48 -03:00
|
|
|
# Check if we need to manually install libtool-bin
|
|
|
|
LBTBIN=$(apt-cache search -n '^libtool-bin')
|
|
|
|
if [ -n "$LBTBIN" ]; then
|
|
|
|
SITL_PKGS+=" libtool-bin"
|
|
|
|
fi
|
2014-07-05 20:27:15 -03:00
|
|
|
|
2020-03-29 11:57:48 -03:00
|
|
|
# Install all packages
|
|
|
|
$APT_GET install $BASE_PKGS $SITL_PKGS $PX4_PKGS $ARM_LINUX_PKGS $COVERAGE_PKGS
|
2023-05-01 04:27:03 -03:00
|
|
|
|
|
|
|
heading "Check if we are inside docker environment..."
|
|
|
|
IS_DOCKER=false
|
|
|
|
if [[ -f /.dockerenv ]] || grep -Eq '(lxc|docker)' /proc/1/cgroup ; then
|
|
|
|
IS_DOCKER=true
|
|
|
|
fi
|
|
|
|
echo "Done!"
|
|
|
|
|
|
|
|
SHELL_LOGIN=".profile"
|
|
|
|
if $IS_DOCKER; then
|
|
|
|
echo "Inside docker, we add the tools path into .bashrc directly"
|
|
|
|
SHELL_LOGIN=".ardupilot_env"
|
|
|
|
echo "# ArduPilot env file. Need to be loaded by your Shell." > ~/$SHELL_LOGIN
|
|
|
|
fi
|
|
|
|
|
|
|
|
PIP_USER_ARGUMENT="--user"
|
2023-08-07 06:33:30 -03:00
|
|
|
|
2023-05-01 04:27:03 -03:00
|
|
|
# create a Python venv on more recent releases:
|
2023-10-13 23:16:28 -03:00
|
|
|
if [ ${RELEASE_CODENAME} == 'lunar' ] ||
|
|
|
|
[ ${RELEASE_CODENAME} == 'mantic' ]; then
|
2023-05-01 04:27:03 -03:00
|
|
|
$APT_GET install python3.11-venv
|
|
|
|
python3 -m venv $HOME/venv-ardupilot
|
|
|
|
|
|
|
|
# activate it:
|
|
|
|
SOURCE_LINE="source $HOME/venv-ardupilot/bin/activate"
|
|
|
|
$SOURCE_LINE
|
|
|
|
PIP_USER_ARGUMENT=""
|
|
|
|
|
|
|
|
if [[ -z "${DO_PYTHON_VENV_ENV}" ]] && maybe_prompt_user "Make ArduPilot venv default for python [N/y]?" ; then
|
|
|
|
DO_PYTHON_VENV_ENV=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $DO_PYTHON_VENV_ENV -eq 1 ]]; then
|
|
|
|
echo $SOURCE_LINE >> ~/$SHELL_LOGIN
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2023-05-16 05:27:25 -03:00
|
|
|
# try update setuptools and wheel before installing pip package that may need compilation
|
2023-08-22 19:15:40 -03:00
|
|
|
$PIP install $PIP_USER_ARGUMENT -U pip setuptools wheel
|
2023-05-16 05:27:25 -03:00
|
|
|
|
2023-08-07 06:33:30 -03:00
|
|
|
if [ "$GITHUB_ACTIONS" == "true" ]; then
|
|
|
|
PIP_USER_ARGUMENT+=" --progress-bar off"
|
|
|
|
fi
|
|
|
|
|
2023-10-13 23:16:28 -03:00
|
|
|
if [ ${RELEASE_CODENAME} == 'lunar' ] ||
|
|
|
|
[ ${RELEASE_CODENAME} == 'mantic' ]; then
|
2023-05-01 04:27:03 -03:00
|
|
|
# must do this ahead of wxPython pip3 run :-/
|
|
|
|
$PIP install $PIP_USER_ARGUMENT -U attrdict3
|
|
|
|
fi
|
|
|
|
|
|
|
|
$PIP install $PIP_USER_ARGUMENT -U $PYTHON_PKGS
|
2020-01-21 00:13:01 -04:00
|
|
|
|
2020-03-29 11:57:48 -03:00
|
|
|
if [[ -z "${DO_AP_STM_ENV}" ]] && maybe_prompt_user "Install ArduPilot STM32 toolchain [N/y]?" ; then
|
|
|
|
DO_AP_STM_ENV=1
|
|
|
|
fi
|
|
|
|
|
2022-05-02 07:50:57 -03:00
|
|
|
heading "Removing modemmanager and brltty package that could conflict with firmware uploading"
|
2021-01-21 10:15:12 -04:00
|
|
|
if package_is_installed "modemmanager"; then
|
2020-06-04 04:37:01 -03:00
|
|
|
$APT_GET remove modemmanager
|
|
|
|
fi
|
2022-05-02 07:50:57 -03:00
|
|
|
if package_is_installed "brltty"; then
|
|
|
|
$APT_GET remove brltty
|
|
|
|
fi
|
2020-06-04 04:37:01 -03:00
|
|
|
echo "Done!"
|
|
|
|
|
2020-03-29 11:57:48 -03:00
|
|
|
CCACHE_PATH=$(which ccache)
|
|
|
|
if [[ $DO_AP_STM_ENV -eq 1 ]]; then
|
|
|
|
install_arm_none_eabi_toolchain
|
2013-04-04 14:52:39 -03:00
|
|
|
fi
|
2014-07-05 20:27:15 -03:00
|
|
|
|
2020-11-24 18:18:19 -04:00
|
|
|
heading "Adding ArduPilot Tools to environment"
|
2020-03-29 11:57:48 -03:00
|
|
|
|
2016-04-18 23:19:22 -03:00
|
|
|
SCRIPT_DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))
|
|
|
|
ARDUPILOT_ROOT=$(realpath "$SCRIPT_DIR/../../")
|
2021-06-28 10:59:53 -03:00
|
|
|
|
|
|
|
if [[ $DO_AP_STM_ENV -eq 1 ]]; then
|
2014-07-06 02:40:39 -03:00
|
|
|
exportline="export PATH=$OPT/$ARM_ROOT/bin:\$PATH";
|
2020-03-29 11:57:48 -03:00
|
|
|
grep -Fxq "$exportline" ~/$SHELL_LOGIN 2>/dev/null || {
|
2019-01-25 06:59:53 -04:00
|
|
|
if maybe_prompt_user "Add $OPT/$ARM_ROOT/bin to your PATH [N/y]?" ; then
|
2020-03-29 11:57:48 -03:00
|
|
|
echo $exportline >> ~/$SHELL_LOGIN
|
2016-04-18 23:33:24 -03:00
|
|
|
eval $exportline
|
2013-04-04 14:52:39 -03:00
|
|
|
else
|
2014-07-06 02:40:39 -03:00
|
|
|
echo "Skipping adding $OPT/$ARM_ROOT/bin to PATH."
|
2013-04-04 14:52:39 -03:00
|
|
|
fi
|
2016-04-18 23:09:31 -03:00
|
|
|
}
|
2021-06-28 10:59:53 -03:00
|
|
|
fi
|
2014-07-05 20:27:15 -03:00
|
|
|
|
2016-04-18 23:19:22 -03:00
|
|
|
exportline2="export PATH=$ARDUPILOT_ROOT/$ARDUPILOT_TOOLS:\$PATH";
|
2020-03-29 11:57:48 -03:00
|
|
|
grep -Fxq "$exportline2" ~/$SHELL_LOGIN 2>/dev/null || {
|
2019-01-25 06:59:53 -04:00
|
|
|
if maybe_prompt_user "Add $ARDUPILOT_ROOT/$ARDUPILOT_TOOLS to your PATH [N/y]?" ; then
|
2020-03-29 11:57:48 -03:00
|
|
|
echo $exportline2 >> ~/$SHELL_LOGIN
|
2016-04-18 23:33:24 -03:00
|
|
|
eval $exportline2
|
2014-07-05 20:27:15 -03:00
|
|
|
else
|
2016-04-18 23:19:22 -03:00
|
|
|
echo "Skipping adding $ARDUPILOT_ROOT/$ARDUPILOT_TOOLS to PATH."
|
2014-07-05 20:27:15 -03:00
|
|
|
fi
|
2016-04-18 23:09:31 -03:00
|
|
|
}
|
2014-07-05 20:27:15 -03:00
|
|
|
|
2020-09-02 05:49:15 -03:00
|
|
|
if [[ $SKIP_AP_COMPLETION_ENV -ne 1 ]]; then
|
2020-03-29 11:57:48 -03:00
|
|
|
exportline3="source $ARDUPILOT_ROOT/Tools/completion/completion.bash";
|
|
|
|
grep -Fxq "$exportline3" ~/$SHELL_LOGIN 2>/dev/null || {
|
|
|
|
if maybe_prompt_user "Add ArduPilot Bash Completion to your bash shell [N/y]?" ; then
|
|
|
|
echo $exportline3 >> ~/.bashrc
|
|
|
|
eval $exportline3
|
|
|
|
else
|
|
|
|
echo "Skipping adding ArduPilot Bash Completion."
|
|
|
|
fi
|
|
|
|
}
|
2020-09-02 05:49:15 -03:00
|
|
|
fi
|
2020-03-29 11:57:48 -03:00
|
|
|
|
|
|
|
exportline4="export PATH=/usr/lib/ccache:\$PATH";
|
|
|
|
grep -Fxq "$exportline4" ~/$SHELL_LOGIN 2>/dev/null || {
|
|
|
|
if maybe_prompt_user "Append CCache to your PATH [N/y]?" ; then
|
|
|
|
echo $exportline4 >> ~/$SHELL_LOGIN
|
|
|
|
eval $exportline4
|
|
|
|
else
|
|
|
|
echo "Skipping appending CCache to PATH."
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
echo "Done!"
|
2015-06-09 03:51:55 -03:00
|
|
|
|
2020-03-29 11:57:48 -03:00
|
|
|
if [[ $SKIP_AP_GIT_CHECK -ne 1 ]]; then
|
|
|
|
if [ -d ".git" ]; then
|
2020-11-24 18:18:19 -04:00
|
|
|
heading "Update git submodules"
|
2020-03-29 11:57:48 -03:00
|
|
|
cd $ARDUPILOT_ROOT
|
|
|
|
git submodule update --init --recursive
|
|
|
|
echo "Done!"
|
|
|
|
fi
|
|
|
|
fi
|
2022-07-11 17:45:23 -03:00
|
|
|
|
|
|
|
if $IS_DOCKER; then
|
|
|
|
echo "Finalizing ArduPilot env for Docker"
|
|
|
|
echo "source ~/.ardupilot_env">> ~/.bashrc
|
|
|
|
fi
|
|
|
|
|
2018-03-01 20:24:06 -04:00
|
|
|
echo "---------- $0 end ----------"
|