diff options
author | John Crispin <blogic@openwrt.org> | 2014-11-24 19:14:29 +0000 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2014-11-24 19:14:29 +0000 |
commit | b3fd44396768d8d8ff4786eeb699a9a8b23a8b9f (patch) | |
tree | 2c8915fa512d7a57ed1a55fa1f43d6decfe18741 /package/system | |
parent | b115a219481b7d48a373e31040e7c57ee36daa42 (diff) | |
download | upstream-b3fd44396768d8d8ff4786eeb699a9a8b23a8b9f.tar.gz upstream-b3fd44396768d8d8ff4786eeb699a9a8b23a8b9f.tar.bz2 upstream-b3fd44396768d8d8ff4786eeb699a9a8b23a8b9f.zip |
procd: fix/clean some conditions in nand.sh
1) nand_upgrade_tar: use a simpler condition that matches if () { }
logic and fix check of $kernel_length variable
2) nand_do_upgrade_stage2: use case, otherwise one could believe we
always call nand_upgrade_tar
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@43373 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/system')
-rw-r--r-- | package/system/procd/files/nand.sh | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/package/system/procd/files/nand.sh b/package/system/procd/files/nand.sh index 0d30810b83..1da63e2cc1 100644 --- a/package/system/procd/files/nand.sh +++ b/package/system/procd/files/nand.sh @@ -250,10 +250,10 @@ nand_upgrade_tar() { local has_kernel=1 local has_env=0 - [ "kernel_length" = 0 -o -z "$kernel_mtd" ] || { + [ "$kernel_length" != 0 -a -n "$kernel_mtd" ] && { tar xf $tar_file sysupgrade-$board_name/kernel -O | mtd write - $CI_KERNPART } - [ "kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel=0 + [ "$kernel_length" = 0 -o ! -z "$kernel_mtd" ] && has_kernel=0 nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "$has_kernel" "$has_env" @@ -277,9 +277,11 @@ nand_do_upgrade_stage2() { [ ! "$(find_mtd_index "$CI_UBIPART")" ] && CI_UBIPART="rootfs" - [ "$file_type" = "ubi" ] && nand_upgrade_ubinized $1 - [ "$file_type" = "ubifs" ] && nand_upgrade_ubifs $1 - nand_upgrade_tar $1 + case "$file_type" in + "ubi") nand_upgrade_ubinized $1;; + "ubifs") nand_upgrade_ubifs $1;; + *) nand_upgrade_tar $1;; + esac } nand_upgrade_stage2() { |