[OpenWrt-Devel] [PATCH] upgrade: nand: fix board_name assumtions
Bjørn Mork
bjorn at mork.no
Mon May 20 06:14:43 EDT 2019
nand_do_platform_check assumes that the current board name is
used as-is in the tar file sysupgrade directory. This fails
for any image supporting multiple device names, and it also
fails if the board_name contains a comma.
Signed-off-by: Bjørn Mork <bjorn at mork.no>
---
This is a local workaround I'va had lying around for a while. Please
consider if it makes any sense at all, or if there are better ways
to solve the problem.
I don't have an actual upstreamed usecase, as this is an issue I've
met while trying to prepare for a never-finished ZyXEL WAP6805
support...
Bjørn
package/base-files/files/lib/upgrade/nand.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
index 99916a4e96fc..14856357989e 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -320,7 +320,9 @@ nand_do_upgrade() {
nand_do_platform_check() {
local board_name="$1"
local tar_file="$2"
- local control_length=`(tar xf $tar_file sysupgrade-$board_name/CONTROL -O | wc -c) 2> /dev/null`
+ local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
+ board_dir=${board_dir%/}
+ local control_length=`(tar xf $tar_file ${board_dir}/CONTROL -O | wc -c) 2> /dev/null`
local file_type="$(identify $2)"
[ "$control_length" = 0 -a "$file_type" != "ubi" -a "$file_type" != "ubifs" ] && {
--
2.11.0
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list