diff LoadFile/load.teensy @ 281:71882cd1c362

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
author Rowan Decker <Smasher816@gmail.com>
date Thu, 12 Feb 2015 19:42:01 -0800
parents 2a3468f5d8be
children ecd2ae35d25c
line wrap: on
line diff
--- a/LoadFile/load.teensy	Thu Feb 12 19:37:19 2015 -0800
+++ b/LoadFile/load.teensy	Thu Feb 12 19:42:01 2015 -0800
@@ -50,7 +50,7 @@
 	mkdir -p teensy-loader-cli
 	cd teensy-loader-cli
 	cmake -G "Unix Makefiles" @CMAKE_SOURCE_DIR@/LoadFile
-	make
+	make || exit 3
 	cd -
 fi
 
@@ -68,8 +68,13 @@
 
 # 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