Skip to content

Commit

Permalink
Updated *provision.sh scripts to get a valid VM
Browse files Browse the repository at this point in the history
  • Loading branch information
opichals committed Jan 21, 2018
1 parent 9ac1eb4 commit ef5678d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Vagrant.configure(2) do |config|

## PROVISIONING ##

config.vm.provision "shell", path: "./scripts/vagrant_provision.sh"
config.vm.provision "shell", inline: "cd /vagrant && ./scripts/vagrant_provision.sh"

## SSH ##

Expand Down
39 changes: 21 additions & 18 deletions scripts/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ fi
BOARDNAME=$1
FAMILY=`scripts/get_board_info.py $BOARDNAME 'board.chip["family"]'`

if [ $FAMILY = "ESP32" ]; then
if [ "$FAMILY" = "ESP32" ]; then
echo ESP32
# needed for esptool for merging binaries
python -m pip install pyserial
sudo apt-get install -qq -y python python-pip
sudo pip -q install pyserial
# SDK
if [ ! -d "app" ]; then
echo installing app folder
Expand All @@ -43,7 +44,7 @@ if [ $FAMILY = "ESP32" ]; then
echo installing esp-idf folder
curl -Ls https://github.com/espruino/EspruinoBuildTools/raw/master/esp32/deploy/esp-idf.tgz | tar xfz -
fi
if ! type xtensa-esp32-elf-gcc > /dev/null; then
if ! type xtensa-esp32-elf-gcc 2> /dev/null > /dev/null; then
echo installing xtensa-esp32-elf-gcc
if [ ! -d "xtensa-esp32-elf" ]; then
curl -Ls https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-61-gab8375a-5.2.0.tar.gz | tar xfz -
Expand All @@ -56,13 +57,13 @@ if [ $FAMILY = "ESP32" ]; then
export ESP_APP_TEMPLATE_PATH=`pwd`/app
export PATH=$PATH:`pwd`/xtensa-esp32-elf/bin/
return 0
elif [ $FAMILY = "ESP8266" ]; then
elif [ "$FAMILY" = "ESP8266" ]; then
echo ESP8266
if [ ! -d "esp_iot_sdk_v2.0.0.p1" ]; then
echo esp_iot_sdk_v2.0.0.p1
curl -Ls http://s3.voneicken.com/esp_iot_sdk_v2.0.0.p1.tgx | tar Jxf -
fi
if ! type xtensa-lx106-elf-gcc > /dev/null; then
if ! type xtensa-lx106-elf-gcc 2> /dev/null > /dev/null; then
echo installing xtensa-lx106-elf-gcc
if [ ! -d "xtensa-lx106-elf" ]; then
curl -Ls http://s3.voneicken.com/xtensa-lx106-elf-20160330.tgx | tar Jxf -
Expand All @@ -75,31 +76,31 @@ elif [ $FAMILY = "ESP8266" ]; then
export ESP8266_SDK_ROOT=`pwd`/esp_iot_sdk_v2.0.0.p1
export PATH=$PATH:`pwd`/xtensa-lx106-elf/bin/
return 0
elif [ $FAMILY = "LINUX" ]; then
elif [ "$FAMILY" = "LINUX" ]; then
echo LINUX
# Raspberry Pi?
return 0
elif [ $FAMILY = "NRF52" ]; then
elif [ "$FAMILY" = "NRF52" ]; then
echo NRF52
if ! type nrfutil > /dev/null; then
if ! type nrfutil 2> /dev/null > /dev/null; then
echo Installing nrfutil
sudo apt-get install -y python python-pip
sudo pip install nrfutil
sudo apt-get install -qq -y python python-pip
sudo pip -q install nrfutil
fi
ARM=1
elif [ $FAMILY = "NRF51" ]; then
elif [ "$FAMILY" = "NRF51" ]; then
ARM=1
elif [ $FAMILY = "STM32F1" ]; then
elif [ "$FAMILY" = "STM32F1" ]; then
ARM=1
elif [ $FAMILY = "STM32F3" ]; then
elif [ "$FAMILY" = "STM32F3" ]; then
ARM=1
elif [ $FAMILY = "STM32F4" ]; then
elif [ "$FAMILY" = "STM32F4" ]; then
ARM=1
elif [ $FAMILY = "STM32L4" ]; then
elif [ "$FAMILY" = "STM32L4" ]; then
ARM=1
elif [ $FAMILY = "EFM32GG" ]; then
elif [ "$FAMILY" = "EFM32GG" ]; then
ARM=1
elif [ $FAMILY = "SAMD" ]; then
elif [ "$FAMILY" = "SAMD" ]; then
ARM=1
else
echo "Unknown board ($BOARDNAME) or family ($FAMILY)"
Expand All @@ -109,14 +110,16 @@ fi
if [ $ARM = "1" ]; then
# defaulting to ARM
echo ARM
if ! type arm-none-eabi-gcc > /dev/null; then
if ! type arm-none-eabi-gcc 2> /dev/null > /dev/null; then
echo installing gcc-arm-embedded
#sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
#sudo apt-get update
#sudo apt-get --force-yes --yes install libsdl1.2-dev gcc-arm-embedded
# Unpack - newer, and much faster
if [ ! -d "gcc-arm-none-eabi-6-2017-q1-update" ]; then
curl -Ls https://github.com/espruino/EspruinoBuildTools/raw/master/arm/gcc-arm-none-eabi-6-2017-q1-update-linux.tar.bz2 | tar xfj -
else
echo "Folder found"
fi
export PATH=$PATH:`pwd`/gcc-arm-none-eabi-6-2017-q1-update/bin
fi
Expand Down
4 changes: 2 additions & 2 deletions scripts/vagrant_provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# This script is run by Vagrant when a new machine is provisioned.
#

sudo apt-get -y install git
sudo apt-get -qq -y install git

# move to 'Espruino' directory
cd `dirname $0`/..

# Attempt to provision for all required platforms
source scripts/provision.sh ESP8266
source scripts/provision.sh ESP8266_BOARD
source scripts/provision.sh ESP32
source scripts/provision.sh PUCKJS

Expand Down

0 comments on commit ef5678d

Please sign in to comment.