ar71xx: base-files: cleanups in lib/upgrade/platform.sh
authorPiotr Dymacz <pepe2k@gmail.com>
Thu, 29 Sep 2016 09:44:44 +0000 (11:44 +0200)
committerJohn Crispin <john@phrozen.org>
Tue, 4 Oct 2016 09:50:50 +0000 (11:50 +0200)
This includes:

- code style fixes
- fix boards order within case sections

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
target/linux/ar71xx/base-files/lib/upgrade/platform.sh

index c78d1fb34f701de7bd64f4f94f9a3714fa0abe87..3ff8e172b0cc0429c87d871a0d1dfc9c9aa08f94 100755 (executable)
@@ -149,7 +149,6 @@ alfa_check_image() {
                        return 1
                }
                ;;
-
        "68737173")
                [ "$fw_part_size" != "7929856" ] && {
                        echo "Invalid image magic \"$magic_long\" for $fw_part_size bytes"
@@ -169,144 +168,142 @@ platform_check_image() {
        [ "$#" -gt 1 ] && return 1
 
        case "$board" in
-       all0315n | \
-       all0258n | \
-       cap324 | \
-       cap4200ag | \
-       cr3000 |\
+       all0258n|\
+       all0315n|\
+       cap324|\
+       cap4200ag|\
+       cr3000|\
        cr5000)
                platform_check_image_allnet "$1" && return 0
                return 1
                ;;
-       alfa-ap96 | \
-       alfa-nx | \
-       arduino-yun | \
-       ap113 | \
-       ap121 | \
-       ap121-mini | \
-       ap136-010 | \
-       ap136-020 | \
-       ap135-020 | \
-       ap147-010 | \
-       ap152 | \
-       ap96 | \
-       bxu2000n-2-a1 | \
-       db120 | \
-       dr344 | \
-       f9k1115v2 |\
-       hornet-ub | \
-       mr12 | \
-       mr16 | \
-       wpj558 | \
-       zbt-we1526 | \
-       zcn-1523h-2 | \
+       alfa-ap96|\
+       alfa-nx|\
+       ap113|\
+       ap121-mini|\
+       ap121|\
+       ap135-020|\
+       ap136-010|\
+       ap136-020|\
+       ap147-010|\
+       ap152|\
+       ap96|\
+       arduino-yun|\
+       bxu2000n-2-a1|\
+       db120|\
+       dr344|\
+       f9k1115v2|\
+       hornet-ub|\
+       mr12|\
+       mr16|\
+       wpj558|\
+       zbt-we1526|\
+       zcn-1523h-2|\
        zcn-1523h-5)
                [ "$magic_long" != "68737173" -a "$magic_long" != "19852003" ] && {
                        echo "Invalid image type."
                        return 1
                }
+
                return 0
                ;;
-       ap81 | \
-       ap83 | \
-       ap132 | \
-       c-55 | \
-       cf-e316n-v2 | \
-       dgl-5500-a1 |\
-       dhp-1565-a1 |\
-       dir-505-a1 | \
-       dir-600-a1 | \
-       dir-615-c1 | \
-       dir-615-e1 | \
-       dir-615-e4 | \
-       dir-615-i1 | \
-       dir-825-c1 | \
-       dir-835-a1 | \
-       dlan-hotspot | \
-       dlan-pro-500-wp | \
-       dlan-pro-1200-ac | \
-       dr531 | \
-       dragino2 | \
-       epg5000 | \
-       esr1750 | \
-       esr900 | \
-       ew-dorin | \
-       ew-dorin-router | \
-       gl-ar150 | \
-       gl-mifi | \
-       gl-ar300 | \
-       gl-ar300m | \
-       gl-domino | \
-       hiwifi-hc6361 | \
-       hornet-ub-x2 | \
-       jwap230 | \
-       mzk-w04nu | \
-       mzk-w300nh | \
-       tew-632brp | \
-       tew-712br | \
-       tew-732br | \
-       tew-823dru | \
-       wrt400n | \
-       airgateway | \
-       airgatewaypro | \
-       airrouter | \
-       bullet-m | \
-       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-hp-g300n | \
-       whr-hp-gn | \
-       wlae-ag300n | \
-       nbg460n_550n_550nh | \
-       unifi | \
-       unifiac-lite | \
-       unifiac-pro | \
-       unifi-outdoor | \
-       carambola2 | \
-       weio | \
-       wrtnode2q)
+       airgatewaypro|\
+       airgateway|\
+       airrouter|\
+       ap132|\
+       ap81|\
+       ap83|\
+       bullet-m|\
+       c-55|\
+       carambola2|\
+       cf-e316n-v2|\
+       dgl-5500-a1|\
+       dhp-1565-a1|\
+       dir-505-a1|\
+       dir-600-a1|\
+       dir-615-c1|\
+       dir-615-e1|\
+       dir-615-e4|\
+       dir-615-i1|\
+       dir-825-c1|\
+       dir-835-a1|\
+       dlan-hotspot|\
+       dlan-pro-1200-ac|\
+       dlan-pro-500-wp|\
+       dr531|\
+       dragino2|\
+       epg5000|\
+       esr1750|\
+       esr900|\
+       ew-dorin-router|\
+       ew-dorin|\
+       gl-ar150|\
+       gl-ar300m|\
+       gl-ar300|\
+       gl-domino|\
+       gl-mifi|\
+       hiwifi-hc6361|\
+       hornet-ub-x2|\
+       jwap230|\
+       loco-m-xw|\
+       mzk-w04nu|\
+       mzk-w300nh|\
+       nanostation-m-xw|\
+       nanostation-m|\
+       nbg460n_550n_550nh|\
+       rocket-m-ti|\
+       rocket-m-xw|\
+       rocket-m|\
+       rw2458n|\
+       tew-632brp|\
+       tew-712br|\
+       tew-732br|\
+       tew-823dru|\
+       unifi-outdoor|\
+       unifiac-lite|\
+       unifiac-pro|\
+       unifi|\
+       weio|\
+       whr-g301n|\
+       whr-hp-g300n|\
+       whr-hp-gn|\
+       wlae-ag300n|\
+       wndap360|\
+       wpj342|\
+       wpj344|\
+       wpj531|\
+       wrt400n|\
+       wrtnode2q|\
+       wzr-450hp2|\
+       wzr-hp-ag300h|\
+       wzr-hp-g300nh2|\
+       wzr-hp-g300nh|\
+       wzr-hp-g450h)
                [ "$magic" != "2705" ] && {
                        echo "Invalid image type."
                        return 1
                }
+
                return 0
                ;;
-
        cpe210|\
        cpe510)
                tplink_pharos_check_image "$1" && return 0
                return 1
                ;;
-
-       bsb | \
-       dir-825-b1 | \
+       bsb|\
+       dir-825-b1|\
        tew-673gru)
                dir825b_check_image "$1" && return 0
                ;;
-
        mynet-rext|\
        wrt160nl)
                cybertan_check_image "$1" && return 0
                return 1
                ;;
-
-       qihoo-c301 | \
-       mynet-n600 | \
-       mynet-n750)
+       mynet-n600|\
+       mynet-n750|\
+       qihoo-c301)
                [ "$magic_long" != "5ea3a417" ] && {
                        echo "Invalid image, bad magic: $magic_long"
                        return 1
@@ -318,93 +315,92 @@ platform_check_image() {
                        return 1
                }
 
-               return 0;
+               return 0
                ;;
-       mr1750 | \
-       mr1750v2 | \
-       mr600 | \
-       mr600v2 | \
-       mr900 | \
-       mr900v2 | \
-       om2p | \
-       om2pv2 | \
-       om2p-hs | \
-       om2p-hsv2 | \
-       om2p-hsv3 | \
-       om2p-lc | \
-       om5p | \
-       om5p-an | \
-       om5p-ac | \
-       om5p-acv2)
+       mr1750v2|\
+       mr1750|\
+       mr600v2|\
+       mr600|\
+       mr900v2|\
+       mr900|\
+       om2p-hsv2|\
+       om2p-hsv3|\
+       om2p-hs|\
+       om2p-lc|\
+       om2pv2|\
+       om2p|\
+       om5p-acv2|\
+       om5p-ac|\
+       om5p-an|\
+       om5p)
                platform_check_image_openmesh "$magic_long" "$1" && return 0
                return 1
                ;;
-
-       antminer-s1 | \
-       antminer-s3 | \
-       antrouter-r1 | \
-       archer-c5 | \
-       archer-c7 | \
-       el-m150 | \
-       el-mini | \
-       gl-inet | \
-       mc-mac1200r | \
-       minibox-v1 |\
-       omy-g1 |\
-       omy-x1 |\
-       onion-omega | \
-       oolite | \
-       smart-300 | \
-       som9331 | \
-       tellstick-znet-lite | \
-       tl-mr10u | \
-       tl-mr11u | \
-       tl-mr12u | \
-       tl-mr13u | \
-       tl-mr3020 | \
-       tl-mr3040 | \
-       tl-mr3040-v2 | \
-       tl-mr3220 | \
-       tl-mr3220-v2 | \
-       tl-mr3420 | \
-       tl-mr3420-v2 | \
-       tl-wa701nd-v2 | \
-       tl-wa7210n-v2 | \
-       tl-wa7510n | \
-       tl-wa750re | \
-       tl-wa850re | \
-       tl-wa860re | \
-       tl-wa801nd-v2 | \
-       tl-wa901nd | \
-       tl-wa901nd-v2 | \
-       tl-wa901nd-v3 | \
-       tl-wa901nd-v4 | \
-       tl-wdr3320-v2 | \
-       tl-wdr3500 | \
-       tl-wdr4300 | \
-       tl-wdr4900-v2 | \
-       tl-wdr6500-v2 | \
-       tl-wr703n | \
-       tl-wr710n | \
-       tl-wr720n-v3 | \
-       tl-wr741nd | \
-       tl-wr741nd-v4 | \
-       tl-wr810n | \
-       tl-wr841n-v1 | \
-       tl-wa830re-v2 | \
-       tl-wr841n-v7 | \
-       tl-wr841n-v8 | \
-       tl-wr841n-v9 | \
-       tl-wr841n-v11 | \
-       tl-wr842n-v2 | \
-       tl-wr842n-v3 | \
-       tl-wr941nd | \
-       tl-wr941nd-v5 | \
-       tl-wr941nd-v6 | \
-       tl-wr1041n-v2 | \
-       tl-wr1043nd | \
-       tl-wr1043nd-v2 | \
-       tl-wr2543n)
+       antminer-s1|\
+       antminer-s3|\
+       antrouter-r1|\
+       archer-c5|\
+       archer-c7|\
+       el-m150|\
+       el-mini|\
+       gl-inet|\
+       mc-mac1200r|\
+       minibox-v1|\
+       omy-g1|\
+       omy-x1|\
+       onion-omega|\
+       oolite|\
+       smart-300|\
+       som9331|\
+       tellstick-znet-lite|\
+       tl-mr10u|\
+       tl-mr11u|\
+       tl-mr12u|\
+       tl-mr13u|\
+       tl-mr3020|\
+       tl-mr3040-v2|\
+       tl-mr3040|\
+       tl-mr3220-v2|\
+       tl-mr3220|\
+       tl-mr3420-v2|\
+       tl-mr3420|\
+       tl-wa701nd-v2|\
+       tl-wa7210n-v2|\
+       tl-wa750re|\
+       tl-wa7510n|\
+       tl-wa801nd-v2|\
+       tl-wa830re-v2|\
+       tl-wa850re|\
+       tl-wa860re|\
+       tl-wa901nd-v2|\
+       tl-wa901nd-v3|\
+       tl-wa901nd-v4|\
+       tl-wa901nd|\
+       tl-wdr3320-v2|\
+       tl-wdr3500|\
+       tl-wdr4300|\
+       tl-wdr4900-v2|\
+       tl-wdr6500-v2|\
+       tl-wr1041n-v2|\
+       tl-wr1043nd-v2|\
+       tl-wr1043nd|\
+       tl-wr2543n|\
+       tl-wr703n|\
+       tl-wr710n|\
+       tl-wr720n-v3|\
+       tl-wr741nd-v4|\
+       tl-wr741nd|\
+       tl-wr810n|\
+       tl-wr841n-v11|\
+       tl-wr841n-v1|\
+       tl-wr841n-v7|\
+       tl-wr841n-v8|\
+       tl-wr841n-v9|\
+       tl-wr842n-v2|\
+       tl-wr842n-v3|\
+       tl-wr941nd-v5|\
+       tl-wr941nd-v6|\
+       tl-wr941nd)
                local magic_ver="0100"
 
                case "$board" in
@@ -443,25 +439,24 @@ platform_check_image() {
 
                return 0
                ;;
-
        tube2h)
                alfa_check_image "$1" && return 0
                return 1
                ;;
-
-       nbg6616 | \
-       unifi-outdoor-plus | \
-       uap-pro)
+       nbg6616|\
+       uap-pro|\
+       unifi-outdoor-plus)
                [ "$magic_long" != "19852003" ] && {
                        echo "Invalid image type."
                        return 1
                }
+
                return 0
                ;;
-       wndr3700 | \
-       wnr2000-v3 | \
-       wnr612-v2 | \
-       wnr1000-v2 | \
+       wndr3700|\
+       wnr1000-v2|\
+       wnr2000-v3|\
+       wnr612-v2|\
        wpn824n)
                local hw_magic
 
@@ -470,32 +465,33 @@ platform_check_image() {
                        echo "Invalid image, hardware ID mismatch, hw:$hw_magic image:$magic_long."
                        return 1
                }
+
                return 0
                ;;
-       mr18 | \
-       z1 )
+       mr18|\
+       z1)
                merakinand_do_platform_check $board $1
-               return $?;
+               return $?
                ;;
-       nbg6716 | \
-       r6100 | \
-       wndr3700v4 | \
-       wndr4300 )
+       nbg6716|\
+       r6100|\
+       wndr3700v4|\
+       wndr4300)
                nand_do_platform_check $board $1
-               return $?;
+               return $?
                ;;
-       routerstation | \
-       routerstation-pro | \
-       ls-sr71 | \
-       pb42 | \
-       pb44 | \
-       all0305 | \
-       eap300v2 | \
-       eap7660d | \
-       ja76pf | \
-       ja76pf2 | \
-       jwap003 | \
-       wp543 | \
+       all0305|\
+       eap300v2|\
+       eap7660d|\
+       ja76pf2|\
+       ja76pf|\
+       jwap003|\
+       ls-sr71|\
+       pb42|\
+       pb44|\
+       routerstation-pro|\
+       routerstation|\
+       wp543|\
        wpe72)
                [ "$magic" != "4349" ] && {
                        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)"
                        return 1
                fi
+
                return 0
                ;;
        wnr2000-v4)
@@ -518,16 +515,17 @@ platform_check_image() {
                        echo "Invalid image type."
                        return 1
                }
+
                return 0
                ;;
        wnr2200)
-                [ "$magic_long" != "32323030" ] && {
-                        echo "Invalid image type."
-                        return 1
-                }
-                return 0
-                ;;
+               [ "$magic_long" != "32323030" ] && {
+                       echo "Invalid image type."
+                       return 1
+               }
 
+               return 0
+               ;;
        esac
 
        echo "Sysupgrade is not yet supported on $board."
@@ -538,14 +536,14 @@ platform_pre_upgrade() {
        local board=$(ar71xx_board_name)
 
        case "$board" in
-       nbg6716 | \
-       r6100 | \
-       wndr3700v4 | \
-       wndr4300 )
+       nbg6716|\
+       r6100|\
+       wndr3700v4|\
+       wndr4300)
                nand_do_upgrade "$1"
                ;;
-       mr18 | \
-       z1 )
+       mr18|\
+       z1)
                merakinand_do_upgrade "$1"
                ;;
        esac
@@ -555,56 +553,56 @@ platform_do_upgrade() {
        local board=$(ar71xx_board_name)
 
        case "$board" in
-       routerstation | \
-       routerstation-pro | \
-       ls-sr71 | \
-       all0305 | \
-       eap7660d | \
-       pb42 | \
-       pb44 | \
-       ja76pf | \
-       ja76pf2 | \
-       jwap003)
+       all0305|\
+       eap7660d|\
+       ja76pf2|\
+       ja76pf|\
+       jwap003|\
+       ls-sr71|\
+       pb42|\
+       pb44|\
+       routerstation-pro|\
+       routerstation)
                platform_do_upgrade_combined "$ARGV"
                ;;
        wp543|\
        wpe72)
                platform_do_upgrade_compex "$ARGV"
                ;;
-       all0258n )
+       all0258n)
                platform_do_upgrade_allnet "0x9f050000" "$ARGV"
                ;;
-       all0315n )
+       all0315n)
                platform_do_upgrade_allnet "0x9f080000" "$ARGV"
                ;;
-       eap300v2 |\
-       cap4200ag)
+       cap4200ag|\
+       eap300v2)
                platform_do_upgrade_allnet "0xbf0a0000" "$ARGV"
                ;;
-       dir-825-b1 |\
+       dir-825-b1|\
        tew-673gru)
                platform_do_upgrade_dir825b "$ARGV"
                ;;
-       mr1750 | \
-       mr1750v2 | \
-       mr600 | \
-       mr600v2 | \
-       mr900 | \
-       mr900v2 | \
-       om2p | \
-       om2pv2 | \
-       om2p-hs | \
-       om2p-hsv2 | \
-       om2p-hsv3 | \
-       om2p-lc | \
-       om5p | \
-       om5p-an | \
-       om5p-ac | \
-       om5p-acv2)
+       mr1750v2|\
+       mr1750|\
+       mr600v2|\
+       mr600|\
+       mr900v2|\
+       mr900|\
+       om2p-hsv2|\
+       om2p-hsv3|\
+       om2p-hs|\
+       om2p-lc|\
+       om2pv2|\
+       om2p|\
+       om5p-acv2|\
+       om5p-ac|\
+       om5p-an|\
+       om5p)
                platform_do_upgrade_openmesh "$ARGV"
                ;;
-       unifi-outdoor-plus | \
-       uap-pro)
+       uap-pro|\
+       unifi-outdoor-plus)
                MTD_CONFIG_ARGS="-s 0x180000"
                default_do_upgrade "$ARGV"
                ;;