-
Notifications
You must be signed in to change notification settings - Fork 2
/
ib
executable file
·118 lines (107 loc) · 4.44 KB
/
ib
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
#!/usr/bin/env bash
set -e
# profiles and targets
mw4530r='mercury_mw4530r-v1 ath79/generic'
wdr4300='tplink_tl-wdr4300-v1 ath79/generic'
wg3526='zbtlink_zbt-wg3526-16m ramips/mt7621'
xr500='netgear_xr500 ipq806x/generic'
ath10k_noct='-ath10k-firmware-qca9984-ct -kmod-ath10k-ct ath10k-firmware-qca9984 kmod-ath10k'
x86='x86/64'
# packages
common='diffutils iwinfo wpa-cli -odhcpd-ipv6only'
aircrack='aircrack-ng airmon-ng grep kmod-tun pciutils procps-ng procps-ng-ps usbutils'
asterisk_sip='asterisk15 asterisk15-chan-sip asterisk15-res-rtp-asterisk asterisk15-res-srtp'
asterisk_pjsip='asterisk15 asterisk15-bridge-simple asterisk15-pjsip asterisk15-res-rtp-asterisk asterisk15-res-srtp'
asterisk="$asterisk_pjsip"
ddns='ca-bundle ddns-scripts'
dnsmasq='dnsmasq-full -dnsmasq'
freeradius='freeradius3 freeradius3-mod-always freeradius3-mod-attr-filter freeradius3-mod-eap freeradius3-mod-eap-mschapv2 freeradius3-mod-eap-peap freeradius3-mod-eap-tls freeradius3-mod-files freeradius3-mod-mschap'
hass='rpcd uhttpd-mod-ubus uhttpd'
luci2='luci2-ui-base'
luci='luci luci-theme-material'
luci_zh='luci-i18n-base-zh-cn'
mactelnet='mac-telnet-client mac-telnet-discover'
mwan='ip-full kmod-macvlan mwan3'
shadowsocks='shadowsocks-libev-ss-rules smartdns'
wpad='-wpad-basic-wolfssl wpad-wolfssl'
yate='yate yate-mod-openssl yate-mod-regexroute yate-mod-regfile yate-mod-yrtpchan yate-mod-ysipchan'
REPOS='src/gz azuwis https://azuwis.github.io/openwrt-binary-packages/{{ pkg_arch }}/azuwis'
# profiles
profiles=(xr500_main wg3526_main wg3526_audit wg3526_iptv wg3526_luci wg3526_office wdr4300_main mw4530r_main mw4530r_iptv mw4530r_yate x86_main)
xr500_main="$xr500 $common curl $ddns $dnsmasq etherwake $hass $mactelnet miniupnpd-nftables $shadowsocks sqm-scripts tcpdump wireguard-tools"
wg3526_main="$wg3526 $common acme adblock curl $ddns $dnsmasq etherwake $freeradius $hass $mactelnet miniupnpd-nftables $shadowsocks sqm-scripts tcpdump vlmcsd wireguard-tools ip-bridge $wpad"
wg3526_main="$wg3526 $common acme adblock curl $ddns $dnsmasq etherwake $freeradius $hass $mactelnet miniupnpd-nftables $shadowsocks sqm-scripts tcpdump vlmcsd wireguard-tools ip-bridge $wpad"
wg3526_audit="$wg3526 $aircrack arp-scan dsniff ettercap iputils-arping mdk3 netdiscover nmap-ssl tcpdump tmux"
wg3526_iptv="$wg3526 $common curl $wpad rpcd uhttpd uhttpd-mod-ubus"
wg3526_luci="$wg3526 $luci"
wg3526_office="$wg3526 adblock avahi-dbus-daemon avahi-utils curl $dnsmasq $shadowsocks sqm-scripts vlmcsd wireguard-tools ip-bridge lua libuci-lua"
mw4530r_iptv="$mw4530r $common curl $wpad rpcd uhttpd uhttpd-mod-ubus"
mw4530r_main="$mw4530r adblock curl $ddns $dnsmasq $freeradius $mactelnet miniupnpd-nftables nlbwmon $shadowsocks sqm-scripts tcpdump vlmcsd watchcat wireguard-tools $wpad"
mw4530r_yate="$mw4530r adblock $yate $ddns $dnsmasq $freeradius miniupnpd-nftables $shadowsocks sqm-scripts watchcat vlmcsd wireguard-tools $wpad"
wdr4300_main="$wdr4300"
x86_main="$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"
build() {
device="$1"
shift
profile="$1"
shift
target="$1"
shift
packages="$@"
echo "PROFILE=$profile TARGET=$target PACKAGES=\"$packages\" EXTRA_IMAGE_NAME="$device" REPOS=\"$REPOS\""
if [ "$GEN_ONLY" != 'yes' ]
then
PROFILE="$profile" TARGET="$target" PACKAGES="$packages" EXTRA_IMAGE_NAME="$device" REPOS="$REPOS" FILES="files/$device" ./meta image
fi
}
hr() {
echo '------------------------------------------------------------'
}
while getopts "g" option
do
case "$option" in
g) GEN_ONLY="yes" ;;
*) ;;
esac
done
shift "$((OPTIND-1))"
devices="$@"
if [ -z "$devices" ]
then
for i in "${!profiles[@]}"
do
printf "%s %s\n" "[$((i+1))]" "${profiles[$i]}"
done
echo -en "\ndevices:\033[1A\radd: "
while read -r i
do
if [ "$i" = '' ]
then
if [ -z "$devices" ]
then
devices="${profiles[0]}"
echo -e "devices: ${devices}\033[1A\033[2K\radd: "
fi
break
fi
devices="${profiles[$((i-1))]} $devices"
echo -en "devices: ${devices}\033[1A\033[2K\radd: "
done
echo
fi
for device in $devices
do
modules="${!device}"
if [ -z "$modules" ]
then
echo "No device found: $device"
exit 1
fi
hr
echo "Build: $device"
build "$device" $modules
done