mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-22 07:44:03 -04:00
tools: In install-prereqs-ubuntu.sh add support for relative paths
Install the required projects (PX4*) in the same folder from where the script is called. Install the arm toolchain at /opt
This commit is contained in:
parent
b76b090acd
commit
ff11b13f9c
@ -1,6 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
CWD=$(pwd)
|
||||
OPT="/opt"
|
||||
|
||||
BASE_PKGS="gawk make git arduino-core curl"
|
||||
SITL_PKGS="g++ python-pip python-matplotlib python-serial python-wxgtk2.8 python-scipy python-opencv python-numpy python-pyparsing ccache"
|
||||
PYTHON_PKGS="pymavlink MAVProxy droneapi"
|
||||
@ -19,7 +22,6 @@ ARM_TARBALL_URL="https://launchpad.net/gcc-arm-embedded/4.8/4.8-2013-q4-major/+d
|
||||
# Ardupilot Tools
|
||||
ARDUPILOT_TOOLS="ardupilot/Tools/autotest"
|
||||
|
||||
|
||||
function maybe_prompt_user() {
|
||||
if $ASSUME_YES; then
|
||||
return 0
|
||||
@ -59,40 +61,40 @@ $APT_GET install $BASE_PKGS $SITL_PKGS $PX4_PKGS $UBUNTU64_PKGS
|
||||
sudo pip -q install $PYTHON_PKGS
|
||||
|
||||
|
||||
if [ ! -d ~/PX4Firmware ]; then
|
||||
git clone https://github.com/diydrones/PX4Firmware.git ~/PX4Firmware
|
||||
if [ ! -d PX4Firmware ]; then
|
||||
git clone https://github.com/diydrones/PX4Firmware.git
|
||||
fi
|
||||
|
||||
if [ ! -d ~/PX4NuttX ]; then
|
||||
git clone https://github.com/diydrones/PX4NuttX.git ~/PX4NuttX
|
||||
if [ ! -d PX4NuttX ]; then
|
||||
git clone https://github.com/diydrones/PX4NuttX.git
|
||||
fi
|
||||
|
||||
if [ ! -d ~/$ARM_ROOT ]; then
|
||||
if [ ! -d $OPT/$ARM_ROOT ]; then
|
||||
(
|
||||
cd ~;
|
||||
curl -OL $ARM_TARBALL_URL;
|
||||
tar xjf ${ARM_TARBALL};
|
||||
rm ${ARM_TARBALL};
|
||||
cd $OPT;
|
||||
sudo wget $ARM_TARBALL_URL;
|
||||
sudo tar xjf ${ARM_TARBALL};
|
||||
sudo rm ${ARM_TARBALL};
|
||||
)
|
||||
fi
|
||||
|
||||
exportline="export PATH=$HOME/$ARM_ROOT/bin:\$PATH";
|
||||
exportline="export PATH=$OPT/$ARM_ROOT/bin:\$PATH";
|
||||
if ! grep -Fxq "$exportline" ~/.profile ; then
|
||||
if maybe_prompt_user "Add $HOME/$ARM_ROOT/bin to your PATH [Y/n]?" ; then
|
||||
if maybe_prompt_user "Add $OPT/$ARM_ROOT/bin to your PATH [Y/n]?" ; then
|
||||
echo $exportline >> ~/.profile
|
||||
$exportline
|
||||
else
|
||||
echo "Skipping adding $HOME/$ARM_ROOT/bin to PATH."
|
||||
echo "Skipping adding $OPT/$ARM_ROOT/bin to PATH."
|
||||
fi
|
||||
fi
|
||||
|
||||
exportline2="export PATH=$HOME/$ARDUPILOT_TOOLS:\$PATH";
|
||||
exportline2="export PATH=$CWD/$ARDUPILOT_TOOLS:\$PATH";
|
||||
if ! grep -Fxq "$exportline2" ~/.profile ; then
|
||||
if maybe_prompt_user "Add $HOME/$ARDUPILOT_TOOLS to your PATH [Y/n]?" ; then
|
||||
if maybe_prompt_user "Add $CWD/$ARDUPILOT_TOOLS to your PATH [Y/n]?" ; then
|
||||
echo $exportline2 >> ~/.profile
|
||||
$exportline2
|
||||
else
|
||||
echo "Skipping adding $HOME/$ARDUPILOT_TOOLS to PATH."
|
||||
echo "Skipping adding $CWD/$ARDUPILOT_TOOLS to PATH."
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user