aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib/upgrade/nand.sh
diff options
context:
space:
mode:
Diffstat (limited to 'package/base-files/files/lib/upgrade/nand.sh')
-rw-r--r--package/base-files/files/lib/upgrade/nand.sh16
1 files changed, 9 insertions, 7 deletions
diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
index 563db4c320..1c6b86bcaa 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -250,19 +250,21 @@ nand_board_name() {
nand_upgrade_tar() {
local tar_file="$1"
- local board_name="$(nand_board_name)"
local kernel_mtd="$(find_mtd_index $CI_KERNPART)"
- local kernel_length=`(tar xf $tar_file sysupgrade-$board_name/kernel -O | wc -c) 2> /dev/null`
- local rootfs_length=`(tar xf $tar_file sysupgrade-$board_name/root -O | wc -c) 2> /dev/null`
+ local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
+ board_dir=${board_dir%/}
- local rootfs_type="$(identify_tar "$tar_file" sysupgrade-$board_name/root)"
+ local kernel_length=`(tar xf $tar_file ${board_dir}/kernel -O | wc -c) 2> /dev/null`
+ local rootfs_length=`(tar xf $tar_file ${board_dir}/root -O | wc -c) 2> /dev/null`
+
+ local rootfs_type="$(identify_tar "$tar_file" ${board_dir}/root)"
local has_kernel=1
local has_env=0
[ "$kernel_length" != 0 -a -n "$kernel_mtd" ] && {
- tar xf $tar_file sysupgrade-$board_name/kernel -O | mtd write - $CI_KERNPART
+ tar xf $tar_file ${board_dir}/kernel -O | mtd write - $CI_KERNPART
}
[ "$kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel=0
@@ -271,12 +273,12 @@ nand_upgrade_tar() {
local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
[ "$has_kernel" = "1" ] && {
local kern_ubivol="$(nand_find_volume $ubidev $CI_KERNPART)"
- tar xf $tar_file sysupgrade-$board_name/kernel -O | \
+ tar xf $tar_file ${board_dir}/kernel -O | \
ubiupdatevol /dev/$kern_ubivol -s $kernel_length -
}
local root_ubivol="$(nand_find_volume $ubidev rootfs)"
- tar xf $tar_file sysupgrade-$board_name/root -O | \
+ tar xf $tar_file ${board_dir}/root -O | \
ubiupdatevol /dev/$root_ubivol -s $rootfs_length -
nand_do_upgrade_success