-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgen2_index_ubnt.pl
executable file
·293 lines (235 loc) · 7.37 KB
/
gen2_index_ubnt.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
#!/usr/bin/perl
#my $file_root="/Users/darrylquinn/Desktop/aredn/downloads/firmware/ubnt";
#my $md5cmd="md5 -r";
my $file_root="/mnt/data/www/downloads/firmware/ubnt";
my $md5cmd="md5sum";
my $download_root="http://downloads.arednmesh.org/firmware/ubnt";
print "AREDN Production Page maker...\n\n";
my %image_type = (
#factory => "Use \"factory\" file when loading from AirOS or TFTP",
#sysupgrade => "Use \"sysupgrade\" file when loading from AREDN or BBHN"
factory => "Loading from AirOS or TFTP",
sysupgrade => "Loading from AREDN or BBHN"
);
my @firmware = (
{
mfg => "ubnt",
mfg_name=> "Ubiquiti",
family => "bullet-m",
models => [
"AirGrid M2",
"AirGrid M5",
"Bullet M2",
"Bullet M5",
"Bullet M2 Titanium",
"Bullet M5 Titanium",
"NanoBridge M2",
"NanoBridge M5",
"NanoBridge M9",
"NanoStation Loco M2",
"NanoStation Loco M5 (XM)",
"NanoStation Loco M9",
"PicoStation M2",
],
},
{
mfg => "ubnt",
mfg_name=> "Ubiquiti",
family => "nano-m",
models => [
"NanoBridge M3",
"NanoStation M2",
"NanoStation M3",
"NanoStation M5 (XM)",
],
},
{
mfg => "ubnt",
mfg_name=> "Ubiquiti",
family => "rocket-m",
models => [
"Rocket M2",
"Rocket M3",
"Rocket M5",
"Rocket M9",
],
},
{
mfg => "ubnt",
mfg_name=> "Ubiquiti",
family => "nano-m-xw",
models => [
"NanoStation M5 (XW)",
],
},
{
mfg => "ubnt",
mfg_name=> "Ubiquiti",
family => "airrouter",
models => [
"AirRouter",
"AirRouter HP",
],
},
{
mfg => "cpe210",
mfg_name=> "TP-Link",
family => "220-510-520",
models => [
"CPE210",
"CPE510"
],
},
);
my @patches = (
{
name => "V3.0.2 OTA Support Final",
filename => "patch302OTAFinal.tgz",
desc => "Over The Air Upgrade support for AREDN v3.0.2. To be used on AREDN 3.0.2 only and provides the \"Keep Settings\" checkbox on the admin page.",
},
{
name => "AREDN V3.15.1.0 Sysupgrade Patch",
filename => "patch-sysupgrade3.tgz",
desc => "Recommended to reduce the chance of firmware updates timing out and to eliminate the risk of nodes losing configuration information during a sysupgrade. TO BE USED ON AREDN 3.15.1.0 ONLY. Node will reboot after applying this patch.",
},
);
# ==============================================================================================
$ver = shift;
die unless $ver;
my $prev_mfg;
#open(IDX, ">", "/mnt/data/www/downloads/firmware/ubnt/html/experimental2.html") or die("$!");
open(IDX, ">", "$file_root/html/stable2.html") or die("$!");
print IDX << 'INDEXHTMLHEADER';
<html>
<head>
<title>AREDN™ Stable Firmware</title>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<style>
body {
font-family: Verdana;
}
.main-section {
width: 80%;
border: solid 1px black;
}
.latest-version-section {
background-color: #e0e0e0;
}
.mfg-section {
background-color: #e0e0e0;
}
.image-section td {
border: solid 1px black;
}
.models {}
.image-size {}
.image-link-section {}
.models {}
.patches-section {}
.patch-section td {
border: solid 1px black;
}
.experimental-warning {
font-weight: bold;
color: #FF0000;
}
.message-section {
background-color: #E4CCC9;
}
#image-md5 { font-size: 8pt;}
#note {
background-color: yellow;
font-size: 8pt;
color: black;
}
</style>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-62457121-1', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<center>
<p>
<table class="main-section" cellpadding=5>
<!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
INDEXHTMLHEADER
# print IDX "<tr class=\"message-section\"><th colspan=3>$image_type{factory}<br>$image_type{sysupgrade}</th></tr>\n\n";
print IDX "<tr class=\"latest-version-section\"><th colspan=3>Latest Stable version is: $ver</th></tr>\n\n";
print IDX "<tr><th>STEP 1: Find your device/model from this column.</th>";
print IDX "<th colspan=2>STEP 2: Choose either the FACTORY or SYSUPGRADE file from these columns</th></tr>\n\n";
print IDX "<tr class=\"message-section\"><th> </th><th>$image_type{factory}</th><th>$image_type{sysupgrade}</th></tr>\n\n";
foreach $f (@firmware)
{
print "msg=$f->{mfg}\nmfg name=$f->{mfg_name}\nfamily=$f->{family}\n";
if ($f->{mfg} ne $prev_mfg)
{
print IDX "<tr class=\"mfg-section\"><th colspan=3>AREDN™ Firmware for $f->{mfg_name}</th></tr>\n\n";
$prev_mfg=$f->{mfg};
}
print IDX "<tr class=\"image-section\">\n";
print IDX "<td width=\"40%\" class=\"models\">";
#my @mods=@{ $f->{models} };
foreach my $model_name (@{ $f->{models}})
{
print IDX "$model_name<br />\n";
}
print IDX "</td>";
foreach $type ("factory","sysupgrade")
{
$file = "AREDN-$ver-$f->{mfg}-$f->{family}-squashfs-$type.bin";
chomp ($size = `ls -lh $file_root/$file | awk '{print \$5}'`);
chomp ($md5 = `$md5cmd $file_root/$file | awk '{print \$1}'`);
#print IDX "<td class=\"image-size\">$size</td>\n";
print IDX "<td width=\"30%\" ><a href=\"$download_root/$file\">$type</a><br>";
print IDX "<small>File: $file</small><br>";
print IDX "<small>md5sum: $md5</small><hr />Size: $size</td>\n";
}
print IDX "</tr>\n\n";
};
# ======================= PATCHES =========================
print IDX "<tr bgcolor=\"e0e0e0\"><th colspan=3><strong>Patches</strong></th></tr>";
foreach $f (@patches)
{
chomp ($size = `ls -lh $file_root/$f->{filename} | awk '{print \$5}'`);
print IDX "<tr class=\"image-section\">\n";
print IDX "<td width=\"40%\" class=\"models\">$f->{desc}</td>";
print IDX "<td width=\"60%\" colspan=\"2\"><a href=\"http://downloads.arednmesh.org/firmware/ubnt/$f->{filename}\">$f->{name}</a><hr />Size: $size</td>";
print IDX "</tr>";
}
# ====================== Footer ===========================
print IDX << 'INDEXHTMLFOOTER';
<!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
<tr bgcolor=e0e0e0><th colspan=3>Release Candidates</th></tr>
<tr>
<td><a href="http://downloads.arednmesh.org/firmware/ubnt/html/releasecandidates.html">Release Candidates</a></td>
<td align=right></td>
<td>Release Candidate builds for upcoming releases<br></td>
</tr>
<!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
<tr bgcolor=e0e0e0><th colspan=3>Nightly Builds</th></tr>
<tr>
<td><a href="http://downloads.arednmesh.org/snapshots/trunk/ar71xx/generic">Nightly Builds</a></td>
<td align=right></td>
<td>Nightly builds for upcoming releases. These builds are unsupported and are not guaranteed to work.<br></td>
</tr>
<!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
<tr bgcolor=e0e0e0><th colspan=3>Older Releases</th></tr>
<tr>
<td><a href="http://downloads.arednmesh.org/firmware/ubnt/">Older Firmware</a></td>
<td align=right></td>
<td>Previous Releases</td>
</tr>
<!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
INDEXHTMLFOOTER
print IDX "</table>";
print IDX "</p>";
print IDX "</center>";
print IDX "</body>";
print IDX "</html>";
close(IDX);