ardupilot/Tools/scripts/install-prereqs-ubuntu.sh
Andre Kjellstrup b6b593b6fb Tools: install-prereqs-ubuntu: update for Ubuntu 16.x
No older versions of Ubuntu is affected by this script.
2016-04-19 00:14:09 -03:00

108 lines
2.7 KiB
Bash
Executable File

#!/bin/bash
set -e
CWD=$(pwd)
OPT="/opt"
BASE_PKGS="gawk make git arduino-core curl"
PYTHON_PKGS="pymavlink MAVProxy droneapi catkin_pkg"
PX4_PKGS="python-serial python-argparse openocd flex bison libncurses5-dev \
autoconf texinfo build-essential libftdi-dev libtool zlib1g-dev \
zip genromfs python-empy"
BEBOP_PKGS="g++-arm-linux-gnueabihf"
SITL_PKGS="g++ python-pip python-matplotlib python-serial python-scipy python-opencv python-numpy python-pyparsing ccache realpath"
UBUNTU64_PKGS="libc6:i386 libgcc1:i386 gcc-4.9-base:i386 libstdc++5:i386 libstdc++6:i386"
ASSUME_YES=false
if grep -q 'VERSION="16' /etc/os-release
then
# Packages for Ubuntu 16.x
SITL_PKGS+=$ " python-wxgtk3.0"
else
# packages for Ubuntu <=15.x
SITL_PKGS+=$ " python-wxgtk2.8"
fi
# GNU Tools for ARM Embedded Processors
# (see https://launchpad.net/gcc-arm-embedded/)
ARM_ROOT="gcc-arm-none-eabi-4_9-2015q3"
ARM_TARBALL="$ARM_ROOT-20150921-linux.tar.bz2"
ARM_TARBALL_URL="http://firmware.ardupilot.org/Tools/PX4-tools/$ARM_TARBALL"
# Ardupilot Tools
ARDUPILOT_TOOLS="ardupilot/Tools/autotest"
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
}
OPTIND=1 # Reset in case getopts has been used previously in the shell.
while getopts "y" opt; do
case "$opt" in
\?)
exit 1
;;
y) ASSUME_YES=true
;;
esac
done
if $ASSUME_YES; then
APT_GET="sudo apt-get -qq --assume-yes"
else
APT_GET="sudo apt-get"
fi
sudo usermod -a -G dialout $USER
$APT_GET remove modemmanager
$APT_GET update
$APT_GET install $BASE_PKGS $SITL_PKGS $PX4_PKGS $BEBOP_PKGS $UBUNTU64_PKGS
sudo pip2 -q install $PYTHON_PKGS
if [ ! -d $OPT/$ARM_ROOT ]; then
(
cd $OPT;
sudo wget $ARM_TARBALL_URL;
sudo tar xjf ${ARM_TARBALL};
sudo rm ${ARM_TARBALL};
)
fi
exportline="export PATH=$OPT/$ARM_ROOT/bin:\$PATH";
if ! grep -Fxq "$exportline" ~/.profile ; then
if maybe_prompt_user "Add $OPT/$ARM_ROOT/bin to your PATH [Y/n]?" ; then
echo $exportline >> ~/.profile
$exportline
else
echo "Skipping adding $OPT/$ARM_ROOT/bin to PATH."
fi
fi
exportline2="export PATH=$CWD/$ARDUPILOT_TOOLS:\$PATH";
if ! grep -Fxq "$exportline2" ~/.profile ; then
if maybe_prompt_user "Add $CWD/$ARDUPILOT_TOOLS to your PATH [Y/n]?" ; then
echo $exportline2 >> ~/.profile
$exportline2
else
echo "Skipping adding $CWD/$ARDUPILOT_TOOLS to PATH."
fi
fi
apt-cache search arm-none-eabi
(
cd ardupilot
git submodule init
git submodule update
)