summaryrefslogtreecommitdiff
path: root/util/board_status
diff options
context:
space:
mode:
authorIdwer Vollering <vidwer@gmail.com>2021-01-11 14:02:29 +0100
committerPatrick Georgi <pgeorgi@google.com>2021-01-25 09:08:22 +0000
commit3c70774629092f4a4945dc313e87735c6ab056d7 (patch)
treefb6e6e8986fe93506c75e30dc5703f2ee008a075 /util/board_status
parent22bcb5643bb8e96ded52d03ed02965cd3202c8cc (diff)
util/board_status/board_status.sh: improve getopt detection and usage on
non-linux OSes Signed-off-by: Idwer Vollering <vidwer@gmail.com> Change-Id: Iba50d8a8609eda974f12b0d9802e04d7371aed5b Reviewed-on: https://review.coreboot.org/c/coreboot/+/49307 Reviewed-by: David Hendricks <david.hendricks@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/board_status')
-rwxr-xr-xutil/board_status/board_status.sh18
1 files changed, 16 insertions, 2 deletions
diff --git a/util/board_status/board_status.sh b/util/board_status/board_status.sh
index 0054421493..5235a289fc 100755
--- a/util/board_status/board_status.sh
+++ b/util/board_status/board_status.sh
@@ -212,7 +212,21 @@ Long options:
"
}
-getopt -T
+case $(uname) in
+ FreeBSD)
+ if [ ! -x /usr/local/bin/getopt ]; then
+ echo "Please install getopt, or build and install misc/getopt from ports."
+ exit $EXIT_FAILURE
+ else
+ GETOPT=/usr/local/bin/getopt
+ fi
+ ;;
+ *)
+ GETOPT=/usr/bin/getopt
+ ;;
+esac
+
+$GETOPT -T
if [ $? -ne 4 ]; then
echo "GNU-compatible getopt(1) required."
exit $EXIT_FAILURE
@@ -222,7 +236,7 @@ LONGOPTS="cbmem:,clobber,help,image:,remote-host:,upload-results"
LONGOPTS="${LONGOPTS},serial-device:,serial-speed:"
LONGOPTS="${LONGOPTS},ssh-port:"
-ARGS=$(getopt -o c:n:Chi:r:s:S:u -l "$LONGOPTS" -n "$0" -- "$@");
+ARGS=$($GETOPT -o c:n:Chi:r:s:S:u -l "$LONGOPTS" -n "$0" -- "$@");
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
eval set -- "$ARGS"
while true ; do