From 63a2edb4177097754e3a22e0d5e7ed0cff17b341 Mon Sep 17 00:00:00 2001 From: Andreas Gnau Date: Wed, 14 Sep 2022 17:28:01 +0200 Subject: [PATCH] iop: ssh_upgrade: Adapt to new image filenames Signed-off-by: Andreas Gnau --- iop/scripts/iopupgrade.sh | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/iop/scripts/iopupgrade.sh b/iop/scripts/iopupgrade.sh index 7eb0d8eb3..eb8b7beda 100644 --- a/iop/scripts/iopupgrade.sh +++ b/iop/scripts/iopupgrade.sh @@ -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 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