ar71xx: base-files: cleanups in lib/upgrade/platform.sh

This includes:

- code style fixes
- fix boards order within case sections

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This commit is contained in:
Piotr Dymacz 2016-09-29 11:44:44 +02:00 committed by John Crispin
parent 92870eac27
commit 8be47007a9

View File

@ -149,7 +149,6 @@ alfa_check_image() {
return 1 return 1
} }
;; ;;
"68737173") "68737173")
[ "$fw_part_size" != "7929856" ] && { [ "$fw_part_size" != "7929856" ] && {
echo "Invalid image magic \"$magic_long\" for $fw_part_size bytes" echo "Invalid image magic \"$magic_long\" for $fw_part_size bytes"
@ -169,8 +168,8 @@ platform_check_image() {
[ "$#" -gt 1 ] && return 1 [ "$#" -gt 1 ] && return 1
case "$board" in case "$board" in
all0315n | \
all0258n|\ all0258n|\
all0315n|\
cap324|\ cap324|\
cap4200ag|\ cap4200ag|\
cr3000|\ cr3000|\
@ -180,16 +179,16 @@ platform_check_image() {
;; ;;
alfa-ap96|\ alfa-ap96|\
alfa-nx|\ alfa-nx|\
arduino-yun | \
ap113|\ ap113|\
ap121 | \
ap121-mini|\ ap121-mini|\
ap121|\
ap135-020|\
ap136-010|\ ap136-010|\
ap136-020|\ ap136-020|\
ap135-020 | \
ap147-010|\ ap147-010|\
ap152|\ ap152|\
ap96|\ ap96|\
arduino-yun|\
bxu2000n-2-a1|\ bxu2000n-2-a1|\
db120|\ db120|\
dr344|\ dr344|\
@ -205,12 +204,18 @@ platform_check_image() {
echo "Invalid image type." echo "Invalid image type."
return 1 return 1
} }
return 0 return 0
;; ;;
airgatewaypro|\
airgateway|\
airrouter|\
ap132|\
ap81|\ ap81|\
ap83|\ ap83|\
ap132 | \ bullet-m|\
c-55|\ c-55|\
carambola2|\
cf-e316n-v2|\ cf-e316n-v2|\
dgl-5500-a1|\ dgl-5500-a1|\
dhp-1565-a1|\ dhp-1565-a1|\
@ -223,90 +228,82 @@ platform_check_image() {
dir-825-c1|\ dir-825-c1|\
dir-835-a1|\ dir-835-a1|\
dlan-hotspot|\ dlan-hotspot|\
dlan-pro-500-wp | \
dlan-pro-1200-ac|\ dlan-pro-1200-ac|\
dlan-pro-500-wp|\
dr531|\ dr531|\
dragino2|\ dragino2|\
epg5000|\ epg5000|\
esr1750|\ esr1750|\
esr900|\ esr900|\
ew-dorin | \
ew-dorin-router|\ ew-dorin-router|\
ew-dorin|\
gl-ar150|\ gl-ar150|\
gl-mifi | \
gl-ar300 | \
gl-ar300m|\ gl-ar300m|\
gl-ar300|\
gl-domino|\ gl-domino|\
gl-mifi|\
hiwifi-hc6361|\ hiwifi-hc6361|\
hornet-ub-x2|\ hornet-ub-x2|\
jwap230|\ jwap230|\
loco-m-xw|\
mzk-w04nu|\ mzk-w04nu|\
mzk-w300nh|\ mzk-w300nh|\
nanostation-m-xw|\
nanostation-m|\
nbg460n_550n_550nh|\
rocket-m-ti|\
rocket-m-xw|\
rocket-m|\
rw2458n|\
tew-632brp|\ tew-632brp|\
tew-712br|\ tew-712br|\
tew-732br|\ tew-732br|\
tew-823dru|\ tew-823dru|\
wrt400n | \ unifi-outdoor|\
airgateway | \ unifiac-lite|\
airgatewaypro | \ unifiac-pro|\
airrouter | \ unifi|\
bullet-m | \ weio|\
loco-m-xw | \
nanostation-m | \
rocket-m | \
rocket-m-xw | \
rocket-m-ti | \
nanostation-m-xw | \
rw2458n | \
wpj531 | \
wndap360 | \
wpj342 | \
wpj344 | \
wzr-hp-g300nh2 | \
wzr-hp-g300nh | \
wzr-hp-g450h | \
wzr-hp-ag300h | \
wzr-450hp2 | \
whr-g301n|\ whr-g301n|\
whr-hp-g300n|\ whr-hp-g300n|\
whr-hp-gn|\ whr-hp-gn|\
wlae-ag300n|\ wlae-ag300n|\
nbg460n_550n_550nh | \ wndap360|\
unifi | \ wpj342|\
unifiac-lite | \ wpj344|\
unifiac-pro | \ wpj531|\
unifi-outdoor | \ wrt400n|\
carambola2 | \ wrtnode2q|\
weio | \ wzr-450hp2|\
wrtnode2q) wzr-hp-ag300h|\
wzr-hp-g300nh2|\
wzr-hp-g300nh|\
wzr-hp-g450h)
[ "$magic" != "2705" ] && { [ "$magic" != "2705" ] && {
echo "Invalid image type." echo "Invalid image type."
return 1 return 1
} }
return 0 return 0
;; ;;
cpe210|\ cpe210|\
cpe510) cpe510)
tplink_pharos_check_image "$1" && return 0 tplink_pharos_check_image "$1" && return 0
return 1 return 1
;; ;;
bsb|\ bsb|\
dir-825-b1|\ dir-825-b1|\
tew-673gru) tew-673gru)
dir825b_check_image "$1" && return 0 dir825b_check_image "$1" && return 0
;; ;;
mynet-rext|\ mynet-rext|\
wrt160nl) wrt160nl)
cybertan_check_image "$1" && return 0 cybertan_check_image "$1" && return 0
return 1 return 1
;; ;;
qihoo-c301 | \
mynet-n600|\ mynet-n600|\
mynet-n750) mynet-n750|\
qihoo-c301)
[ "$magic_long" != "5ea3a417" ] && { [ "$magic_long" != "5ea3a417" ] && {
echo "Invalid image, bad magic: $magic_long" echo "Invalid image, bad magic: $magic_long"
return 1 return 1
@ -318,28 +315,27 @@ platform_check_image() {
return 1 return 1
} }
return 0; return 0
;; ;;
mr1750 | \
mr1750v2|\ mr1750v2|\
mr600 | \ mr1750|\
mr600v2|\ mr600v2|\
mr900 | \ mr600|\
mr900v2|\ mr900v2|\
om2p | \ mr900|\
om2pv2 | \
om2p-hs | \
om2p-hsv2|\ om2p-hsv2|\
om2p-hsv3|\ om2p-hsv3|\
om2p-hs|\
om2p-lc|\ om2p-lc|\
om5p | \ om2pv2|\
om5p-an | \ om2p|\
om5p-acv2|\
om5p-ac|\ om5p-ac|\
om5p-acv2) om5p-an|\
om5p)
platform_check_image_openmesh "$magic_long" "$1" && return 0 platform_check_image_openmesh "$magic_long" "$1" && return 0
return 1 return 1
;; ;;
antminer-s1|\ antminer-s1|\
antminer-s3|\ antminer-s3|\
antrouter-r1|\ antrouter-r1|\
@ -362,49 +358,49 @@ platform_check_image() {
tl-mr12u|\ tl-mr12u|\
tl-mr13u|\ tl-mr13u|\
tl-mr3020|\ tl-mr3020|\
tl-mr3040 | \
tl-mr3040-v2|\ tl-mr3040-v2|\
tl-mr3220 | \ tl-mr3040|\
tl-mr3220-v2|\ tl-mr3220-v2|\
tl-mr3420 | \ tl-mr3220|\
tl-mr3420-v2|\ tl-mr3420-v2|\
tl-mr3420|\
tl-wa701nd-v2|\ tl-wa701nd-v2|\
tl-wa7210n-v2|\ tl-wa7210n-v2|\
tl-wa7510n | \
tl-wa750re|\ tl-wa750re|\
tl-wa7510n|\
tl-wa801nd-v2|\
tl-wa830re-v2|\
tl-wa850re|\ tl-wa850re|\
tl-wa860re|\ tl-wa860re|\
tl-wa801nd-v2 | \
tl-wa901nd | \
tl-wa901nd-v2|\ tl-wa901nd-v2|\
tl-wa901nd-v3|\ tl-wa901nd-v3|\
tl-wa901nd-v4|\ tl-wa901nd-v4|\
tl-wa901nd|\
tl-wdr3320-v2|\ tl-wdr3320-v2|\
tl-wdr3500|\ tl-wdr3500|\
tl-wdr4300|\ tl-wdr4300|\
tl-wdr4900-v2|\ tl-wdr4900-v2|\
tl-wdr6500-v2|\ tl-wdr6500-v2|\
tl-wr1041n-v2|\
tl-wr1043nd-v2|\
tl-wr1043nd|\
tl-wr2543n|\
tl-wr703n|\ tl-wr703n|\
tl-wr710n|\ tl-wr710n|\
tl-wr720n-v3|\ tl-wr720n-v3|\
tl-wr741nd | \
tl-wr741nd-v4|\ tl-wr741nd-v4|\
tl-wr741nd|\
tl-wr810n|\ tl-wr810n|\
tl-wr841n-v11|\
tl-wr841n-v1|\ tl-wr841n-v1|\
tl-wa830re-v2 | \
tl-wr841n-v7|\ tl-wr841n-v7|\
tl-wr841n-v8|\ tl-wr841n-v8|\
tl-wr841n-v9|\ tl-wr841n-v9|\
tl-wr841n-v11 | \
tl-wr842n-v2|\ tl-wr842n-v2|\
tl-wr842n-v3|\ tl-wr842n-v3|\
tl-wr941nd | \
tl-wr941nd-v5|\ tl-wr941nd-v5|\
tl-wr941nd-v6|\ tl-wr941nd-v6|\
tl-wr1041n-v2 | \ tl-wr941nd)
tl-wr1043nd | \
tl-wr1043nd-v2 | \
tl-wr2543n)
local magic_ver="0100" local magic_ver="0100"
case "$board" in case "$board" in
@ -443,25 +439,24 @@ platform_check_image() {
return 0 return 0
;; ;;
tube2h) tube2h)
alfa_check_image "$1" && return 0 alfa_check_image "$1" && return 0
return 1 return 1
;; ;;
nbg6616|\ nbg6616|\
unifi-outdoor-plus | \ uap-pro|\
uap-pro) unifi-outdoor-plus)
[ "$magic_long" != "19852003" ] && { [ "$magic_long" != "19852003" ] && {
echo "Invalid image type." echo "Invalid image type."
return 1 return 1
} }
return 0 return 0
;; ;;
wndr3700|\ wndr3700|\
wnr1000-v2|\
wnr2000-v3|\ wnr2000-v3|\
wnr612-v2|\ wnr612-v2|\
wnr1000-v2 | \
wpn824n) wpn824n)
local hw_magic local hw_magic
@ -470,31 +465,32 @@ platform_check_image() {
echo "Invalid image, hardware ID mismatch, hw:$hw_magic image:$magic_long." echo "Invalid image, hardware ID mismatch, hw:$hw_magic image:$magic_long."
return 1 return 1
} }
return 0 return 0
;; ;;
mr18|\ mr18|\
z1) z1)
merakinand_do_platform_check $board $1 merakinand_do_platform_check $board $1
return $?; return $?
;; ;;
nbg6716|\ nbg6716|\
r6100|\ r6100|\
wndr3700v4|\ wndr3700v4|\
wndr4300) wndr4300)
nand_do_platform_check $board $1 nand_do_platform_check $board $1
return $?; return $?
;; ;;
routerstation | \
routerstation-pro | \
ls-sr71 | \
pb42 | \
pb44 | \
all0305|\ all0305|\
eap300v2|\ eap300v2|\
eap7660d|\ eap7660d|\
ja76pf | \
ja76pf2|\ ja76pf2|\
ja76pf|\
jwap003|\ jwap003|\
ls-sr71|\
pb42|\
pb44|\
routerstation-pro|\
routerstation|\
wp543|\ wp543|\
wpe72) wpe72)
[ "$magic" != "4349" ] && { [ "$magic" != "4349" ] && {
@ -511,6 +507,7 @@ platform_check_image() {
echo "Invalid image. Contents do not match checksum (image:$md5_img calculated:$md5_chk)" echo "Invalid image. Contents do not match checksum (image:$md5_img calculated:$md5_chk)"
return 1 return 1
fi fi
return 0 return 0
;; ;;
wnr2000-v4) wnr2000-v4)
@ -518,6 +515,7 @@ platform_check_image() {
echo "Invalid image type." echo "Invalid image type."
return 1 return 1
} }
return 0 return 0
;; ;;
wnr2200) wnr2200)
@ -525,9 +523,9 @@ platform_check_image() {
echo "Invalid image type." echo "Invalid image type."
return 1 return 1
} }
return 0 return 0
;; ;;
esac esac
echo "Sysupgrade is not yet supported on $board." echo "Sysupgrade is not yet supported on $board."
@ -555,16 +553,16 @@ platform_do_upgrade() {
local board=$(ar71xx_board_name) local board=$(ar71xx_board_name)
case "$board" in case "$board" in
routerstation | \
routerstation-pro | \
ls-sr71 | \
all0305|\ all0305|\
eap7660d|\ eap7660d|\
ja76pf2|\
ja76pf|\
jwap003|\
ls-sr71|\
pb42|\ pb42|\
pb44|\ pb44|\
ja76pf | \ routerstation-pro|\
ja76pf2 | \ routerstation)
jwap003)
platform_do_upgrade_combined "$ARGV" platform_do_upgrade_combined "$ARGV"
;; ;;
wp543|\ wp543|\
@ -577,34 +575,34 @@ platform_do_upgrade() {
all0315n) all0315n)
platform_do_upgrade_allnet "0x9f080000" "$ARGV" platform_do_upgrade_allnet "0x9f080000" "$ARGV"
;; ;;
eap300v2 |\ cap4200ag|\
cap4200ag) eap300v2)
platform_do_upgrade_allnet "0xbf0a0000" "$ARGV" platform_do_upgrade_allnet "0xbf0a0000" "$ARGV"
;; ;;
dir-825-b1|\ dir-825-b1|\
tew-673gru) tew-673gru)
platform_do_upgrade_dir825b "$ARGV" platform_do_upgrade_dir825b "$ARGV"
;; ;;
mr1750 | \
mr1750v2|\ mr1750v2|\
mr600 | \ mr1750|\
mr600v2|\ mr600v2|\
mr900 | \ mr600|\
mr900v2|\ mr900v2|\
om2p | \ mr900|\
om2pv2 | \
om2p-hs | \
om2p-hsv2|\ om2p-hsv2|\
om2p-hsv3|\ om2p-hsv3|\
om2p-hs|\
om2p-lc|\ om2p-lc|\
om5p | \ om2pv2|\
om5p-an | \ om2p|\
om5p-acv2|\
om5p-ac|\ om5p-ac|\
om5p-acv2) om5p-an|\
om5p)
platform_do_upgrade_openmesh "$ARGV" platform_do_upgrade_openmesh "$ARGV"
;; ;;
unifi-outdoor-plus | \ uap-pro|\
uap-pro) unifi-outdoor-plus)
MTD_CONFIG_ARGS="-s 0x180000" MTD_CONFIG_ARGS="-s 0x180000"
default_do_upgrade "$ARGV" default_do_upgrade "$ARGV"
;; ;;