So far, the sysupgrade-* folder used during upgrade in rb532 was
hardcoded to contain the board name. Therefore, changing board name
or BOARD_NAME variable in image/Makefile might have broken upgrade.

Improve this by adding a step to determine the folder name via
a wildcard, as it is done for generic nand_upgrade_tar() in
lib/upgrade/nand.sh and for several other targets already.

Signed-off-by: Adrian Schmutzler <freif...@adrianschmutzler.de>
---
 target/linux/rb532/base-files/lib/upgrade/platform.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/target/linux/rb532/base-files/lib/upgrade/platform.sh 
b/target/linux/rb532/base-files/lib/upgrade/platform.sh
index 334d6e2ff6..988bf2f0f3 100644
--- a/target/linux/rb532/base-files/lib/upgrade/platform.sh
+++ b/target/linux/rb532/base-files/lib/upgrade/platform.sh
@@ -11,7 +11,14 @@ platform_check_image() {
 }
 
 platform_do_upgrade() {
+       local tar_file="$1"
+
+       local board_dir=$(tar tf "$tar_file" | grep -m 1 '^sysupgrade-.*/$')
+       board_dir=${board_dir%/}
+       [ -n "$board_dir" ] || return 1
+
        mtd erase kernel
-       tar xf "$1" "sysupgrade-$(board_name)/kernel" -O | nandwrite -o 
/dev/mtd0 -
-       nand_do_upgrade "$1"
+       tar xf "$tar_file" "$(board_dir)/kernel" -O | nandwrite -o /dev/mtd0 -
+
+       nand_do_upgrade "$tar_file"
 }
-- 
2.20.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to