board_status: Add longopt equivalents for older options

Long options can be useful when writing examples and documentation
as they are more expressive and obvious to the reader.

Change-Id: I39496765ba1f15ccc2ffe1ad730f0f95702f82b8
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://review.coreboot.org/14736
Tested-by: build bot (Jenkins)
Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
This commit is contained in:
David Hendricks 2016-05-07 11:44:05 -07:00 committed by David Hendricks
parent e065bb43d7
commit b2aa5283e6
1 changed files with 42 additions and 29 deletions

View File

@ -172,22 +172,24 @@ show_help() {
${0} <option> ${0} <option>
Options Options
-h -C, --clobber
Show this message.
-C
Clobber temporary output when finished. Useful for debugging. Clobber temporary output when finished. Useful for debugging.
-i <image> -h, --help
Show this message.
-i, --image <image>
Path to coreboot image (Default is $COREBOOT_IMAGE). Path to coreboot image (Default is $COREBOOT_IMAGE).
-r <host> -r, --remote-host <host>
Obtain machine information from remote host (using ssh). Obtain machine information from remote host (using ssh).
-s, --serial-device </dev/xxx>
Obtain boot log via serial device.
-S, --serial-speed <speed>
Set the port speed for the serial device (Default is $SERIAL_PORT_SPEED).
-u, --upload-results
Upload results to coreboot.org.
Long options:
--ssh-port <port> --ssh-port <port>
Use a specific SSH port. Use a specific SSH port.
-s </dev/xxx>
Obtain boot log via serial device.
-S <speed>
Set the port speed for the serial device (Default is $SERIAL_PORT_SPEED).
-u
Upload results to coreboot.org.
" "
} }
@ -197,41 +199,52 @@ if [ $? -ne 4 ]; then
exit $EXIT_FAILURE exit $EXIT_FAILURE
fi fi
ARGS=$(getopt -o Chi:r:s:S:u -l "ssh-port:" -n "$0" -- "$@"); LONGOPTS="clobber,help,image:,remote-host:,upload-results"
LONGOPTS="${LONGOPTS},serial-device:,serial-speed:"
LONGOPTS="${LONGOPTS},ssh-port:"
ARGS=$(getopt -o Chi:r:s:S:u -l "$LONGOPTS" -n "$0" -- "$@");
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
eval set -- "$ARGS" eval set -- "$ARGS"
while true ; do while true ; do
case "$1" in case "$1" in
-h) # generic options
-C|--clobber)
CLOBBER_OUTPUT=1
;;
-h|--help)
show_help show_help
exit $EXIT_SUCCESS exit $EXIT_SUCCESS
;; ;;
-C) -i|--image)
CLOBBER_OUTPUT=1
;;
-i)
shift shift
COREBOOT_IMAGE="$1" COREBOOT_IMAGE="$1"
;; ;;
-r) -r|--remote-host)
shift shift
REMOTE_HOST="$1" REMOTE_HOST="$1"
;; ;;
-u|--upload-results)
UPLOAD_RESULTS=1
;;
# serial port options
-s|--serial-device)
shift
SERIAL_DEVICE="$1"
;;
-S|--serial-speed)
shift
SERIAL_PORT_SPEED="$1"
;;
# ssh options
--ssh-port) --ssh-port)
shift shift
REMOTE_PORT_OPTION="-p $1" REMOTE_PORT_OPTION="-p $1"
;; ;;
-s)
shift # error handling
SERIAL_DEVICE="$1"
;;
-S)
shift
SERIAL_PORT_SPEED="$1"
;;
-u)
UPLOAD_RESULTS=1
;;
--) --)
shift shift
if [ -n "$*" ]; then if [ -n "$*" ]; then