From 8fccd469cc87991942aae07dd8b1ae5a5e0dc78a Mon Sep 17 00:00:00 2001 From: afresh1 Date: Wed, 12 Jan 2022 02:21:15 +0000 Subject: [PATCH] Bug fixes and performance improvements Plus improving usage to match the man page fine deraadt@ --- usr.sbin/fw_update/fw_update.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/usr.sbin/fw_update/fw_update.sh b/usr.sbin/fw_update/fw_update.sh index 84f00f5d7ba..4bf69b11632 100644 --- a/usr.sbin/fw_update/fw_update.sh +++ b/usr.sbin/fw_update/fw_update.sh @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: fw_update.sh,v 1.29 2022/01/11 03:25:52 afresh1 Exp $ +# $OpenBSD: fw_update.sh,v 1.30 2022/01/12 02:21:15 afresh1 Exp $ # # Copyright (c) 2021 Andrew Hewus Fresh # @@ -95,7 +95,7 @@ fetch() { SECONDS=0 sleep 1 else - kill -INT -"$FTPPID" + kill -INT -"$FTPPID" 2>/dev/null _error=" (timed out)" fi else @@ -201,14 +201,14 @@ detect_firmware() { set -sA _devices -- $( firmware_in_dmesg for _d in $( installed_firmware '*' '-firmware-' '*' ); do - echo "$( firmware_devicename "$_d" )" + firmware_devicename "$_d" done ) [ "${_devices[*]:-}" ] || return 0 for _d in "${_devices[@]}"; do - [[ $_last = $_d ]] && continue - echo $_d + [ "$_last" = "$_d" ] && continue + echo "$_d" _last="$_d" done } @@ -286,7 +286,7 @@ delete_firmware() { } usage() { - echo "usage: ${0##*/} [-d | -F] [-av] [-p path] [driver | file ...]" + echo "usage: ${0##*/} [-adFnv] [-p path] [driver | file ...]" exit 2 } @@ -352,11 +352,11 @@ fi set -sA devices -- "$@" if "$DELETE"; then - [ "$OPT_F" ] && usage 22 + [ "$OPT_F" ] && echo "Cannot use -F and -d" >&2 && usage 22 set -A installed if [ "${devices[*]:-}" ]; then - "$ALL" && usage 22 + "$ALL" && echo "Cannot use -a and devices/files" >&2 && usage 22 set -A installed -- $( for d in "${devices[@]}"; do @@ -389,7 +389,7 @@ if "$DELETE"; then done fi - deleted="${deleted:+${deleted#,}}" + deleted="${deleted#,}" echo "${0:##*/}: deleted ${deleted:-none}"; exit @@ -403,7 +403,7 @@ fi CFILE="$LOCALSRC/$CFILE" if [ "${devices[*]:-}" ]; then - "$ALL" && usage 22 + "$ALL" && echo "Cannot use -a and devices/files" >&2 && usage 22 else "$VERBOSE" && echo -n "Detecting firmware ..." set -sA devices -- $( detect_firmware ) -- 2.20.1