iop: ssh_upgrade: Adapt to new image filenames

Signed-off-by: Andreas Gnau <andreas.gnau@iopsys.eu>
This commit is contained in:
Andreas Gnau 2022-09-14 17:28:01 +02:00
parent 9a9bef4935
commit 63a2edb417

View file

@ -242,30 +242,16 @@ function ssh_upgrade {
esac
done
if [ -n "$upd_fw" ]; then
upd_fw_base=$(basename $upd_fw)
else
if [ -z "$upd_fw" ]; then
set_config_string CONFIG_TARGET_BOARD
set_config_string CONFIG_TARGET_SUBTARGET
firmwares=$(
cd "bin/targets/$CONFIG_TARGET_BOARD/$CONFIG_TARGET_SUBTARGET/"
ls -t *[0-9].y[3]
)
# if target uses pkgtb
if [ -z "$firmwares"]; then
firmwares=$(
cd bin/targets/$CONFIG_TARGET_BOARD/$CONFIG_TARGET_SUBTARGET/
ls -t last.pkgtb
)
upd_fw="$(realpath -q --canonicalize-existing --relative-to=. "bin/targets/$CONFIG_TARGET_BOARD/$CONFIG_TARGET_SUBTARGET/"last.{pkgtb,itb})"
if [ -z "$upd_fw" ] && [ $do_dialog -eq 0 ]; then
echo "Could not find image. Check that last.{itb,pkgtb} exists or specify an image using -f <image> or -i (interactive)." >&2
return 1
fi
for upd_fw_base in $firmwares; do
#echo "firmware $upd_fw"
break
done
upd_fw="bin/targets/$CONFIG_TARGET_BOARD/$CONFIG_TARGET_SUBTARGET/$upd_fw_base"
fi
upd_fw_base="$(basename "$upd_fw")"
[ $do_dialog -eq 1 ] && upd_select_start