Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/Tools/environment_install/install-prereqs-ubuntu.sh
Views: 1798
#!/usr/bin/env bash1echo "---------- $0 start ----------"2set -e3set -x45if [ $EUID == 0 ]; then6echo "Please do not run this script as root; don't sudo it!"7exit 18fi910OPT="/opt"11# Ardupilot Tools12ARDUPILOT_TOOLS="Tools/autotest"1314ASSUME_YES=false15QUIET=false16sep="##############################################"1718OPTIND=1 # Reset in case getopts has been used previously in the shell.19while getopts "yq" opt; do20case "$opt" in21\?)22exit 123;;24y) ASSUME_YES=true25;;26q) QUIET=true27;;28esac29done3031APT_GET="sudo apt-get"32if $ASSUME_YES; then33APT_GET="$APT_GET --assume-yes"34fi35if $QUIET; then36APT_GET="$APT_GET -qq"37fi3839# update apt package list40$APT_GET update4142function package_is_installed() {43dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed"44}4546function heading() {47echo "$sep"48echo $*49echo "$sep"50}5152# Install lsb-release as it is needed to check Ubuntu version53if ! package_is_installed "lsb-release"; then54heading "Installing lsb-release"55$APT_GET install lsb-release56echo "Done!"57fi5859# Checking Ubuntu release to adapt software version to install60RELEASE_CODENAME=$(lsb_release -c -s)6162# translate Mint-codenames to Ubuntu-codenames based on https://www.linuxmint.com/download_all.php63case ${RELEASE_CODENAME} in64wilma)65RELEASE_CODENAME='noble'66;;67vanessa)68RELEASE_CODENAME='jammy'69;;70una | uma | ulyssa | ulyana | jolnir)71RELEASE_CODENAME='focal'72;;73tricia | tina | tessa | tara)74RELEASE_CODENAME='bionic'75;;76elsie)77RELEASE_CODENAME='bullseye'78;;79esac8081PYTHON_V="python3" # starting from ubuntu 20.04, python isn't symlink to default python interpreter82PIP=pip38384if [ ${RELEASE_CODENAME} == 'bionic' ] ; then85echo "ArduPilot no longer supports developing on this operating system that has reached end of standard support."86exit 187elif [ ${RELEASE_CODENAME} == 'bookworm' ]; then88SITLFML_VERSION="2.5"89SITLCFML_VERSION="2.5"90PYTHON_V="python3"91PIP=pip392elif [ ${RELEASE_CODENAME} == 'buster' ]; then93SITLFML_VERSION="2.5"94SITLCFML_VERSION="2.5"95PYTHON_V="python3"96PIP=pip397elif [ ${RELEASE_CODENAME} == 'focal' ]; then98SITLFML_VERSION="2.5"99SITLCFML_VERSION="2.5"100PYTHON_V="python3"101PIP=pip3102elif [ ${RELEASE_CODENAME} == 'jammy' ]; then103SITLFML_VERSION="2.5"104SITLCFML_VERSION="2.5"105PYTHON_V="python3"106PIP=pip3107elif [ ${RELEASE_CODENAME} == 'lunar' ]; then108SITLFML_VERSION="2.5"109SITLCFML_VERSION="2.5"110PYTHON_V="python3"111PIP=pip3112elif [ ${RELEASE_CODENAME} == 'mantic' ]; then113SITLFML_VERSION="2.5"114SITLCFML_VERSION="2.5"115PYTHON_V="python3"116PIP=pip3117elif [ ${RELEASE_CODENAME} == 'noble' ]; then118SITLFML_VERSION="2.6"119SITLCFML_VERSION="2.6"120PYTHON_V="python3"121PIP=pip3122elif [ ${RELEASE_CODENAME} == 'oracular' ]; then123SITLFML_VERSION="2.6"124SITLCFML_VERSION="2.6"125PYTHON_V="python3"126PIP=pip3127elif [ ${RELEASE_CODENAME} == 'groovy' ] ||128[ ${RELEASE_CODENAME} == 'bullseye' ]; then129SITLFML_VERSION="2.5"130SITLCFML_VERSION="2.5"131PYTHON_V="python3"132PIP=pip3133else134# We assume APT based system, so let's try with apt-cache first.135SITLCFML_VERSION=$(apt-cache search -n '^libcsfml-audio' | cut -d" " -f1 | head -1 | grep -Eo '[+-]?[0-9]+([.][0-9]+)?')136SITLFML_VERSION=$(apt-cache search -n '^libsfml-audio' | cut -d" " -f1 | head -1 | grep -Eo '[+-]?[0-9]+([.][0-9]+)?')137# If we cannot retrieve the number with apt-cache, try a last time with dpkg-query138re='^[+-]?[0-9]+([.][0-9]+)?$'139if ! [[ $SITLCFML_VERSION =~ $re ]] || ! [[ $SITLFML_VERSION =~ $re ]] ; then140# Extract the floating point number that is the version of the libcsfml package.141SITLCFML_VERSION=$(dpkg-query --search libcsfml-audio | cut -d":" -f1 | grep libcsfml-audio | head -1 | grep -Eo '[+-]?[0-9]+([.][0-9]+)?')142# And same for libsfml-audio.143SITLFML_VERSION=$(dpkg-query --search libsfml-audio | cut -d":" -f1 | grep libsfml-audio | head -1 | grep -Eo '[+-]?[0-9]+([.][0-9]+)?')144fi145fi146147# Check whether the specific ARM pkg-config package is available or whether we should emulate the effect of installing it.148# Check if we need to manually install libtool-bin149ARM_PKG_CONFIG_NOT_PRESENT=0150if [ -z "$(apt-cache search -n '^pkg-config-arm-linux-gnueabihf')" ]; then151ARM_PKG_CONFIG_NOT_PRESENT=$(dpkg-query --search pkg-config-arm-linux-gnueabihf |& grep -c "dpkg-query:")152fi153if [ "$ARM_PKG_CONFIG_NOT_PRESENT" -eq 1 ]; then154INSTALL_PKG_CONFIG=""155# No need to install Ubuntu's pkg-config-arm-linux-gnueabihf, instead install the base pkg-config.156$APT_GET install pkg-config157if [ -f /usr/share/pkg-config-crosswrapper ]; then158# We are on non-Ubuntu so simulate effect of installing pkg-config-arm-linux-gnueabihf.159sudo ln -sf /usr/share/pkg-config-crosswrapper /usr/bin/arm-linux-gnueabihf-pkg-config160else161echo "Warning: unable to link to pkg-config-crosswrapper"162fi163else164# Package is available so install it later.165INSTALL_PKG_CONFIG="pkg-config-arm-linux-gnueabihf"166fi167168# Lists of packages to install169BASE_PKGS="build-essential ccache g++ gawk git make wget valgrind screen python3-pexpect astyle"170PYTHON_PKGS="future lxml pymavlink pyserial MAVProxy geocoder empy==3.3.4 ptyprocess dronecan"171PYTHON_PKGS="$PYTHON_PKGS flake8 junitparser wsproto tabulate"172173# add some Python packages required for commonly-used MAVProxy modules and hex file generation:174if [[ $SKIP_AP_EXT_ENV -ne 1 ]]; then175PYTHON_PKGS="$PYTHON_PKGS pygame intelhex"176fi177ARM_LINUX_PKGS="g++-arm-linux-gnueabihf $INSTALL_PKG_CONFIG"178# python-wxgtk packages are added to SITL_PKGS below179180if [ ${RELEASE_CODENAME} == 'bookworm' ] ||181[ ${RELEASE_CODENAME} == 'lunar' ] ||182[ ${RELEASE_CODENAME} == 'mantic' ] ||183[ ${RELEASE_CODENAME} == 'noble' ] ||184[ ${RELEASE_CODENAME} == 'oracular' ]; then185# on Lunar (and presumably later releases), we install in venv, below186PYTHON_PKGS+=" numpy pyparsing psutil"187SITL_PKGS="python3-dev"188else189SITL_PKGS="libtool libxml2-dev libxslt1-dev ${PYTHON_V}-dev ${PYTHON_V}-pip ${PYTHON_V}-setuptools ${PYTHON_V}-numpy ${PYTHON_V}-pyparsing ${PYTHON_V}-psutil"190fi191192# add some packages required for commonly-used MAVProxy modules:193if [[ $SKIP_AP_GRAPHIC_ENV -ne 1 ]]; then194if [ ${RELEASE_CODENAME} == 'bookworm' ] ||195[ ${RELEASE_CODENAME} == 'lunar' ] ||196[ ${RELEASE_CODENAME} == 'mantic' ] ||197[ ${RELEASE_CODENAME} == 'noble' ] ||198[ ${RELEASE_CODENAME} == 'oracular' ]; then199PYTHON_PKGS+=" matplotlib scipy opencv-python pyyaml"200SITL_PKGS+=" xterm xfonts-base 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}"201else202SITL_PKGS="$SITL_PKGS xterm xfonts-base ${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"203fi204fi205if [[ $SKIP_AP_COV_ENV -ne 1 ]]; then206# Coverage utilities207COVERAGE_PKGS="lcov gcovr"208fi209210# ArduPilot official Toolchain for STM32 boards211function install_arm_none_eabi_toolchain() {212# GNU Tools for ARM Embedded Processors213# (see https://launchpad.net/gcc-arm-embedded/)214ARM_ROOT="gcc-arm-none-eabi-10-2020-q4-major"215case $(uname -m) in216x86_64)217if [ ! -d $OPT/$ARM_ROOT ]; then218(219cd $OPT220heading "Installing toolchain for STM32 Boards"221echo "Installing toolchain for STM32 Boards"222echo "Downloading from ArduPilot server"223sudo wget --progress=dot:giga https://firmware.ardupilot.org/Tools/STM32-tools/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2224echo "Installing..."225sudo chmod -R 777 gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2226sudo tar xjf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2227echo "... Cleaning"228sudo rm gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2229)230fi231echo "Registering STM32 Toolchain for ccache"232sudo ln -s -f $CCACHE_PATH /usr/lib/ccache/arm-none-eabi-g++233sudo ln -s -f $CCACHE_PATH /usr/lib/ccache/arm-none-eabi-gcc234echo "Done!";;235236aarch64)237if [ ! -d $OPT/$ARM_ROOT ]; then238(239cd $OPT240heading "Installing toolchain for STM32 Boards"241echo "Installing toolchain for STM32 Boards"242echo "Downloading from ArduPilot server"243sudo wget --progress=dot:giga https://firmware.ardupilot.org/Tools/STM32-tools/gcc-arm-none-eabi-10-2020-q4-major-aarch64-linux.tar.bz2244echo "Installing..."245sudo chmod -R 777 gcc-arm-none-eabi-10-2020-q4-major-aarch64-linux.tar.bz2246sudo tar xjf gcc-arm-none-eabi-10-2020-q4-major-aarch64-linux.tar.bz2247echo "... Cleaning"248sudo rm gcc-arm-none-eabi-10-2020-q4-major-aarch64-linux.tar.bz2249)250fi251echo "Registering STM32 Toolchain for ccache"252sudo ln -s -f $CCACHE_PATH /usr/lib/ccache/arm-none-eabi-g++253sudo ln -s -f $CCACHE_PATH /usr/lib/ccache/arm-none-eabi-gcc254echo "Done!";;255esac256}257258function maybe_prompt_user() {259if $ASSUME_YES; then260return 0261else262read -p "$1"263if [[ $REPLY =~ ^[Yy]$ ]]; then264return 0265else266return 1267fi268fi269}270271heading "Add user to dialout group to allow managing serial ports"272sudo usermod -a -G dialout $USER273echo "Done!"274275# Add back python symlink to python interpreter on Ubuntu >= 20.04276if [ ${RELEASE_CODENAME} == 'focal' ];277then278BASE_PKGS+=" python-is-python3"279SITL_PKGS+=" libpython3-stdlib" # for argparse280elif [ ${RELEASE_CODENAME} == 'groovy' ] ||281[ ${RELEASE_CODENAME} == 'bullseye' ] ||282[ ${RELEASE_CODENAME} == 'jammy' ]; then283BASE_PKGS+=" python-is-python3"284SITL_PKGS+=" libpython3-stdlib" # for argparse285elif [ ${RELEASE_CODENAME} == 'bookworm' ]; then286SITL_PKGS+=" libpython3-stdlib" # for argparse287elif [ ${RELEASE_CODENAME} == 'lunar' ]; then288SITL_PKGS+=" libpython3-stdlib" # for argparse289elif [ ${RELEASE_CODENAME} == 'buster' ]; then290SITL_PKGS+=" libpython3-stdlib" # for argparse291elif [ ${RELEASE_CODENAME} != 'mantic' ] &&292[ ${RELEASE_CODENAME} != 'noble' ] &&293[ ${RELEASE_CODENAME} != 'oracular' ]; then294SITL_PKGS+=" python-argparse"295fi296297# Check for graphical package for MAVProxy298if [[ $SKIP_AP_GRAPHIC_ENV -ne 1 ]]; then299if [ ${RELEASE_CODENAME} == 'bullseye' ] ||300[ ${RELEASE_CODENAME} == 'buster' ]; then301SITL_PKGS+=" libjpeg62-turbo-dev"302elif [ ${RELEASE_CODENAME} == 'groovy' ] ||303[ ${RELEASE_CODENAME} == 'focal' ]; then304SITL_PKGS+=" libjpeg8-dev"305elif [ ${RELEASE_CODENAME} == 'bookworm' ]; then306SITL_PKGS+=" libgtk-3-dev libwxgtk3.2-dev "307elif [ ${RELEASE_CODENAME} == 'lunar' ]; then308SITL_PKGS+=" libgtk-3-dev libwxgtk3.2-dev "309elif [ ${RELEASE_CODENAME} == 'mantic' ]; then310SITL_PKGS+=" libgtk-3-dev libwxgtk3.2-dev "311# see below312elif [ ${RELEASE_CODENAME} == 'noble' ]; then313SITL_PKGS+=" libgtk-3-dev libwxgtk3.2-dev "314# see below315elif [ ${RELEASE_CODENAME} == 'oracular' ]; then316SITL_PKGS+=" libgtk-3-dev libwxgtk3.2-dev "317# see below318elif apt-cache search python-wxgtk3.0 | grep wx; then319SITL_PKGS+=" python-wxgtk3.0"320elif apt-cache search python3-wxgtk4.0 | grep wx; then321# see below322:323else324# we only support back to trusty:325SITL_PKGS+=" python-wxgtk2.8"326SITL_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 pygame327fi328329if [ ${RELEASE_CODENAME} == 'bookworm' ]; then330PYTHON_PKGS+=" opencv-python"331SITL_PKGS+=" python3-wxgtk4.0"332SITL_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 pygame333elif [ ${RELEASE_CODENAME} == 'lunar' ]; then334PYTHON_PKGS+=" wxpython opencv-python"335SITL_PKGS+=" python3-wxgtk4.0"336SITL_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 pygame337elif [ ${RELEASE_CODENAME} == 'mantic' ] ||338[ ${RELEASE_CODENAME} == 'noble' ] ||339[ ${RELEASE_CODENAME} == 'oracular' ]; then340PYTHON_PKGS+=" wxpython opencv-python"341SITL_PKGS+=" python3-wxgtk4.0"342SITL_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 pygame343elif [ ${RELEASE_CODENAME} == 'bullseye' ] ||344[ ${RELEASE_CODENAME} == 'groovy' ] ||345[ ${RELEASE_CODENAME} == 'buster' ] ||346[ ${RELEASE_CODENAME} == 'focal' ] ||347[ ${RELEASE_CODENAME} == 'jammy' ]; then348SITL_PKGS+=" python3-wxgtk4.0"349SITL_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 pygame350fi351fi352353# Check if we need to manually install realpath354RP=$(apt-cache search -n '^realpath$')355if [ -n "$RP" ]; then356BASE_PKGS+=" realpath"357fi358359# Check if we need to manually install libtool-bin360LBTBIN=$(apt-cache search -n '^libtool-bin')361if [ -n "$LBTBIN" ]; then362SITL_PKGS+=" libtool-bin"363fi364365SITL_PKGS+=" ppp"366367# Install all packages368$APT_GET install $BASE_PKGS $SITL_PKGS $PX4_PKGS $ARM_LINUX_PKGS $COVERAGE_PKGS369370if [[ $SKIP_AP_GRAPHIC_ENV -ne 1 ]]; then371# If xfonts-base was just installed, you need to rebuild the font information cache.372# https://discuss.ardupilot.org/t/using-the-gdb-window-on-a-high-dpi-display/128150/2373fc-cache374fi375376heading "Check if we are inside docker environment..."377IS_DOCKER=false378if [[ ${AP_DOCKER_BUILD:-0} -eq 1 ]] || [[ -f /.dockerenv ]] || grep -Eq '(lxc|docker)' /proc/1/cgroup ; then379IS_DOCKER=true380fi381echo "Done!"382383SHELL_LOGIN=".profile"384if $IS_DOCKER; then385echo "Inside docker, we add the tools path into .bashrc directly"386SHELL_LOGIN=".ardupilot_env"387echo "# ArduPilot env file. Need to be loaded by your Shell." > ~/$SHELL_LOGIN388fi389390PIP_USER_ARGUMENT="--user"391392# create a Python venv on more recent releases:393PYTHON_VENV_PACKAGE=""394if [ ${RELEASE_CODENAME} == 'bookworm' ] ||395[ ${RELEASE_CODENAME} == 'lunar' ] ||396[ ${RELEASE_CODENAME} == 'mantic' ]; then397PYTHON_VENV_PACKAGE=python3.11-venv398elif [ ${RELEASE_CODENAME} == 'noble' ]; then399PYTHON_VENV_PACKAGE=python3.12-venv400elif [ ${RELEASE_CODENAME} == 'oracular' ]; then401PYTHON_VENV_PACKAGE=python3.12-venv402fi403404if [ -n "$PYTHON_VENV_PACKAGE" ]; then405$APT_GET install $PYTHON_VENV_PACKAGE406python3 -m venv --system-site-packages $HOME/venv-ardupilot407408# activate it:409SOURCE_LINE="source $HOME/venv-ardupilot/bin/activate"410$SOURCE_LINE411PIP_USER_ARGUMENT=""412413if [[ -z "${DO_PYTHON_VENV_ENV}" ]] && maybe_prompt_user "Make ArduPilot venv default for python [N/y]?" ; then414DO_PYTHON_VENV_ENV=1415fi416417if [[ $DO_PYTHON_VENV_ENV -eq 1 ]]; then418echo $SOURCE_LINE >> ~/$SHELL_LOGIN419else420echo "Please use \`$SOURCE_LINE\` to activate the ArduPilot venv"421fi422fi423424# try update packaging, setuptools and wheel before installing pip package that may need compilation425SETUPTOOLS="setuptools"426if [ ${RELEASE_CODENAME} == 'focal' ]; then427SETUPTOOLS=setuptools==70.3.0428fi429$PIP install $PIP_USER_ARGUMENT -U pip packaging $SETUPTOOLS wheel430431if [ "$GITHUB_ACTIONS" == "true" ]; then432PIP_USER_ARGUMENT+=" --progress-bar off"433fi434435if [ ${RELEASE_CODENAME} == 'bookworm' ] ||436[ ${RELEASE_CODENAME} == 'lunar' ] ||437[ ${RELEASE_CODENAME} == 'mantic' ] ||438[ ${RELEASE_CODENAME} == 'noble' ] ||439[ ${RELEASE_CODENAME} == 'oracular' ]; then440# must do this ahead of wxPython pip3 run :-/441$PIP install $PIP_USER_ARGUMENT -U attrdict3442fi443444# install Python packages one-at-a-time so it is clear which package445# is causing problems:446for PACKAGE in $PYTHON_PKGS; do447$PIP install $PIP_USER_ARGUMENT -U $PACKAGE448done449450if [[ -z "${DO_AP_STM_ENV}" ]] && maybe_prompt_user "Install ArduPilot STM32 toolchain [N/y]?" ; then451DO_AP_STM_ENV=1452fi453454heading "Removing modemmanager and brltty package that could conflict with firmware uploading"455if package_is_installed "modemmanager"; then456$APT_GET remove modemmanager457fi458if package_is_installed "brltty"; then459$APT_GET remove brltty460fi461echo "Done!"462463CCACHE_PATH=$(which ccache)464if [[ $DO_AP_STM_ENV -eq 1 ]]; then465install_arm_none_eabi_toolchain466fi467468heading "Adding ArduPilot Tools to environment"469470SCRIPT_DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))471ARDUPILOT_ROOT=$(realpath "$SCRIPT_DIR/../../")472473if [[ $DO_AP_STM_ENV -eq 1 ]]; then474exportline="export PATH=$OPT/$ARM_ROOT/bin:\$PATH";475grep -Fxq "$exportline" ~/$SHELL_LOGIN 2>/dev/null || {476if maybe_prompt_user "Add $OPT/$ARM_ROOT/bin to your PATH [N/y]?" ; then477echo $exportline >> ~/$SHELL_LOGIN478eval $exportline479else480echo "Skipping adding $OPT/$ARM_ROOT/bin to PATH."481fi482}483fi484485exportline2="export PATH=$ARDUPILOT_ROOT/$ARDUPILOT_TOOLS:\$PATH";486grep -Fxq "$exportline2" ~/$SHELL_LOGIN 2>/dev/null || {487if maybe_prompt_user "Add $ARDUPILOT_ROOT/$ARDUPILOT_TOOLS to your PATH [N/y]?" ; then488echo $exportline2 >> ~/$SHELL_LOGIN489eval $exportline2490else491echo "Skipping adding $ARDUPILOT_ROOT/$ARDUPILOT_TOOLS to PATH."492fi493}494495if [[ $SKIP_AP_COMPLETION_ENV -ne 1 ]]; then496exportline3="source $ARDUPILOT_ROOT/Tools/completion/completion.bash";497grep -Fxq "$exportline3" ~/$SHELL_LOGIN 2>/dev/null || {498if maybe_prompt_user "Add ArduPilot Bash Completion to your bash shell [N/y]?" ; then499echo $exportline3 >> ~/.bashrc500eval $exportline3501else502echo "Skipping adding ArduPilot Bash Completion."503fi504}505fi506507exportline4="export PATH=/usr/lib/ccache:\$PATH";508grep -Fxq "$exportline4" ~/$SHELL_LOGIN 2>/dev/null || {509if maybe_prompt_user "Append CCache to your PATH [N/y]?" ; then510echo $exportline4 >> ~/$SHELL_LOGIN511eval $exportline4512else513echo "Skipping appending CCache to PATH."514fi515}516echo "Done!"517518if [[ $SKIP_AP_GIT_CHECK -ne 1 ]]; then519if [ -d ".git" ]; then520heading "Update git submodules"521cd $ARDUPILOT_ROOT522git submodule update --init --recursive523echo "Done!"524fi525fi526527if $IS_DOCKER; then528echo "Finalizing ArduPilot env for Docker"529echo "source ~/.ardupilot_env">> ~/.bashrc530fi531532echo "---------- $0 end ----------"533534535