Author: rmilecki
Date: 2015-03-31 08:05:35 +0200 (Tue, 31 Mar 2015)
New Revision: 45172

Modified:
   trunk/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
Log:
brcm47xx: display all errors (not just the 1st one) when checking image

This way people forcing upgrade will know what may go wrong.

Signed-off-by: Rafa?\197?\130 Mi?\197?\130ecki <[email protected]>

Modified: trunk/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
===================================================================
--- trunk/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh      
2015-03-31 05:39:33 UTC (rev 45171)
+++ trunk/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh      
2015-03-31 06:05:35 UTC (rev 45172)
@@ -89,6 +89,7 @@
 
        local file_type=$(brcm47xx_identify "$1")
        local magic
+       local error=0
 
        case "$file_type" in
                "chk")
@@ -100,16 +101,14 @@
 
                        [ -n "$dev_board_id" -a "$board_id" != "$dev_board_id" 
] && {
                                echo "Firmware board_id doesn't match device 
board_id ($dev_board_id)"
-                               return 1
+                               error=1
                        }
 
                        magic=$(get_magic_long_at "$1" "$header_len")
                        [ "$magic" != "48445230" ] && {
                                echo "No valid TRX firmware in the CHK image"
-                               return 1
+                               error=1
                        }
-
-                       return 0
                ;;
                "cybertan")
                        local pattern=$(dd if="$1" bs=1 count=4 2>/dev/null | 
hexdump -v -e '1/1 "%c"')
@@ -118,25 +117,24 @@
 
                        [ -n "$dev_pattern" -a "$pattern" != "$dev_pattern" ] 
&& {
                                echo "Firmware pattern doesn't match device 
pattern ($dev_pattern)"
-                               return 1
+                               error=1
                        }
 
                        magic=$(get_magic_long_at "$1" 32)
                        [ "$magic" != "48445230" ] && {
                                echo "No valid TRX firmware in the CyberTAN 
image"
-                               return 1
+                               error=1
                        }
-
-                       return 0
                ;;
                "trx")
-                       return 0
                ;;
                *)
                        echo "Invalid image type. Please use only .trx files"
-                       return 1
+                       error=1
                ;;
        esac
+
+       return $error
 }
 
 platform_do_upgrade_chk() {
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to