From: Andrew Hewus Fresh Subject: fw_update -l -- list devices/firmware To: tech@openbsd.org Date: Mon, 4 Nov 2024 17:34:45 -0800 Next fw_update feature is a "list" of devices or firmware. This might be useful when downloading firmware for a machine without Internet access. For example: openbsd-host $ fw_update -F $( ssh host-without-outbound fw_update -l ) openbsd-host $ scp SHA256.sig *.tgz host-without-outbond:/tmp/fw Or perhaps you are on a host without fw_update, but you have wget or similar: linux-host $ wget $( ssh host-without-outbound fw_update -lF ) linux-host $ scp SHA256.sig *.tgz host-without-outbond:/tmp/fw In either case, you could then use: host-without-outbound $ fw_update -p /tmp/fw or host-without-outbound $ fw_update /tmp/fw/*.tgz Comments, questions, OK? Index: fw_update.8 =================================================================== RCS file: /cvs/src/usr.sbin/fw_update/fw_update.8,v diff -u -p -r1.5 fw_update.8 --- fw_update.8 4 Nov 2024 00:34:47 -0000 1.5 +++ fw_update.8 4 Nov 2024 18:09:28 -0000 @@ -22,7 +22,7 @@ .Nd install non-free firmware .Sh SYNOPSIS .Nm -.Op Fl adFnv +.Op Fl adFlnv .Op Fl p Ar path .Op Ar driver | file ... .Sh DESCRIPTION @@ -59,6 +59,11 @@ If used in conjunction with delete firmware for all drivers. .It Fl F Download SHA256.sig and firmware .tgz to the current directory. +.It Fl l +List the detected drivers that need firmware. +With +.Fl F +lists the full path to the files that will be downloaded. .It Fl n Dry run. Do not actually install or update any firmware; Index: fw_update.sh =================================================================== RCS file: /cvs/src/usr.sbin/fw_update/fw_update.sh,v diff -u -p -r1.59 fw_update.sh --- fw_update.sh 4 Nov 2024 01:24:00 -0000 1.59 +++ fw_update.sh 4 Nov 2024 18:09:28 -0000 @@ -496,12 +496,14 @@ usage() { ALL=false DOWNLOAD_ONLY=false -while getopts :adFnp:v name +LIST=false +while getopts :adFlnp:v name do case "$name" in a) ALL=true ;; d) DELETE=true ;; F) DOWNLOAD_ONLY=true ;; + l) LIST=true ;; n) DRYRUN=true ;; p) FWURL="$OPTARG" ;; v) ((++VERBOSE)) ;; @@ -517,6 +519,8 @@ do done shift $((OPTIND - 1)) +"$LIST" && VERBOSE=1 + # Progress bars, not spinner When VERBOSE > 1 ((VERBOSE > 1)) && ENABLE_SPINNER=false @@ -537,7 +541,7 @@ elif [ "$LOCALSRC" ]; then fi if [ -x /usr/bin/id ] && [ "$(/usr/bin/id -u)" != 0 ]; then - if "$DOWNLOAD_ONLY"; then + if "$DOWNLOAD_ONLY" || "$LIST"; then # When we aren't in the installer, # allow downloading as the current user. DROP_PRIVS=false @@ -565,6 +569,7 @@ status "${0##*/}:" if "$DELETE"; then "$DOWNLOAD_ONLY" && warn "Cannot use -F and -d" && usage + "$LIST" && warn "Cannot use -l and -d" && usage lock_db # Show the "Uninstall" message when just deleting not upgrading @@ -640,11 +645,19 @@ set -A update '' kept='' unregister='' +"$LIST" && "$DOWNLOAD_ONLY" && + echo "$FWURL/$( basename "$CFILE" )" + if [ "${devices[*]:-}" ]; then lock_db for f in "${devices[@]}"; do d="$( firmware_devicename "$f" )" + if "$LIST" && ! "$DOWNLOAD_ONLY"; then + echo "$d" + continue + fi + verify_existing=true if [ "$f" = "$d" ]; then f=$( firmware_filename "$d" ) || { @@ -675,6 +688,11 @@ if [ "${devices[*]:-}" ]; then verify_existing=false fi + if "$LIST"; then + echo "$FWURL/$f" + continue + fi + set -A installed if "$INSTALL"; then set -A installed -- \ @@ -730,6 +748,12 @@ if [ "${devices[*]:-}" ]; then fi done +fi + +if "$LIST"; then + # We don't want any status when listing + rm -f "$FD_DIR/status" + exit fi if "$INSTALL"; then