Check for needed programs
Check for dfu-util and screen before using them. Also aborts if teensy_loader_cli compilation fails. Uses the type builtin to determine if a command exists. See here: https://gist.github.com/sdelmas/7377271
This commit is contained in:
parent
88ace02e51
commit
8d4adb41ec
3 changed files with 23 additions and 8 deletions
|
|
@ -54,13 +54,23 @@ fi
|
|||
|
||||
# Load via dfu-util
|
||||
# Used for McHCK based uCs
|
||||
dfu-util -D @TARGET_BIN@
|
||||
EXIT_STATUS=$?
|
||||
if type dfu-util &>/dev/null; then
|
||||
dfu-util -D @TARGET_BIN@
|
||||
EXIT_STATUS=$?
|
||||
else
|
||||
echo "dfu-util is required to reprogram the device"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Load Screen Session if specified
|
||||
if (( "$EXIT_STATUS" == "0" )) && [[ "$AUTO_SCREEN_SESSION" != "" ]]; then
|
||||
sleep 0.1
|
||||
screen $AUTO_SCREEN_SESSION
|
||||
if type screen &>/dev/null; then
|
||||
sleep 0.1
|
||||
screen $AUTO_SCREEN_SESSION
|
||||
else
|
||||
echo "screen is not installed"
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue