Download raw body.
Make fw_update(8) -p consistent
I was talking about how to download firmware on one machine and install
it on another. That led to more reading of the man page which really
makes the usage a weird inconsistency. If you happen to use `-Fp $path`
and the `$path` is a directory, we magically switch from `-p` being a
_source_ to being a destination.
While here, be more consistent with "firmware" vs "firmware packages".
This is a non-backwards compatible change, so it may need a mention on
current.html and upgrade77.html.
Comments, questions, "sorry, we're stuck with it", OK?
Index: fw_update.8
===================================================================
RCS file: /cvs/src/usr.sbin/fw_update/fw_update.8,v
diff -u -p -r1.4 fw_update.8
--- fw_update.8 12 Oct 2024 23:56:23 -0000 1.4
+++ fw_update.8 17 Oct 2024 00:21:11 -0000
@@ -58,18 +58,13 @@ If used in conjunction with
.Fl a ,
delete firmware for all drivers.
.It Fl F
-Download firmware only.
-By default downloads to the current directory.
-Specifying a URL with
-.Fl p
-downloads from that URL,
-specifying a path downloads to that directory.
+Download firmware packages to the current directory.
.It Fl n
Dry run.
Do not actually install or update any firmware packages;
just report the steps that would be taken.
.It Fl p Ar path
-Use the firmware found at package repository
+Use the firmware packages found at package repository
.Ar path ,
being either a local directory or a URL,
instead of the default location.
Index: fw_update.sh
===================================================================
RCS file: /cvs/src/usr.sbin/fw_update/fw_update.sh,v
diff -u -p -r1.57 fw_update.sh
--- fw_update.sh 12 Oct 2024 23:56:23 -0000 1.57
+++ fw_update.sh 17 Oct 2024 00:21:11 -0000
@@ -500,7 +500,7 @@ do
d) DELETE=true ;;
F) OPT_F=true ;;
n) DRYRUN=true ;;
- p) LOCALSRC="$OPTARG" ;;
+ p) FWURL="$OPTARG" ;;
v) ((++VERBOSE)) ;;
:)
warn "${0##*/}: option requires an argument -- -$OPTARG"
@@ -517,33 +517,18 @@ shift $((OPTIND - 1))
# Progress bars, not spinner When VERBOSE > 1
((VERBOSE > 1)) && ENABLE_SPINNER=false
-if [ "$LOCALSRC" ]; then
- if [[ $LOCALSRC = @(ftp|http?(s))://* ]]; then
- FWURL="${LOCALSRC}"
- LOCALSRC=
- else
- LOCALSRC="${LOCALSRC#file:}"
- ! [ -d "$LOCALSRC" ] &&
- warn "The path must be a URL or an existing directory" &&
- exit 1
- fi
+if [[ $FWURL != @(ftp|http?(s))://* ]]; then
+ FWURL="${FWURL#file:}"
+ ! [ -d "$FWURL" ] &&
+ warn "The path must be a URL or an existing directory" &&
+ exit 1
+ FWURL="file:$FWURL"
fi
# "Download only" means local dir and don't install
if [ "$OPT_F" ]; then
INSTALL=false
LOCALSRC="${LOCALSRC:-.}"
-
- # Always check for latest CFILE and so latest firmware
- if [ -e "$LOCALSRC/$CFILE" ]; then
- mv "$LOCALSRC/$CFILE" "$LOCALSRC/$CFILE-OLD"
- if check_cfile; then
- rm -f "$LOCALSRC/$CFILE-OLD"
- else
- mv "$LOCALSRC/$CFILE-OLD" "$LOCALSRC/$CFILE"
- warn "Using existing $CFILE"
- fi
- fi
elif [ "$LOCALSRC" ]; then
DOWNLOAD=false
fi
Make fw_update(8) -p consistent