Mercurial > louis > kiibohd-controller
comparison 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 |
comparison
equal
deleted
inserted
replaced
280:18b61e53753c | 281:71882cd1c362 |
---|---|
48 if [ ! -e teensy-loader-cli/teensy-loader-cli ]; then | 48 if [ ! -e teensy-loader-cli/teensy-loader-cli ]; then |
49 # Compile teensy-loader-cli | 49 # Compile teensy-loader-cli |
50 mkdir -p teensy-loader-cli | 50 mkdir -p teensy-loader-cli |
51 cd teensy-loader-cli | 51 cd teensy-loader-cli |
52 cmake -G "Unix Makefiles" @CMAKE_SOURCE_DIR@/LoadFile | 52 cmake -G "Unix Makefiles" @CMAKE_SOURCE_DIR@/LoadFile |
53 make | 53 make || exit 3 |
54 cd - | 54 cd - |
55 fi | 55 fi |
56 | 56 |
57 # If a SERIAL_PORT was specified set the uC into reflash mode | 57 # If a SERIAL_PORT was specified set the uC into reflash mode |
58 # XXX May not be successful if uC is not in a good state (or does not allow remote flashing) | 58 # XXX May not be successful if uC is not in a good state (or does not allow remote flashing) |
66 teensy-loader-cli/teensy-loader-cli -mmcu=@MCU@ -w @TARGET_HEX@ | 66 teensy-loader-cli/teensy-loader-cli -mmcu=@MCU@ -w @TARGET_HEX@ |
67 EXIT_STATUS=$? | 67 EXIT_STATUS=$? |
68 | 68 |
69 # Load Screen Session if specified | 69 # Load Screen Session if specified |
70 if (( "$EXIT_STATUS" == "0" )) && [[ "$AUTO_SCREEN_SESSION" != "" ]]; then | 70 if (( "$EXIT_STATUS" == "0" )) && [[ "$AUTO_SCREEN_SESSION" != "" ]]; then |
71 sleep 0.1 | 71 if type screen &>/dev/null; then |
72 screen $AUTO_SCREEN_SESSION | 72 sleep 0.1 |
73 screen $AUTO_SCREEN_SESSION | |
74 else | |
75 echo "screen is not installed" | |
76 exit 3 | |
77 fi | |
73 fi | 78 fi |
74 | 79 |
75 exit $EXIT_STATUS | 80 exit $EXIT_STATUS |
76 | 81 |