2013-04-04 14:52:39 -03:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2014-07-06 02:40:39 -03:00
|
|
|
CWD=$(pwd)
|
|
|
|
OPT="/opt"
|
|
|
|
|
2013-04-04 14:52:39 -03:00
|
|
|
BASE_PKGS="gawk make git arduino-core curl"
|
2014-07-05 20:27:15 -03:00
|
|
|
SITL_PKGS="g++ python-pip python-matplotlib python-serial python-wxgtk2.8 python-scipy python-opencv python-numpy python-pyparsing ccache"
|
2014-12-31 18:32:25 -04:00
|
|
|
AVR_PKGS="gcc-avr binutils-avr avr-libc"
|
2014-07-05 20:27:15 -03:00
|
|
|
PYTHON_PKGS="pymavlink MAVProxy droneapi"
|
2013-04-04 14:52:39 -03:00
|
|
|
PX4_PKGS="python-serial python-argparse openocd flex bison libncurses5-dev \
|
|
|
|
autoconf texinfo build-essential libftdi-dev libtool zlib1g-dev \
|
2013-10-22 04:33:45 -03:00
|
|
|
zip genromfs"
|
2015-07-14 01:25:56 -03:00
|
|
|
BEBOP_PKGS="g++-arm-linux-gnueabihf"
|
2014-07-05 20:27:15 -03:00
|
|
|
UBUNTU64_PKGS="libc6:i386 libgcc1:i386 gcc-4.6-base:i386 libstdc++5:i386 libstdc++6:i386"
|
2013-04-04 14:52:39 -03:00
|
|
|
ASSUME_YES=false
|
|
|
|
|
2014-02-02 19:41:14 -04:00
|
|
|
# GNU Tools for ARM Embedded Processors
|
|
|
|
# (see https://launchpad.net/gcc-arm-embedded/)
|
2014-10-17 13:08:13 -03:00
|
|
|
ARM_ROOT="gcc-arm-none-eabi-4_7-2014q2"
|
|
|
|
ARM_TARBALL="$ARM_ROOT-20140408-linux.tar.bz2"
|
|
|
|
ARM_TARBALL_URL="http://firmware.diydrones.com/Tools/PX4-tools/$ARM_TARBALL"
|
2014-02-02 19:41:14 -04:00
|
|
|
|
2014-07-05 20:27:15 -03:00
|
|
|
# Ardupilot Tools
|
|
|
|
ARDUPILOT_TOOLS="ardupilot/Tools/autotest"
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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
|
2014-07-05 20:27:15 -03:00
|
|
|
APT_GET="sudo apt-get -qq --assume-yes"
|
2013-04-04 14:52:39 -03:00
|
|
|
else
|
|
|
|
APT_GET="sudo apt-get"
|
|
|
|
fi
|
|
|
|
|
2014-07-05 20:27:15 -03:00
|
|
|
sudo usermod -a -G dialout $USER
|
|
|
|
|
|
|
|
$APT_GET remove modemmanager
|
2013-04-04 14:52:39 -03:00
|
|
|
$APT_GET update
|
2015-07-14 01:25:56 -03:00
|
|
|
$APT_GET install $BASE_PKGS $SITL_PKGS $PX4_PKGS $BEBOP_PKGS $UBUNTU64_PKGS $AVR_PKGS
|
2015-07-14 14:49:54 -03:00
|
|
|
sudo pip2 -q install $PYTHON_PKGS
|
2014-07-05 20:27:15 -03:00
|
|
|
|
2014-07-06 02:40:39 -03:00
|
|
|
if [ ! -d $OPT/$ARM_ROOT ]; then
|
2013-04-04 14:52:39 -03:00
|
|
|
(
|
2014-07-06 02:40:39 -03:00
|
|
|
cd $OPT;
|
|
|
|
sudo wget $ARM_TARBALL_URL;
|
|
|
|
sudo tar xjf ${ARM_TARBALL};
|
|
|
|
sudo rm ${ARM_TARBALL};
|
2013-04-04 14:52:39 -03:00
|
|
|
)
|
|
|
|
fi
|
2014-07-05 20:27:15 -03:00
|
|
|
|
2014-07-06 02:40:39 -03:00
|
|
|
exportline="export PATH=$OPT/$ARM_ROOT/bin:\$PATH";
|
2013-04-04 14:52:39 -03:00
|
|
|
if ! grep -Fxq "$exportline" ~/.profile ; then
|
2014-07-06 02:40:39 -03:00
|
|
|
if maybe_prompt_user "Add $OPT/$ARM_ROOT/bin to your PATH [Y/n]?" ; then
|
2013-04-04 14:52:39 -03:00
|
|
|
echo $exportline >> ~/.profile
|
2014-02-02 19:41:14 -04:00
|
|
|
$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
|
|
|
|
fi
|
2014-07-05 20:27:15 -03:00
|
|
|
|
2014-07-06 02:40:39 -03:00
|
|
|
exportline2="export PATH=$CWD/$ARDUPILOT_TOOLS:\$PATH";
|
2014-07-05 20:27:15 -03:00
|
|
|
if ! grep -Fxq "$exportline2" ~/.profile ; then
|
2014-07-06 02:40:39 -03:00
|
|
|
if maybe_prompt_user "Add $CWD/$ARDUPILOT_TOOLS to your PATH [Y/n]?" ; then
|
2014-07-05 20:27:15 -03:00
|
|
|
echo $exportline2 >> ~/.profile
|
|
|
|
$exportline2
|
|
|
|
else
|
2014-07-06 02:40:39 -03:00
|
|
|
echo "Skipping adding $CWD/$ARDUPILOT_TOOLS to PATH."
|
2014-07-05 20:27:15 -03:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2015-04-05 16:38:08 -03:00
|
|
|
apt-cache search arm-none-eabi
|
2015-06-09 03:51:55 -03:00
|
|
|
|
|
|
|
(
|
|
|
|
cd ardupilot
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
)
|