=================================================================== RCS file: /cvs/openbsd/fw_update/fw_install.sh,v retrieving revision 1.70 retrieving revision 1.74 diff -u -r1.70 -r1.74 --- openbsd/fw_update/fw_install.sh 2021/12/11 05:35:21 1.70 +++ openbsd/fw_update/fw_install.sh 2021/12/11 20:57:51 1.74 @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: fw_install.sh,v 1.70 2021/12/11 05:35:21 afresh1 Exp $ +# $OpenBSD: fw_install.sh,v 1.74 2021/12/11 20:57:51 afresh1 Exp $ # # Copyright (c) 2021 Andrew Hewus Fresh # @@ -121,14 +121,15 @@ } add_firmware () { - local _f="${1##*/}" _pkgdir="${DESTDIR}/var/db/pkg" + local _f="${1##*/}" + local _pkgdir="${DESTDIR}/var/db/pkg/${_f%.tgz}" ftp -D "Install" -Vmo- "file:${1}" | - tar -s ",^\+,${_pkgdir}/${_f%.tgz}/+," \ + tar -s ",^\+,${_pkgdir}/+," \ -s ",^firmware,${DESTDIR}/etc/firmware," \ -C / -zxphf - "+*" "firmware/*" # TODO: Should we mark these so real fw_update can -Drepair? - ed -s "${_pkgdir}/${_f%.tgz}/+CONTENTS" <&2 && exit 1 @@ -234,13 +235,17 @@ done fi - if [ ! -e "$f" ]; then - "$INSTALL" && ! "$DOWNLOAD" && - echo "Cannot install ${f##*/}, not found" >&2 && continue + if [ -e "$f" ]; then + if "$DOWNLOAD"; then + echo "Verify existing ${f##*/}" + verify "$f" || continue + # else assume it was verified when downloaded + fi + elif "$INSTALL" && ! "$DOWNLOAD"; then + echo "Cannot install ${f##*/}, not found" >&2 + continue + else fetch "$f" || continue - verify "$f" || continue - elif $DOWNLOAD; then - echo "Already have $f" verify "$f" || continue fi