#!/bin/sh PYTHON=${PYTHON:-$(which python3 python | head -n 1)} # Usage info show_help() { cat <&2 exit 1 ;; esac done shift "$((OPTIND - 1))" [ -z "$FILENAME" -a -n "$1" ] && { FILENAME=$1 shift } if [ -f "${FILENAME}" ] && [ -z "${FILENAME##*"update"*}" ]; then printf "Trying to flash update ${FILENAME}" $PYTHON -m esptool --baud 115200 write_flash 0x10000 ${FILENAME} else show_help echo "Invalid file: ${FILENAME}" fi exit 0