Skip to content
Snippets Groups Projects
Commit cc14e9b8 authored by thiebolt's avatar thiebolt
Browse files

update

parent 3f104be7
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
......@@ -2,20 +2,14 @@
#
# Deployment script for neOCampus / neOSensor ESP32 based boards
#
# F.Thiebol aug.20 initial release
# F.Thiebolt aug.20 initial release
#
#
# Global defs
ESP32_REV=${ESP32_REV:-"1.0.4"}
ESP32_DIR=${ESP32_DIR:-"~/.arduino15/packages/esp32/hardware/esp32/${ESP32_REV}"}
eval ESP32_DIR=${ESP32_DIR}
ESP32_SRCDIR="arduinoIDE_esp32_boards"
ESP8266_REV=${ESP8266_REV:-"2.7.4"}
ESP8266_REV=${ESP32_REV:-"2.7.4"}
ESP8266_DIR=${ESP32_DIR:-"~/.arduino15/packages/esp8266/hardware/esp8266/${ESP8266_REV}"}
eval ESP8266_DIR=${ESP32_DIR}
ESP8266_SRCDIR="arduinoIDE_esp8266_boards"
#
# function install
......@@ -23,10 +17,70 @@ ESP8266_SRCDIR="arduinoIDE_esp8266_boards"
# $2: SDK_REV (e.g "2.7.4" for esp8266 "1.0.4" for esp32)
function boards_install() {
[ $# -ne 2 ] && { return 1; }
ARCH=$1
SDK_REV=$2
SDK_DIR="~/.arduino15/packages/${ARCH,,}/hardware/${ARCH,,}/${SDK_REV}"
eval SDK_DIR=${SDK_DIR}
[ -d ${SDK_DIR} ] || { echo -e "unable to find dir '${SDK_DIR}' ... aborting" >&2; return 1; }
echo -e "# Detected ${ARCH,,} SDK dir:"
printf "%-80s\n" "${SDK_DIR}"
echo -e "# -------------------------------------------------------- #"
sleep 1
SRC_DIR="arduinoIDE_${ARCH,,}_boards"
[ -d ${SRC_DIR} ] || { echo -e "unable to find dir '${SRC_DIR}' ... aborting" >&2; return 1; }
#
# parse current variants directory
echo -e "# install boards #"
echo -e "# #"
_cpt=0
for variant_dir in $(/bin/ls -d ${SRC_DIR}/*); do
# [sep.20] NOT TESTED !!
# is it really a variant dir ??
_variant_dir=${variant_dir#*/}
_vdir=${_variant_dir%%/}
[ -f ${_vdir}/variant.h ] || { continue; }
echo -ne "${_vdir} --> install ${ARCH,,} board [y/N]? : "
read -e -n 1 answer
[ "X${answer,,}" != "Xy" ] && { echo -e "cancelled!"; continue; }
# copy variant dir
_destdir=${SDK_DIR}/variants/
rsync -av --delete --dry-run ${_vdir} ${_destdir} >& /dev/null
[ $? -ne 0 ] && { echo -e "\n#WARNING: unable to rsync ${_vdir} in ${_destdir} ... continuing!" >&2; sleep 2; continue; }
rsync -av --delete ${_vdir} ${_destdir}
[ $? -ne 0 ] && { echo -e "\n### ERROR while rsync of ${_vdir} in ${_destdir} ... aborting!" >&2; exit 1; }
echo -e "\tsuccessfully installed board '${_vdir}' :)"
(( _cpt++ ))
done
echo -e "# #"
echo -e "# -------------------------------------------------------- #"
#[aug.20] some boards does not have variant defs!
#[ "X${_cpt}" == "X0" ] && { exit 0; }
#
# copy local defs files
echo -e "# copy local files #"
echo -e "# #"
for local_file in $(/bin/ls ${SRC_DIR}/*local.txt); do
_local_file=${local_file#*/}
if [ -f ${SDK_DIR}/${_local_file} ]; then
echo -ne "overwrite existing ${SDK_DIR}/${_local_file} file [y/N]? :"
read -e -n 1 answer
[ "X${answer,,}" != "Xy" ] && { echo -e "cancelled!"; continue; }
fi
cp -af ${local_file} ${SDK_DIR}/ >& /dev/null
[ $? -ne 0 ] && { echo -e "\n### ERROR while copying '${local_file}' file to '${SDK_DIR}' directory ... aborting!" >&2; exit 1; }
echo -e "\tsuccessfully installed local file '${_local_file}'"
done
echo -e "# #"
echo -e "# -------------------------------------------------------- #"
return 0
}
TO BE CONTINUED
# usage
echo -e "\n############################################################"
......@@ -35,54 +89,12 @@ echo -e "# neOCampus ESP8266/ESP32 boards installer #"
echo -e "# #"
echo -e "# -------------------------------------------------------- #"
# check if target directory exists
[ -d ${ESP32_DIR} ] || { echo -e "###ERROR: unable to find dir '${ESP32_DIR}' ... aborting" >&2; exit 1; }
echo -e "# Detected esp32 install dir: #"
printf "%-80s\n" "${ESP32_DIR}"
echo -e "# -------------------------------------------------------- #"
sleep 1
# ESP32 boards
boards_install "ESP32" ${ESP32_REV}
[ $? -ne 0 ] && { echo -e "\n\tfailed to install additional ESP32 boards ?!?!" >&2; sleep 2; }
# parse current variants directory
echo -e "# install boards #"
echo -e "# #"
_cpt=0
for variant_dir in $(/bin/ls -d */); do
# is it really a variant dir ??
_vdir=${variant_dir%%/}
[ -f ${_vdir}/variant.h ] || { continue; }
echo -ne "${_vdir} --> install esp32 board [y/N]? : "
read -e -n 1 answer
[ "X${answer,,}" != "Xy" ] && { echo -e "cancelled!"; continue; }
# copy variant dir
_destdir=${ESP32_DIR}/variants/
rsync -av --delete --dry-run ${_vdir} ${_destdir} >& /dev/null
[ $? -ne 0 ] && { echo -e "\n#WARNING: unable to rsync ${_vdir} in ${_destdir} ... continuing!" >&2; sleep 2; continue; }
rsync -av --delete ${_vdir} ${_destdir}
[ $? -ne 0 ] && { echo -e "\n### ERROR while rsync of ${_vdir} in ${_destdir} ... aborting!" >&2; exit 1; }
echo -e "\tsuccessfully installed board '${_vdir}' :)"
(( _cpt++ ))
done
echo -e "# #"
echo -e "# -------------------------------------------------------- #"
#[aug.20] some boards does not have variant defs!
#[ "X${_cpt}" == "X0" ] && { exit 0; }
# copy local defs files
echo -e "# copy local files #"
echo -e "# #"
for local_file in $(/bin/ls *local.txt); do
if [ -f ${ESP32_DIR}/${local_file} ]; then
echo -ne "overwrite existing ${ESP32_DIR}/${local_file} file [y/N]? :"
read -e -n 1 answer
[ "X${answer,,}" != "Xy" ] && { echo -e "cancelled!"; continue; }
fi
cp -af ${local_file} ${ESP32_DIR}/ >& /dev/null
[ $? -ne 0 ] && { echo -e "\n### ERROR while copying '${local_file}' file to '${ESP32_DIR}' directory ... aborting!" >&2; exit 1; }
echo -e "\tsuccessfully installed local file '${local_file}'"
done
echo -e "# #"
echo -e "# -------------------------------------------------------- #"
boards_install "ESP8266" ${ESP8266_REV}
[ $? -ne 0 ] && { echo -e "\n\tfailed to install additional ESP8266 boards ?!?!" >&2; sleep 2; }
# finialize
echo -e "\nYou may restart your arduino toolchain to have your variants taken into account"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment