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,144 +168,142 @@ 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|\
cr5000) cr5000)
platform_check_image_allnet "$1" && return 0 platform_check_image_allnet "$1" && return 0
return 1 return 1
;; ;;
alfa-ap96 | \ alfa-ap96|\
alfa-nx | \ alfa-nx|\
arduino-yun | \ ap113|\
ap113 | \ ap121-mini|\
ap121 | \ ap121|\
ap121-mini | \ 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|\
f9k1115v2 |\ f9k1115v2|\
hornet-ub | \ hornet-ub|\
mr12 | \ mr12|\
mr16 | \ mr16|\
wpj558 | \ wpj558|\
zbt-we1526 | \ zbt-we1526|\
zcn-1523h-2 | \ zcn-1523h-2|\
zcn-1523h-5) zcn-1523h-5)
[ "$magic_long" != "68737173" -a "$magic_long" != "19852003" ] && { [ "$magic_long" != "68737173" -a "$magic_long" != "19852003" ] && {
echo "Invalid image type." echo "Invalid image type."
return 1 return 1
} }
return 0 return 0
;; ;;
ap81 | \ airgatewaypro|\
ap83 | \ airgateway|\
ap132 | \ airrouter|\
c-55 | \ ap132|\
cf-e316n-v2 | \ ap81|\
dgl-5500-a1 |\ ap83|\
dhp-1565-a1 |\ bullet-m|\
dir-505-a1 | \ c-55|\
dir-600-a1 | \ carambola2|\
dir-615-c1 | \ cf-e316n-v2|\
dir-615-e1 | \ dgl-5500-a1|\
dir-615-e4 | \ dhp-1565-a1|\
dir-615-i1 | \ dir-505-a1|\
dir-825-c1 | \ dir-600-a1|\
dir-835-a1 | \ dir-615-c1|\
dlan-hotspot | \ dir-615-e1|\
dlan-pro-500-wp | \ dir-615-e4|\
dlan-pro-1200-ac | \ dir-615-i1|\
dr531 | \ dir-825-c1|\
dragino2 | \ dir-835-a1|\
epg5000 | \ dlan-hotspot|\
esr1750 | \ dlan-pro-1200-ac|\
esr900 | \ dlan-pro-500-wp|\
ew-dorin | \ dr531|\
ew-dorin-router | \ dragino2|\
gl-ar150 | \ epg5000|\
gl-mifi | \ esr1750|\
gl-ar300 | \ esr900|\
gl-ar300m | \ ew-dorin-router|\
gl-domino | \ ew-dorin|\
hiwifi-hc6361 | \ gl-ar150|\
hornet-ub-x2 | \ gl-ar300m|\
jwap230 | \ gl-ar300|\
mzk-w04nu | \ gl-domino|\
mzk-w300nh | \ gl-mifi|\
tew-632brp | \ hiwifi-hc6361|\
tew-712br | \ hornet-ub-x2|\
tew-732br | \ jwap230|\
tew-823dru | \ loco-m-xw|\
wrt400n | \ mzk-w04nu|\
airgateway | \ mzk-w300nh|\
airgatewaypro | \ nanostation-m-xw|\
airrouter | \ nanostation-m|\
bullet-m | \ nbg460n_550n_550nh|\
loco-m-xw | \ rocket-m-ti|\
nanostation-m | \ rocket-m-xw|\
rocket-m | \ rocket-m|\
rocket-m-xw | \ rw2458n|\
rocket-m-ti | \ tew-632brp|\
nanostation-m-xw | \ tew-712br|\
rw2458n | \ tew-732br|\
wpj531 | \ tew-823dru|\
wndap360 | \ unifi-outdoor|\
wpj342 | \ unifiac-lite|\
wpj344 | \ unifiac-pro|\
wzr-hp-g300nh2 | \ unifi|\
wzr-hp-g300nh | \ weio|\
wzr-hp-g450h | \ whr-g301n|\
wzr-hp-ag300h | \ whr-hp-g300n|\
wzr-450hp2 | \ whr-hp-gn|\
whr-g301n | \ wlae-ag300n|\
whr-hp-g300n | \ wndap360|\
whr-hp-gn | \ wpj342|\
wlae-ag300n | \ wpj344|\
nbg460n_550n_550nh | \ wpj531|\
unifi | \ wrt400n|\
unifiac-lite | \ wrtnode2q|\
unifiac-pro | \ wzr-450hp2|\
unifi-outdoor | \ wzr-hp-ag300h|\
carambola2 | \ wzr-hp-g300nh2|\
weio | \ wzr-hp-g300nh|\
wrtnode2q) 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
;; ;;
mynet-n600|\
qihoo-c301 | \ mynet-n750|\
mynet-n600 | \ qihoo-c301)
mynet-n750)
[ "$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,93 +315,92 @@ platform_check_image() {
return 1 return 1
} }
return 0; return 0
;; ;;
mr1750 | \ mr1750v2|\
mr1750v2 | \ mr1750|\
mr600 | \ mr600v2|\
mr600v2 | \ mr600|\
mr900 | \ mr900v2|\
mr900v2 | \ mr900|\
om2p | \ om2p-hsv2|\
om2pv2 | \ om2p-hsv3|\
om2p-hs | \ om2p-hs|\
om2p-hsv2 | \ om2p-lc|\
om2p-hsv3 | \ om2pv2|\
om2p-lc | \ om2p|\
om5p | \ om5p-acv2|\
om5p-an | \ om5p-ac|\
om5p-ac | \ om5p-an|\
om5p-acv2) 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 | \ archer-c5|\
archer-c5 | \ archer-c7|\
archer-c7 | \ el-m150|\
el-m150 | \ el-mini|\
el-mini | \ gl-inet|\
gl-inet | \ mc-mac1200r|\
mc-mac1200r | \ minibox-v1|\
minibox-v1 |\ omy-g1|\
omy-g1 |\ omy-x1|\
omy-x1 |\ onion-omega|\
onion-omega | \ oolite|\
oolite | \ smart-300|\
smart-300 | \ som9331|\
som9331 | \ tellstick-znet-lite|\
tellstick-znet-lite | \ tl-mr10u|\
tl-mr10u | \ tl-mr11u|\
tl-mr11u | \ tl-mr12u|\
tl-mr12u | \ tl-mr13u|\
tl-mr13u | \ tl-mr3020|\
tl-mr3020 | \ tl-mr3040-v2|\
tl-mr3040 | \ tl-mr3040|\
tl-mr3040-v2 | \ tl-mr3220-v2|\
tl-mr3220 | \ tl-mr3220|\
tl-mr3220-v2 | \ tl-mr3420-v2|\
tl-mr3420 | \ tl-mr3420|\
tl-mr3420-v2 | \ tl-wa701nd-v2|\
tl-wa701nd-v2 | \ tl-wa7210n-v2|\
tl-wa7210n-v2 | \ tl-wa750re|\
tl-wa7510n | \ tl-wa7510n|\
tl-wa750re | \ tl-wa801nd-v2|\
tl-wa850re | \ tl-wa830re-v2|\
tl-wa860re | \ tl-wa850re|\
tl-wa801nd-v2 | \ tl-wa860re|\
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-wr703n | \ tl-wr1041n-v2|\
tl-wr710n | \ tl-wr1043nd-v2|\
tl-wr720n-v3 | \ tl-wr1043nd|\
tl-wr741nd | \ tl-wr2543n|\
tl-wr741nd-v4 | \ tl-wr703n|\
tl-wr810n | \ tl-wr710n|\
tl-wr841n-v1 | \ tl-wr720n-v3|\
tl-wa830re-v2 | \ tl-wr741nd-v4|\
tl-wr841n-v7 | \ tl-wr741nd|\
tl-wr841n-v8 | \ tl-wr810n|\
tl-wr841n-v9 | \ tl-wr841n-v11|\
tl-wr841n-v11 | \ tl-wr841n-v1|\
tl-wr842n-v2 | \ tl-wr841n-v7|\
tl-wr842n-v3 | \ tl-wr841n-v8|\
tl-wr941nd | \ tl-wr841n-v9|\
tl-wr941nd-v5 | \ tl-wr842n-v2|\
tl-wr941nd-v6 | \ tl-wr842n-v3|\
tl-wr1041n-v2 | \ tl-wr941nd-v5|\
tl-wr1043nd | \ tl-wr941nd-v6|\
tl-wr1043nd-v2 | \ tl-wr941nd)
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 | \ uap-pro|\
unifi-outdoor-plus | \ unifi-outdoor-plus)
uap-pro)
[ "$magic_long" != "19852003" ] && { [ "$magic_long" != "19852003" ] && {
echo "Invalid image type." echo "Invalid image type."
return 1 return 1
} }
return 0 return 0
;; ;;
wndr3700 | \ wndr3700|\
wnr2000-v3 | \ wnr1000-v2|\
wnr612-v2 | \ wnr2000-v3|\
wnr1000-v2 | \ wnr612-v2|\
wpn824n) wpn824n)
local hw_magic local hw_magic
@ -470,32 +465,33 @@ 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 | \ all0305|\
routerstation-pro | \ eap300v2|\
ls-sr71 | \ eap7660d|\
pb42 | \ ja76pf2|\
pb44 | \ ja76pf|\
all0305 | \ jwap003|\
eap300v2 | \ ls-sr71|\
eap7660d | \ pb42|\
ja76pf | \ pb44|\
ja76pf2 | \ routerstation-pro|\
jwap003 | \ routerstation|\
wp543 | \ wp543|\
wpe72) wpe72)
[ "$magic" != "4349" ] && { [ "$magic" != "4349" ] && {
echo "Invalid image. Use *-sysupgrade.bin files on this board" echo "Invalid image. Use *-sysupgrade.bin files on this board"
@ -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,16 +515,17 @@ platform_check_image() {
echo "Invalid image type." echo "Invalid image type."
return 1 return 1
} }
return 0 return 0
;; ;;
wnr2200) wnr2200)
[ "$magic_long" != "32323030" ] && { [ "$magic_long" != "32323030" ] && {
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."
@ -538,14 +536,14 @@ platform_pre_upgrade() {
local board=$(ar71xx_board_name) local board=$(ar71xx_board_name)
case "$board" in case "$board" in
nbg6716 | \ nbg6716|\
r6100 | \ r6100|\
wndr3700v4 | \ wndr3700v4|\
wndr4300 ) wndr4300)
nand_do_upgrade "$1" nand_do_upgrade "$1"
;; ;;
mr18 | \ mr18|\
z1 ) z1)
merakinand_do_upgrade "$1" merakinand_do_upgrade "$1"
;; ;;
esac esac
@ -555,56 +553,56 @@ platform_do_upgrade() {
local board=$(ar71xx_board_name) local board=$(ar71xx_board_name)
case "$board" in case "$board" in
routerstation | \ all0305|\
routerstation-pro | \ eap7660d|\
ls-sr71 | \ ja76pf2|\
all0305 | \ ja76pf|\
eap7660d | \ jwap003|\
pb42 | \ ls-sr71|\
pb44 | \ pb42|\
ja76pf | \ pb44|\
ja76pf2 | \ routerstation-pro|\
jwap003) routerstation)
platform_do_upgrade_combined "$ARGV" platform_do_upgrade_combined "$ARGV"
;; ;;
wp543|\ wp543|\
wpe72) wpe72)
platform_do_upgrade_compex "$ARGV" platform_do_upgrade_compex "$ARGV"
;; ;;
all0258n ) all0258n)
platform_do_upgrade_allnet "0x9f050000" "$ARGV" platform_do_upgrade_allnet "0x9f050000" "$ARGV"
;; ;;
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 | \ mr1750|\
mr600 | \ mr600v2|\
mr600v2 | \ mr600|\
mr900 | \ mr900v2|\
mr900v2 | \ mr900|\
om2p | \ om2p-hsv2|\
om2pv2 | \ om2p-hsv3|\
om2p-hs | \ om2p-hs|\
om2p-hsv2 | \ om2p-lc|\
om2p-hsv3 | \ om2pv2|\
om2p-lc | \ om2p|\
om5p | \ om5p-acv2|\
om5p-an | \ om5p-ac|\
om5p-ac | \ om5p-an|\
om5p-acv2) 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"
;; ;;