=================================================================== RCS file: /cvs/openbsd/fw_update/fw_install.sh,v retrieving revision 1.69 retrieving revision 1.70 diff -u -r1.69 -r1.70 --- openbsd/fw_update/fw_install.sh 2021/12/11 05:08:38 1.69 +++ openbsd/fw_update/fw_install.sh 2021/12/11 05:35:21 1.70 @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: fw_install.sh,v 1.69 2021/12/11 05:08:38 afresh1 Exp $ +# $OpenBSD: fw_install.sh,v 1.70 2021/12/11 05:35:21 afresh1 Exp $ # # Copyright (c) 2021 Andrew Hewus Fresh # @@ -50,16 +50,6 @@ echo "$_dir" } -realpath () { - if [ -x /usr/bin/realpath ]; then - /usr/bin/realpath "$1" - elif [ "$1" = "${1%/*}" ]; then - echo "${PWD}/$1" - else - echo "$( cd "${1%/*}" && pwd )/${1##*/}" - fi -} - fetch() { local _src="${FWURL}/${1##*/}" _dst=$1 _user=_file _exit @@ -215,36 +205,22 @@ exit fi -# Have to find the full path to firmware files -# so we can cd and still find them later. -i=0 -while (( i < "${#devices[@]}" )); do - f="${devices[$i]}" - d=$( firmware_devicename "$f" ) - if [ -e "$f" ]; then - if "$DOWNLOAD"; then - echo "Cannot download local file $f" >&2 - exit 2 - fi - devices[$i]="$d:$( realpath "$f" )" - fi - i=$((i + 1)) -done - if "$DOWNLOAD" && ! [[ -e "$CFILE" ]]; then fetch "$CFILE" ! signify -qVep "$FWPUB_KEY" -x "$CFILE" -m "$CFILE" && echo "Signature check of SHA256.sig failed" >&2 && exit 1 fi -for d in "${devices[@]}"; do - f="${d##*:}" +for f in "${devices[@]}"; do + d="$( firmware_devicename "$f" )" + if [ "$f" = "$d" ]; then f=$( firmware_filename "$d" || true ) [ "$f" ] || continue f="$LOCALSRC/$f" - else - d="${d%:*}" + elif ! "$INSTALL" && ! grep -q "($f)" "$CFILE" ; then + echo "Cannot download local file $f" >&2 + exit 2 fi set -A installed -- $( installed_firmware "$d" )