summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorAndrew Fresh <afresh1@cvs.openbsd.org>2024-11-04 00:34:48 +0000
committerAndrew Fresh <afresh1@cvs.openbsd.org>2024-11-04 00:34:48 +0000
commit772213d11137fd0b211101a2051627b9c86fe9e5 (patch)
tree4768ea67bc865b6d8a563e57e00597d53d0d384b /usr.sbin
parent33667937edac44b1df0e60c1ad16db6df60154c6 (diff)
Make fw_update -p consistent
Previously, if using fw_update -Fp ..., the argument to -p was treated as a destination path, unless it looked like a URL. This is too complex, if we want to be able to change the download destination, that wll need to be a new option.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/fw_update/fw_update.832
-rw-r--r--usr.sbin/fw_update/fw_update.sh31
2 files changed, 21 insertions, 42 deletions
diff --git a/usr.sbin/fw_update/fw_update.8 b/usr.sbin/fw_update/fw_update.8
index bbe17499401..94398898308 100644
--- a/usr.sbin/fw_update/fw_update.8
+++ b/usr.sbin/fw_update/fw_update.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: fw_update.8,v 1.4 2024/10/12 23:56:23 afresh1 Exp $
+.\" $OpenBSD: fw_update.8,v 1.5 2024/11/04 00:34:47 afresh1 Exp $
.\"
.\" Copyright (c) 2011 Alexander Hall <alexander@beard.se>
.\"
@@ -14,12 +14,12 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: October 12 2024 $
+.Dd $Mdocdate: November 4 2024 $
.Dt FW_UPDATE 8
.Os
.Sh NAME
.Nm fw_update
-.Nd install non-free firmware packages
+.Nd install non-free firmware
.Sh SYNOPSIS
.Nm
.Op Fl adFnv
@@ -28,12 +28,12 @@
.Sh DESCRIPTION
The
.Nm
-utility installs, updates, or deletes firmware packages for
+utility installs, updates, or deletes firmware for
.Ar driver
from the Internet.
By default,
.Nm
-tries to determine which firmware packages are needed.
+tries to determine which firmware are needed.
.Pp
Since firmware with an acceptable license is already present in
.Ox ,
@@ -58,31 +58,25 @@ 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 SHA256.sig and firmware .tgz to the current directory.
.It Fl n
Dry run.
-Do not actually install or update any firmware packages;
+Do not actually install or update any firmware;
just report the steps that would be taken.
.It Fl p Ar path
-Use the firmware found at package repository
+Use
.Ar path ,
-being either a local directory or a URL,
-instead of the default location.
+either a local directory or a URL,
+as the source for firmware instead of the default location.
.It Fl v
Turn on verbose output.
This flag can be specified multiple times for increased verbosity.
.El
.Pp
Firmware is downloaded from release-specific directories at
-.Lk http://firmware.openbsd.org/firmware/ .
-The files are in the format required by
-.Xr pkg_add 1 ,
-but direct use of pkg_add is discouraged.
+.Lk http://firmware.openbsd.org/firmware/
+unless overridden with
+.Fl p .
.Sh ENVIRONMENT
.Bl -tag -width DESTDIRXXX
.It Ev DESTDIR
diff --git a/usr.sbin/fw_update/fw_update.sh b/usr.sbin/fw_update/fw_update.sh
index 63a18f82fdc..6216971bae4 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.57 2024/10/12 23:56:23 afresh1 Exp $
+# $OpenBSD: fw_update.sh,v 1.58 2024/11/04 00:34:47 afresh1 Exp $
#
# Copyright (c) 2021,2023 Andrew Hewus Fresh <afresh1@openbsd.org>
#
@@ -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