diff --git a/util/board_status/board_status.sh b/util/board_status/board_status.sh index 84319f10a7..f7300bdcdd 100644 --- a/util/board_status/board_status.sh +++ b/util/board_status/board_status.sh @@ -46,14 +46,10 @@ test_cmd() exit $EXIT_FAILURE } -# run a command -# -# $1: 0 to run command locally, 1 to run remotely if remote host defined -# $2: command -cmd() +_cmd() { if [ -e "$2" ]; then - return + return $EXIT_FAILURE fi if [[ $1 -eq $REMOTE && -n "$REMOTE_HOST" ]]; then @@ -61,6 +57,15 @@ cmd() else $2 fi +} + +# run a command +# +# $1: 0 to run command locally, 1 to run remotely if remote host defined +# $2: command +cmd() +{ + _cmd $1 $2 if [ $? -eq 0 ]; then return @@ -70,6 +75,21 @@ cmd() exit $EXIT_FAILURE } +# run a command where failure is considered to be non-fatal +# +# $1: 0 to run command locally, 1 to run remotely if remote host defined +# $2: command +cmd_nonfatal() +{ + _cmd $1 $2 + + if [ $? -eq 0 ]; then + return + fi + + echo "Failed to run command: $2" +} + show_help() { echo "Usage: ${0}