Index | Thread | Search

From:
Andrew Hewus Fresh <andrew@afresh1.com>
Subject:
Make fw_update -a mean all available firmware
To:
tech@openbsd.org
Date:
Wed, 9 Oct 2024 18:23:15 -0700

Download raw body.

Thread
Someone at EuroBSDCon mentioned that `fw_update -a` doesn't install all
firmware, but instead only detected.

I suppose it makes sense that all means all, and I could see the use
with `-F`.

If whoever that was at EuroBSDCon could remind me, I'd like to give
credit.

Comments, suggestions, OK?

Index: fw_update.8
===================================================================
RCS file: /cvs/src/usr.sbin/fw_update/fw_update.8,v
retrieving revision 1.3
diff -u -p -r1.3 fw_update.8
--- fw_update.8	9 Mar 2022 22:39:12 -0000	1.3
+++ fw_update.8	10 Oct 2024 01:04:20 -0000
@@ -31,7 +31,9 @@ The
 utility installs, updates, or deletes firmware packages for
 .Ar driver
 from the Internet.
-If no
+If neither
+.Fl a
+or any
 .Ar driver
 is specified, the
 .Nm
@@ -51,9 +53,6 @@ Install or update firmware for all drive
 It is an error to specify this option with any
 .Ar driver
 arguments.
-This is enabled by default unless drivers, files or
-.Fl d
-are specified.
 .It Fl d
 Delete firmware for
 .Ar driver .
Index: fw_update.sh
===================================================================
RCS file: /cvs/src/usr.sbin/fw_update/fw_update.sh,v
retrieving revision 1.56
diff -u -p -r1.56 fw_update.sh
--- fw_update.sh	21 Mar 2024 01:02:29 -0000	1.56
+++ fw_update.sh	10 Oct 2024 01:04:20 -0000
@@ -331,6 +331,11 @@ EOL
 	return 0
 }
 
+available_firmware() {
+	check_cfile || return $?
+	sed -n 's/.*(\(.*\)-firmware.*/\1/p' "$CFILE"
+}
+
 installed_firmware() {
 	local _pre="$1" _match="$2" _post="$3" _firmware _fw
 	set -sA _firmware -- $(
@@ -626,6 +631,8 @@ CFILE="$LOCALSRC/$CFILE"
 
 if [ "${devices[*]:-}" ]; then
 	"$ALL" && warn "Cannot use -a and devices/files" && usage
+elif "$ALL"; then
+	set -sA devices -- $( available_firmware )
 else
 	((VERBOSE > 1)) && echo -n "Detect firmware ..."
 	set -sA devices -- $( detect_firmware )