2015-07-31 13:54:12 -03:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
2016-11-03 08:09:41 -03:00
|
|
|
set -x
|
2015-07-31 13:54:12 -03:00
|
|
|
|
|
|
|
command -v yaourt >/dev/null 2>&1 || { echo >&2 "Please install yaourt first. Aborting."; exit 1; }
|
|
|
|
|
|
|
|
CWD=$(pwd)
|
|
|
|
OPT="/opt"
|
|
|
|
|
2016-10-13 13:50:07 -03:00
|
|
|
BASE_PKGS="base-devel ccache git-core gsfonts tk wget"
|
2017-03-14 14:53:26 -03:00
|
|
|
SITL_PKGS="python2-pip python-pip wxpython opencv python2-numpy python2-scipy"
|
2016-10-31 11:45:39 -03:00
|
|
|
PX4_PKGS="lib32-glibc zip zlib ncurses cmake"
|
2015-07-31 13:54:12 -03:00
|
|
|
|
2016-10-13 13:50:07 -03:00
|
|
|
PYTHON2_PKGS="future lxml pymavlink MAVProxy argparse matplotlib pyparsing"
|
2015-07-31 13:54:12 -03:00
|
|
|
PYTHON3_PKGS="pyserial empy"
|
|
|
|
ARCH_AUR_PKGS="genromfs"
|
|
|
|
|
|
|
|
# GNU Tools for ARM Embedded Processors
|
|
|
|
# (see https://launchpad.net/gcc-arm-embedded/)
|
2015-10-20 01:28:13 -03:00
|
|
|
ARM_ROOT="gcc-arm-none-eabi-4_9-2015q3"
|
2015-10-20 01:54:44 -03:00
|
|
|
ARM_TARBALL="$ARM_ROOT-20150921-linux.tar.bz2"
|
2018-07-18 21:56:57 -03:00
|
|
|
ARM_TARBALL_URL="http://firmware.ardupilot.org/Tools/STM32-tools/$ARM_TARBALL"
|
2015-07-31 13:54:12 -03:00
|
|
|
|
|
|
|
# Ardupilot Tools
|
|
|
|
ARDUPILOT_TOOLS="ardupilot/Tools/autotest"
|
|
|
|
|
|
|
|
function prompt_user() {
|
|
|
|
read -p "$1"
|
|
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
sudo usermod -a -G uucp $USER
|
|
|
|
|
2018-02-06 14:33:47 -04:00
|
|
|
sudo pacman -S --noconfirm --needed $BASE_PKGS $SITL_PKGS $PX4_PKGS
|
2016-10-13 13:50:07 -03:00
|
|
|
sudo pip2 -q install -U $PYTHON2_PKGS
|
|
|
|
sudo pip3 -q install -U $PYTHON3_PKGS
|
2018-02-06 14:33:47 -04:00
|
|
|
yaourt -S --noconfirm --needed $ARCH_AUR_PKGS
|
2015-07-31 13:54:12 -03:00
|
|
|
|
2015-08-12 00:15:48 -03:00
|
|
|
(
|
2018-02-05 19:59:27 -04:00
|
|
|
cd /usr/lib/ccache
|
|
|
|
if [ ! -f arm-none-eabi-g++ ]; then
|
|
|
|
sudo ln -s /usr/bin/ccache arm-none-eabi-g++
|
|
|
|
fi
|
|
|
|
if [ ! -f arm-none-eabi-g++ ]; then
|
|
|
|
sudo ln -s /usr/bin/ccache arm-none-eabi-gcc
|
|
|
|
fi
|
2015-08-12 00:15:48 -03:00
|
|
|
)
|
|
|
|
|
2015-07-31 13:54:12 -03:00
|
|
|
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" ~/.bashrc ; then
|
|
|
|
if prompt_user "Add $OPT/$ARM_ROOT/bin to your PATH [Y/n]?" ; then
|
|
|
|
echo "$exportline" >> ~/.bashrc
|
|
|
|
. ~/.bashrc
|
|
|
|
else
|
|
|
|
echo "Skipping adding $OPT/$ARM_ROOT/bin to PATH."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
exportline2="export PATH=$CWD/$ARDUPILOT_TOOLS:\$PATH";
|
|
|
|
if ! grep -Fxq "$exportline2" ~/.bashrc ; then
|
|
|
|
if prompt_user "Add $CWD/$ARDUPILOT_TOOLS to your PATH [Y/n]?" ; then
|
|
|
|
echo "$exportline2" >> ~/.bashrc
|
|
|
|
. ~/.bashrc
|
|
|
|
else
|
|
|
|
echo "Skipping adding $CWD/$ARDUPILOT_TOOLS to PATH."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-02-06 14:28:40 -04:00
|
|
|
SCRIPT_DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))
|
2015-07-31 13:54:12 -03:00
|
|
|
(
|
2018-02-06 14:28:40 -04:00
|
|
|
cd $SCRIPT_DIR
|
2018-07-18 21:56:57 -03:00
|
|
|
git submodule update --init --recursive
|
2015-07-31 13:54:12 -03:00
|
|
|
)
|
|
|
|
|
|
|
|
echo "Done. Please log out and log in again."
|