diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2014-12-15 08:51:14 +0000 |
---|---|---|
committer | Rafał Miłecki <zajec5@gmail.com> | 2014-12-15 08:51:14 +0000 |
commit | 3a743d2632daf3edd36c5296e5f56b80952eaf18 (patch) | |
tree | 810d31bb53b8b8ca4583de4d95d8b8e4a185b2e7 /target/linux/brcm47xx | |
parent | 14ec28d1a408fb2edbd55e87d66042f6a0b9a950 (diff) | |
download | upstream-3a743d2632daf3edd36c5296e5f56b80952eaf18.tar.gz upstream-3a743d2632daf3edd36c5296e5f56b80952eaf18.tar.bz2 upstream-3a743d2632daf3edd36c5296e5f56b80952eaf18.zip |
brcm47xx: use separated function in upgrade to detect file type
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@43708 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/brcm47xx')
-rw-r--r-- | target/linux/brcm47xx/base-files/lib/upgrade/platform.sh | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh b/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh index 48885b1632..d216ca4d04 100644 --- a/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh @@ -1,11 +1,30 @@ PART_NAME=firmware +brcm47xx_identify() { + local magic + + magic=$(get_magic_long "$1") + case "$magic" in + "48445230") + echo "trx" + return + ;; + "2a23245e") + echo "chk" + return + ;; + esac + + echo "unknown" +} + platform_check_image() { [ "$#" -gt 1 ] && return 1 - case "$(get_magic_word "$1")" in - # .trx files - 4844) return 0;; + local file_type=$(brcm47xx_identify "$1") + + case "$file_type" in + "trx") return 0;; *) echo "Invalid image type. Please use only .trx files" return 1 |