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
@ -54,13 +54,23 @@ fi
|
|||||||
|
|
||||||
# Load via dfu-util
|
# Load via dfu-util
|
||||||
# Used for McHCK based uCs
|
# Used for McHCK based uCs
|
||||||
|
if type dfu-util &>/dev/null; then
|
||||||
dfu-util -D @TARGET_BIN@
|
dfu-util -D @TARGET_BIN@
|
||||||
EXIT_STATUS=$?
|
EXIT_STATUS=$?
|
||||||
|
else
|
||||||
|
echo "dfu-util is required to reprogram the device"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
# Load Screen Session if specified
|
# Load Screen Session if specified
|
||||||
if (( "$EXIT_STATUS" == "0" )) && [[ "$AUTO_SCREEN_SESSION" != "" ]]; then
|
if (( "$EXIT_STATUS" == "0" )) && [[ "$AUTO_SCREEN_SESSION" != "" ]]; then
|
||||||
|
if type screen &>/dev/null; then
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
screen $AUTO_SCREEN_SESSION
|
screen $AUTO_SCREEN_SESSION
|
||||||
|
else
|
||||||
|
echo "screen is not installed"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit $EXIT_STATUS
|
exit $EXIT_STATUS
|
||||||
|
@ -50,7 +50,7 @@ if [ ! -e teensy-loader-cli/teensy-loader-cli ]; then
|
|||||||
mkdir -p teensy-loader-cli
|
mkdir -p teensy-loader-cli
|
||||||
cd teensy-loader-cli
|
cd teensy-loader-cli
|
||||||
cmake -G "Unix Makefiles" @CMAKE_SOURCE_DIR@/LoadFile
|
cmake -G "Unix Makefiles" @CMAKE_SOURCE_DIR@/LoadFile
|
||||||
make
|
make || exit 3
|
||||||
cd -
|
cd -
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -68,8 +68,13 @@ EXIT_STATUS=$?
|
|||||||
|
|
||||||
# Load Screen Session if specified
|
# Load Screen Session if specified
|
||||||
if (( "$EXIT_STATUS" == "0" )) && [[ "$AUTO_SCREEN_SESSION" != "" ]]; then
|
if (( "$EXIT_STATUS" == "0" )) && [[ "$AUTO_SCREEN_SESSION" != "" ]]; then
|
||||||
|
if type screen &>/dev/null; then
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
screen $AUTO_SCREEN_SESSION
|
screen $AUTO_SCREEN_SESSION
|
||||||
|
else
|
||||||
|
echo "screen is not installed"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit $EXIT_STATUS
|
exit $EXIT_STATUS
|
||||||
|
@ -49,7 +49,7 @@ if [ ! -e teensy-loader-cli/teensy-loader-cli ]; then
|
|||||||
mkdir -p teensy-loader-cli
|
mkdir -p teensy-loader-cli
|
||||||
cd teensy-loader-cli
|
cd teensy-loader-cli
|
||||||
cmake -G "Unix Makefiles" $(cygpath -u @CMAKE_SOURCE_DIR@/LoadFile)
|
cmake -G "Unix Makefiles" $(cygpath -u @CMAKE_SOURCE_DIR@/LoadFile)
|
||||||
make
|
make || exit 3
|
||||||
cd -
|
cd -
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user