| version 1.69, 2021/12/11 05:08:38 |
version 1.70, 2021/12/11 05:35:21 |
|
|
| echo "$_dir" |
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() { |
fetch() { |
| local _src="${FWURL}/${1##*/}" _dst=$1 _user=_file _exit |
local _src="${FWURL}/${1##*/}" _dst=$1 _user=_file _exit |
| |
|
|
|
| exit |
exit |
| fi |
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 |
if "$DOWNLOAD" && ! [[ -e "$CFILE" ]]; then |
| fetch "$CFILE" |
fetch "$CFILE" |
| ! signify -qVep "$FWPUB_KEY" -x "$CFILE" -m "$CFILE" && |
! signify -qVep "$FWPUB_KEY" -x "$CFILE" -m "$CFILE" && |
| echo "Signature check of SHA256.sig failed" >&2 && exit 1 |
echo "Signature check of SHA256.sig failed" >&2 && exit 1 |
| fi |
fi |
| |
|
| for d in "${devices[@]}"; do |
for f in "${devices[@]}"; do |
| f="${d##*:}" |
d="$( firmware_devicename "$f" )" |
| |
|
| if [ "$f" = "$d" ]; then |
if [ "$f" = "$d" ]; then |
| f=$( firmware_filename "$d" || true ) |
f=$( firmware_filename "$d" || true ) |
| [ "$f" ] || continue |
[ "$f" ] || continue |
| f="$LOCALSRC/$f" |
f="$LOCALSRC/$f" |
| else |
elif ! "$INSTALL" && ! grep -q "($f)" "$CFILE" ; then |
| d="${d%:*}" |
echo "Cannot download local file $f" >&2 |
| |
exit 2 |
| fi |
fi |
| |
|
| set -A installed -- $( installed_firmware "$d" ) |
set -A installed -- $( installed_firmware "$d" ) |