Improve the setup helpers

This commit is contained in:
Danny Staple
2022-03-06 16:26:19 +00:00
parent 878b50fb65
commit d3dc43fa50
3 changed files with 24 additions and 7 deletions
+1
View File
@@ -1 +1,2 @@
#!/bin/bash
screen /dev/tty.usbmo* 115200
+6 -6
View File
@@ -5,8 +5,8 @@ DEST=/volumes/CIRCUITPY
# take the param, strip the filename.
source="$1"
support_files="${@:2}"
sourcebase="$(basename $source)"
support_files=( "${@:2}" )
sourcebase="$(basename "$source")"
# get the filename without the extension.
module="${sourcebase%.py}"
@@ -14,13 +14,13 @@ module="${sourcebase%.py}"
echo "" >${DEST}/code.py
# send the file
cp ${source} ${DEST}/${sourcebase}
cp "${source}" "${DEST}/${sourcebase}"
# make a code.py
echo "import ${module}" >${DEST}/code.py
echo "import ${module}" >"${DEST}/code.py"
if [ -n "${support_files}" ]; then
for file in ${support_files}; do
if [ -n "${support_files[*]}" ]; then
for file in "${support_files[@]}"; do
cp "$file" "${DEST}/$(basename "${file}")"
done
fi
+16
View File
@@ -0,0 +1,16 @@
#!/bin/bash
set -eiu -o pipefail
DEST=/volumes/CIRCUITPY
LIBRARY_SRC=/Users/danielstaple/git_work/projects_in_cloud/book_authoring/book-research/pico-book-research/circuitpython/3rdparty/built/adafruit-circuitpython-bundle-7.x-mpy-20220228
FILES=(adafruit_pioasm.mpy adafruit_requests.mpy adafruit_vl53l1x.mpy)
FOLDERS=(adafruit_wsgi adafruit_esp32spi)
for file in "${FILES[@]}"; do
cp -v "${LIBRARY_SRC}/lib/${file}" "${DEST}/lib/${file}"
done
for folder in "${FOLDERS[@]}"; do
rsync -rv "${LIBRARY_SRC}/lib/${folder}" "${DEST}/lib/${folder}"
done