update batch scripts to further check filename.

This commit is contained in:
Thomas Göttgens
2022-11-26 17:00:33 +01:00
parent 185ceac9df
commit 082aa07e7f
4 changed files with 15 additions and 7 deletions

View File

@@ -12,6 +12,7 @@ Flash image file to device, leave existing system intact."
-p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerrous).
-P PYTHON Specify alternate python interpreter to use to invoke esptool. (Default: "$PYTHON")
-f FILENAME The *update.bin file to flash. Custom to your device type.
EOF
}
@@ -42,12 +43,12 @@ shift "$((OPTIND-1))"
shift
}
if [ -f "${FILENAME}" ]; then
echo "Trying to flash update ${FILENAME}."
if [ -f "${FILENAME}" ] && [ $FILENAME == *"update"* ]; then
printf "Trying to flash update ${FILENAME}"
$PYTHON -m esptool --baud 115200 write_flash 0x10000 ${FILENAME}
else
echo "Invalid file: ${FILENAME}"
show_help
echo "Invalid file: ${FILENAME}"
fi
exit 0