add install-prereqs-mac.sh

This commit is contained in:
Huibean 2018-02-24 16:15:23 +08:00 committed by Lucas De Marchi
parent 53b76efbd2
commit 7c499571ea
1 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,48 @@
#!/bin/bash
echo "Checking homebrew..."
$(which -s brew)
if [[ $? != 0 ]] ; then
echo "installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
echo "Homebrew installed"
fi
#install xconde dependencies
xcode-select --install
brew tap PX4/homebrew-px4
brew update
brew install genromfs
brew install gcc-arm-none-eabi
brew install gawk
echo "Checking pip..."
$(which -s pip)
if [[ $? != 0 ]] ; then
echo "installing pip..."
sudo easy_install pip
else
echo "pip installed"
fi
sudo pip2 install pyserial future catkin_pkg empy
SCRIPT_DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))
ARDUPILOT_ROOT=$(realpath "$SCRIPT_DIR/../../")
ARDUPILOT_TOOLS="Tools/autotest"
exportline="export PATH=$ARDUPILOT_ROOT/$ARDUPILOT_TOOLS:\$PATH";
grep -Fxq "$exportline" ~/.profile 2>/dev/null || {
read -p "Add $ARDUPILOT_ROOT/$ARDUPILOT_TOOLS to your PATH [Y/n]?" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]] ; then
echo $exportline >> ~/.profile
eval $exportline
else
echo "Skipping adding $ARDUPILOT_ROOT/$ARDUPILOT_TOOLS to PATH."
fi
}
git submodule update --init --recursive
echo "finished"