From 8ffd1deabc69b64d438a3c159b9919c2933e80bf Mon Sep 17 00:00:00 2001 From: afresh1 Date: Thu, 28 Sep 2023 00:45:22 +0000 Subject: [PATCH] Download firmware to LOCALSRC when using filenames Previously if you did: fw_update otus-firmware-1.0p1.tgz and that firmware didn't exist in the current directory, we would download that firmware into the current directory. Which is not the expected outcome. --- usr.sbin/fw_update/fw_update.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/usr.sbin/fw_update/fw_update.sh b/usr.sbin/fw_update/fw_update.sh index 02261dd8131..0a773cd379e 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.47 2023/08/31 21:29:53 afresh1 Exp $ +# $OpenBSD: fw_update.sh,v 1.48 2023/09/28 00:45:22 afresh1 Exp $ # # Copyright (c) 2021,2023 Andrew Hewus Fresh # @@ -600,7 +600,6 @@ if [ "${devices[*]:-}" ]; then fi continue fi - f="$LOCALSRC/$f" elif ! "$INSTALL" && ! grep -Fq "($f)" "$CFILE" ; then warn "Cannot download local file $f" exit 1 @@ -626,6 +625,12 @@ if [ "${devices[*]:-}" ]; then fi fi + # Fetch an unqualified file into LOCALSRC + # if it doesn't exist in the current directory. + if [ "$f" = "${f##/}" ] && [ ! -e "$f" ]; then + f="$LOCALSRC/$f" + fi + if "$verify_existing" && [ -e "$f" ]; then pending_status=false if ((VERBOSE == 1)); then -- 2.20.1