-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild
executable file
·429 lines (376 loc) · 10.4 KB
/
build
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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
#!/bin/bash
set -e
# profiles
profiles=(wg3526 wg3526_audit wg3526_iptv wg3526_luci wg3526_office wdr4300 mw4530r mw4530r_iptv mw4530r_yate x86)
wg3526='wg3526 acme adblock curl ddns dnsmasq etherwake freeradius hass mactelnet miniupnpd shadowsocks sqm tcpdump vlmcsd wireguard wpad'
wg3526_audit='wg3526 aircrack arp-scan dsniff ettercap iputils-arping mdk3 netdiscover nmap-ssl tcpdump tmux'
wg3526_iptv='wg3526 curl wpad rpcd uhttpd uhttpd-mod-ubus'
wg3526_luci='wg3526 luci'
wg3526_office='wg3526 adblock avahi-nodbus-daemon curl dnsmasq shadowsocks wireguard'
mw4530r='mw4530r adblock curl ddns dnsmasq freeradius mactelnet miniupnpd nlbwmon shadowsocks sqm tcpdump vlmcsd watchcat wireguard wpad'
mw4530r_iptv='mw4530r curl wpad rpcd uhttpd uhttpd-mod-ubus'
mw4530r_yate='mw4530r adblock yate ddns dnsmasq freeradius miniupnpd shadowsocks sqm watchcat vlmcsd wireguard wpad'
wdr4300='wdr4300'
x86='x86'
x86_acme='x86 acme acme-dnsapi luci luci-app-acme luci-app-uhttpd'
x86_fwknopd='x86 fwknopd luci luci-app-fwknopd'
x86_luci2='x86 luci2'
x86_vuci='x86 vuci'
# common
config_common='
CONFIG_CCACHE=y
CONFIG_DEVEL=y
CONFIG_KERNEL_BUILD_DOMAIN="builds"
CONFIG_KERNEL_BUILD_USER="buildbot"
CONFIG_OPENSSL_OPTIMIZE_SPEED=y
CONFIG_PACKAGE_diffutils=y
CONFIG_PACKAGE_wpa-cli=y
'
# targets
config_mw4530r='
CONFIG_TARGET_ath79=y
CONFIG_TARGET_ath79_generic=y
CONFIG_TARGET_ath79_generic_DEVICE_mercury_mw4530r-v1=y
'
config_wdr4300='
CONFIG_TARGET_ath79=y
CONFIG_TARGET_ath79_generic=y
CONFIG_TARGET_ath79_generic_DEVICE_tplink_tl-wdr4300=y
'
config_wg3526='
CONFIG_TARGET_ramips=y
CONFIG_TARGET_ramips_mt7621=y
CONFIG_TARGET_ramips_mt7621_DEVICE_zbtlink_zbt-wg3526-16m=y
'
config_x86='
CONFIG_TARGET_x86=y
CONFIG_TARGET_x86_64=y
CONFIG_TARGET_x86_64_Generic=y
CONFIG_VDI_IMAGES=y
'
# custom feeds
#custom_openwrt='azuwis master https://github.com/azuwis/openwrt.git'
#custom_packages='azuwis master https://github.com/azuwis/openwrt-packages.git'
# custom_telephony='azuwis master https://github.com/azuwis/openwrt-telephony.git'
# modules
config_adblock='
CONFIG_PACKAGE_adblock=y
CONFIG_PACKAGE_ca-bundle=y
CONFIG_PACKAGE_libustream-openssl=y
'
config_aircrack='
CONFIG_PACKAGE_aircrack-ng=y
CONFIG_PACKAGE_airmon-ng=y
CONFIG_PACKAGE_grep=y
CONFIG_PACKAGE_kmod-tun=y
CONFIG_PACKAGE_pciutils=y
CONFIG_PACKAGE_procps-ng=y
CONFIG_PACKAGE_procps-ng-ps=y
# CONFIG_PACKAGE_procps-ng-free is not set
# CONFIG_PACKAGE_procps-ng-kill is not set
# CONFIG_PACKAGE_procps-ng-pgrep is not set
# CONFIG_PACKAGE_procps-ng-pkill is not set
# CONFIG_PACKAGE_procps-ng-pmap is not set
# CONFIG_PACKAGE_procps-ng-pwdx is not set
# CONFIG_PACKAGE_procps-ng-skill is not set
# CONFIG_PACKAGE_procps-ng-slabtop is not set
# CONFIG_PACKAGE_procps-ng-snice is not set
# CONFIG_PACKAGE_procps-ng-tload is not set
# CONFIG_PACKAGE_procps-ng-top is not set
# CONFIG_PACKAGE_procps-ng-uptime is not set
# CONFIG_PACKAGE_procps-ng-vmstat is not set
# CONFIG_PACKAGE_procps-ng-w is not set
# CONFIG_PACKAGE_procps-ng-watch is not set
CONFIG_PACKAGE_usbutils=y
'
config_asterisk_pjsip='
CONFIG_PACKAGE_asterisk15=y
CONFIG_PACKAGE_asterisk15-bridge-simple=y
CONFIG_PACKAGE_asterisk15-pjsip=y
CONFIG_PACKAGE_asterisk15-res-rtp-asterisk=y
CONFIG_PACKAGE_asterisk15-res-srtp=y
'
config_asterisk_sip='
CONFIG_PACKAGE_asterisk15=y
CONFIG_PACKAGE_asterisk15-chan-sip=y
CONFIG_PACKAGE_asterisk15-res-rtp-asterisk=y
CONFIG_PACKAGE_asterisk15-res-srtp=y
'
config_asterisk="$config_asterisk_pjsip"
# config_curl='
# CONFIG_PACKAGE_curl=y
# CONFIG_LIBCURL_OPENSSL=y
# '
config_ddns='
CONFIG_PACKAGE_ca-bundle=y
CONFIG_PACKAGE_ddns-scripts=y
'
config_dnsmasq='
# CONFIG_PACKAGE_dnsmasq is not set
CONFIG_PACKAGE_dnsmasq-full=y
CONFIG_PACKAGE_dnsmasq_full_dhcp=y
CONFIG_PACKAGE_dnsmasq_full_ipset=y
CONFIG_PACKAGE_dnsmasq_full_noid=y
# CONFIG_PACKAGE_dnsmasq_full_auth is not set
# CONFIG_PACKAGE_dnsmasq_full_conntrack is not set
# CONFIG_PACKAGE_dnsmasq_full_dhcpv6 is not set
# CONFIG_PACKAGE_dnsmasq_full_dnssec is not set
'
feed_ettercap='src-git oldpackages https://github.com/plntyk/oldpackages.git'
custom_oldpackages='azuwis master https://github.com/azuwis/openwrt-oldpackages.git'
config_freeradius='
CONFIG_PACKAGE_freeradius3=y
CONFIG_PACKAGE_freeradius3-mod-always=y
CONFIG_PACKAGE_freeradius3-mod-attr-filter=y
CONFIG_PACKAGE_freeradius3-mod-eap=y
CONFIG_PACKAGE_freeradius3-mod-eap-mschapv2=y
CONFIG_PACKAGE_freeradius3-mod-eap-peap=y
CONFIG_PACKAGE_freeradius3-mod-eap-tls=y
CONFIG_PACKAGE_freeradius3-mod-files=y
CONFIG_PACKAGE_freeradius3-mod-mschap=y
'
config_hass='
CONFIG_PACKAGE_rpcd=y
CONFIG_PACKAGE_uhttpd-mod-ubus=y
CONFIG_PACKAGE_uhttpd=y
'
config_kallsyms='CONFIG_KERNEL_KALLSYMS=y'
config_luci='
CONFIG_PACKAGE_luci=y
CONFIG_PACKAGE_luci-theme-material=y
'
config_luci_zh='
CONFIG_LUCI_LANG_zh-cn=y
'
feed_luci2='src-git luci2 https://github.com/jow-/luci-ng.git'
config_luci2='CONFIG_PACKAGE_luci2-ui-base=y'
config_mactelnet='
CONFIG_PACKAGE_mac-telnet-client=y
CONFIG_PACKAGE_mac-telnet-discover=y
'
config_mwan='
CONFIG_PACKAGE_ip-full=y
CONFIG_PACKAGE_kmod-macvlan=y
CONFIG_PACKAGE_mwan3=y
'
config_noipv6='
# CONFIG_IPV6 is not set
# CONFIG_KERNEL_IPV6 is not set
# CONFIG_PACKAGE_libip6tc is not set
# CONFIG_PACKAGE_odhcpd is not set
'
config_sfe='
CONFIG_PACKAGE_kmod-fast-classifier=y
CONFIG_PACKAGE_kmod-shortcut-fe=y
'
config_shadowsocks='
CONFIG_PACKAGE_shadowsocks-libev-ss-rules=y
CONFIG_PACKAGE_stubby=y
'
config_sqm='
CONFIG_PACKAGE_kmod-sched-cake=y
CONFIG_PACKAGE_sqm-scripts=y
'
feed_vlmcsd='src-git-full azuwis https://github.com/azuwis/openwrt-azuwis.git'
feed_vuci='src-git vuci https://github.com/zhaojh329/vuci.git'
config_vuci='
CONFIG_PACKAGE_vuci-ui-base=y
'
config_wpad='
# CONFIG_PACKAGE_wpad-basic-wolfssl is not set
CONFIG_PACKAGE_wpad-wolfssl=y
'
config_yate='
CONFIG_PACKAGE_yate=y
CONFIG_PACKAGE_yate-mod-openssl=y
CONFIG_PACKAGE_yate-mod-regexroute=y
CONFIG_PACKAGE_yate-mod-regfile=y
CONFIG_PACKAGE_yate-mod-yrtpchan=y
CONFIG_PACKAGE_yate-mod-ysipchan=y
'
feed_xkcptun='src-git xkcptun https://github.com/gigibox/openwrt-xkcptun.git'
generate_config() {
local target="$@"
echo "$config_common"
local module
for module in $target
do
config="config_${module//-/_}"
config="${!config}"
if [ -n "$config" ]
then
echo "$config"
else
echo "CONFIG_PACKAGE_${module}=y"
fi
done
}
hr() {
echo '------------------------------------------------------------'
}
custom_source() {
local dir config
dir="$1"
config="$2"
pushd "$dir" >/dev/null
local remote branch url
read -r remote branch url <<<"$config"
if ! git remote | grep -qFx "$remote"
then
git remote add "$remote" "$url"
fi
if [ "$update_source" = "yes" ]; then
git pull "$remote" "$branch"
git rebase origin/master
fi
if [ "$push_custom" = "yes" ]; then
git push --force "$remote" "$branch"
fi
popd >/dev/null
}
update_source() {
local target="$@"
if [ "$update_source" = "yes" ]; then
hr
echo "OpenWRT: Update from origin/master"
GIT_MERGE_AUTOEDIT=no git pull --rebase origin master
fi
#echo "Override: openwrt => $custom_openwrt"
#custom_source . "$custom_openwrt"
cp feeds.conf.default feeds.conf
local module
for module in $target
do
local feed
feed="feed_${module//-/_}"
feed="${!feed}"
if [ -n "$feed" ]
then
echo "Custom: $feed"
echo "$feed" >> feeds.conf
local _ feed_name _
read -r _ feed_name _ <<<"$feed"
custom_feeds="$custom_feeds $feed_name"
fi
done
local feed
for feed in $(awk '/^src-git / {print $2}' feeds.conf)
do
local custom
custom="custom_$feed"
custom="${!custom}"
if [ -n "$custom" ]
then
sed -i "s/^src-git $feed /src-git-full $feed /" feeds.conf
fi
done
if [ "$update_source" = "yes" ]; then
GIT_MERGE_AUTOEDIT=no ./scripts/feeds update -a
fi
for feed in $(awk '/^src-git-full / {print $2}' feeds.conf)
do
local custom
custom="custom_$feed"
custom="${!custom}"
if [ -n "$custom" ]
then
echo "Override: $feed => $custom"
custom_source "feeds/$feed" "$custom"
fi
done
if [ "$update_source" = "yes" ]; then
hr
echo 'Feeds install:'
./scripts/feeds install -a
fi
}
push_packages() {
hr
echo "Binary packages:"
if ! [ -e binary-packages ]
then
git clone --branch gh-pages https://github.com/azuwis/openwrt-binary-packages.git
fi
for feed in $custom_feeds
do
rsync -avR --delete bin/packages/./*/$feed/ binary-packages/
done
pushd binary-packages >/dev/null
git add .
if [ "$(git status --porcelain | grep -cEv '/(Packages\.sig)$')" -gt 0 ]
then
git commit -m 'Update'
git push
fi
popd >/dev/null
}
while getopts ":Pgpu" option
do
case "$option" in
P) push_packages_only="yes" ;;
g) generate_only="yes" ;;
p) push_custom="yes" ;;
u) update_source="yes" ;;
esac
done
shift "$((OPTIND-1))"
targets="$@"
if [ -z "$targets" ]
then
for i in "${!profiles[@]}"
do
printf "%s %s\n" "[$((i+1))]" "${profiles[$i]}"
done
echo -en "\ntargets:\033[1A\radd: "
while read i
do
if [ "$i" = '' ]
then
if [ -z "$targets" ]
then
targets="${profiles[0]}"
echo -e "targets: ${targets}\033[1A\033[2K\radd: "
fi
break
fi
targets="${profiles[$((i-1))]} $targets"
echo -en "targets: ${targets}\033[1A\033[2K\radd: "
done
echo
fi
for target in $targets
do
modules="${!target}"
if [ -z "$modules" ]
then
echo "No target found: $target"
exit 1
fi
hr
echo "Feeds: $target"
custom_feeds=''
update_source "$modules"
if [ "$push_packages_only" = "yes" ]
then
push_packages
continue
fi
hr
echo "Config: $target"
generate_config "$modules" > .config
make defconfig
./scripts/diffconfig.sh
if [ "$generate_only" != "yes" ]
then
hr
echo "Build: $target"
extra_image_name="${target#*_}"
if [ "$extra_image_name" == "$target" ]
then
make -j12
else
make -j12 EXTRA_IMAGE_NAME="$extra_image_name"
fi
push_packages
fi
done