target/linux/*/base-files/lib/upgrade/platform.sh - wrong check for ARGC
[openwrt.git] / target / linux / ramips / base-files / lib / upgrade / platform.sh
1 #
2 # Copyright (C) 2010 OpenWrt.org
3 #
4
5 . /lib/ramips.sh
6
7 PART_NAME=firmware
8 RAMFS_COPY_DATA=/lib/ramips.sh
9
10 platform_check_image() {
11         local board=$(ramips_board_name)
12         local magic="$(get_magic_long "$1")"
13
14         [ "$#" -gt 1 ] && return 1
15
16         case "$board" in
17         3g-6200n | \
18         3g-6200nl | \
19         3g300m | \
20         w150m | \
21         air3gii | \
22         all0239-3g | \
23         all0256n | \
24         all5002 | \
25         all5003 | \
26         ar725w | \
27         asl26555 | \
28         awm002-evb | \
29         bc2 | \
30         broadway | \
31         carambola | \
32         d105 | \
33         dcs-930 | \
34         dir-300-b1 | \
35         dir-300-b7 | \
36         dir-320-b1 | \
37         dir-600-b1 | \
38         dir-600-b2 | \
39         dir-615-h1 | \
40         dir-615-d | \
41         dir-620-a1 | \
42         dir-620-d1 | \
43         dir-810l | \
44         dap-1350 | \
45         esr-9753 | \
46         f7c027 | \
47         fonera20n | \
48         rt-n13u | \
49         freestation5 | \
50         hw550-3g | \
51         hg255d | \
52         hlk-rm04 | \
53         ip2202 | \
54         m3 | \
55         m4 | \
56         mofi3500-3gn | \
57         mpr-a1 | \
58         mpr-a2 | \
59         mzk-w300nh2 | \
60         nbg-419n | \
61         nw718 | \
62         omni-emb | \
63         omni-emb-hpm | \
64         psr-680w | \
65         px4885 | \
66         rp-n53 | \
67         rt-g32-b1 | \
68         rt-n10-plus | \
69         rt-n14u | \
70         rt-n15 | \
71         rt-n56u | \
72         rut5xx | \
73         sl-r7205 | \
74         tew-691gr | \
75         tew-692gr | \
76         w306r-v20 |\
77         w502u |\
78         wr6202 |\
79         v22rw-2x2 | \
80         wl341v3 | \
81         wl-330n | \
82         wl-330n3g | \
83         wl-351 | \
84         wnce2001 | \
85         wli-tx4-ag300n | \
86         whr-g300n |\
87         ur-326n4g |\
88         ur-336un |\
89         wr512-3gn |\
90         wmr300 |\
91         wrtnode |\
92         x5 |\
93         x8)
94                 [ "$magic" != "27051956" ] && {
95                         echo "Invalid image type."
96                         return 1
97                 }
98                 return 0
99                 ;;
100         cy-swr1100 |\
101         dir-610-a1 |\
102         dir-645)
103                 [ "$magic" != "5ea3a417" ] && {
104                         echo "Invalid image type."
105                         return 1
106                 }
107                 return 0
108                 ;;
109         br-6475nd)
110                 [ "$magic" != "43535953" ] && {
111                         echo "Invalid image type."
112                         return 1
113                 }
114                 return 0
115                 ;;
116         esac
117
118         echo "Sysupgrade is not yet supported on $board."
119         return 1
120 }
121
122 platform_do_upgrade() {
123         local board=$(ramips_board_name)
124
125         case "$board" in
126         *)
127                 default_do_upgrade "$ARGV"
128                 ;;
129         esac
130 }
131
132 disable_watchdog() {
133         killall watchdog
134         ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
135                 echo 'Could not disable watchdog'
136                 return 1
137         }
138 }
139
140 append sysupgrade_pre_upgrade disable_watchdog