Created
November 12, 2019 00:43
-
-
Save byq77/5311e8a3459ceef445eeed0a96a02922 to your computer and use it in GitHub Desktop.
ROSbot firmware update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USAGE_STR="Usage: ./fw_update.sh <tag> e.g. ./fw_update.sh 0.9.0" | |
MACHINE=`uname -m` | |
if [ ${#} -ne 1 ]; then | |
echo -e "Wrong number of arguments.\n$USAGE_STR" | |
exit 1 | |
fi | |
IS_OK=`curl -I -s https://files.husarion.com/rosbot-firmware/rosbot-2.0-fw-v${1}.bin | head -n 1 - | grep -e '200' -c` | |
if [ $IS_OK -eq 1 ]; then | |
echo "The tag ${1} exists. Downloading..." | |
if [ "$MACHINE" = "armv7l" ]; then | |
curl -o firmware.bin https://files.husarion.com/rosbot-firmware/rosbot-2.0-fw-v${1}.bin && sudo stm32loader -c tinker -u -W && sudo stm32loader -c tinker -e -w -v firmware.bin | |
else | |
curl -o firmware.bin https://files.husarion.com/rosbot-firmware/rosbot-2.0-pro-fw-v${1}.bin && sudo stm32loader -c upboard -u -W && sudo stm32loader -c tinker -e -w -v firmware.bin | |
fi | |
rm firmware.bin | |
else | |
echo "Tag ${1} does not exist. Exiting..." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment