diff options
author | Chen Minqiang <ptpt52@gmail.com> | 2022-12-18 08:57:20 +0800 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2023-01-29 01:02:45 +0000 |
commit | 781a3ae5dc4755e5826862d023e149e68029d554 (patch) | |
tree | b4c5a4afd9025137760ce8f0f6b3a7bd09ad42eb /package/base-files | |
parent | b246385126ace0aeabacf9c94851d2f6dc26f912 (diff) | |
download | upstream-781a3ae5dc4755e5826862d023e149e68029d554.tar.gz upstream-781a3ae5dc4755e5826862d023e149e68029d554.tar.bz2 upstream-781a3ae5dc4755e5826862d023e149e68029d554.zip |
base-files: fix nand_do_platform_check fail
This change ensures compatibility with both types of sysupgrade-tar files.
1. For some boards like xiaomi,redmi-router-ax6s, sysupgrade-tar
is pack in directory `vendor,name/`
2. For some boards like xiaomi,mi-router-3g, sysupgrade-tar is pack
in directory `vendor_name/`
Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
Diffstat (limited to 'package/base-files')
-rw-r--r-- | package/base-files/files/lib/upgrade/nand.sh | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh index a1dbd6e266..e7ac34f5d0 100644 --- a/package/base-files/files/lib/upgrade/nand.sh +++ b/package/base-files/files/lib/upgrade/nand.sh @@ -453,7 +453,11 @@ nand_do_platform_check() { local gz="$(identify_if_gzip "$file")" local file_type="$(identify "$file" "" "$gz")" - local control_length=$( (tar xO${gz}f "$file" "sysupgrade-$board_name/CONTROL" | wc -c) 2> /dev/null) + local control_length=$( (tar xO${gz}f "$file" "sysupgrade-${board_name//,/_}/CONTROL" | wc -c) 2> /dev/null) + + if [ "$control_length" = 0 ]; then + control_length=$( (tar xO${gz}f "$file" "sysupgrade-${board_name//_/,}/CONTROL" | wc -c) 2> /dev/null) + fi if [ "$control_length" != 0 ]; then nand_verify_tar_file "$file" "$gz" || return 1 |