diff --git a/Vagrantfile b/Vagrantfile index 6e5c8633b..48041292e 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -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 ## diff --git a/scripts/provision.sh b/scripts/provision.sh index cdc4683b7..6e257bd60 100755 --- a/scripts/provision.sh +++ b/scripts/provision.sh @@ -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 @@ -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 - @@ -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 - @@ -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)" @@ -109,7 +110,7 @@ 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 @@ -117,6 +118,8 @@ if [ $ARM = "1" ]; then # 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 diff --git a/scripts/vagrant_provision.sh b/scripts/vagrant_provision.sh index d70e07c22..426147df5 100755 --- a/scripts/vagrant_provision.sh +++ b/scripts/vagrant_provision.sh @@ -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