Author: blogic
Date: 2014-11-24 20:14:29 +0100 (Mon, 24 Nov 2014)
New Revision: 43373

Modified:
   trunk/package/system/procd/files/nand.sh
Log:
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?\197?\130 Mi?\197?\130ecki <[email protected]>

Modified: trunk/package/system/procd/files/nand.sh
===================================================================
--- trunk/package/system/procd/files/nand.sh    2014-11-24 19:14:17 UTC (rev 
43372)
+++ trunk/package/system/procd/files/nand.sh    2014-11-24 19:14:29 UTC (rev 
43373)
@@ -250,10 +250,10 @@
        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 @@
 
        [ ! "$(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() {
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to