#!/bin/bash

cd 

# git update-git-for-windows

# if type -p arduino-cli >/dev/null; then
#   echo "arduino-cli is installed."
#   sleep 1
# else 
# install (or upgrade) arduino-cli 
  curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
# fi

arduino-cli update
arduino-cli upgrade
arduino-cli version

# download m5scp2_exp (by miura)
if [ -d "m5scp2_exp" ]; then
  echo "m5scp2_exp folder exists."
else
  git clone https://git.istlab.info/git/miura250/m5scp2_exp.git
fi

cd m5scp2_exp
git pull
ls -al
./setup.sh

if [ ! -d "build" ]; then
  echo "cd m5scp2_exp"
  echo "./compile.sh"
  echo "FactoryTest2022 の初回コンパイルをします。数分固まったようにみえます。"
  ./compile.sh
fi
