-
Notifications
You must be signed in to change notification settings - Fork 163
295 lines (290 loc) · 16.6 KB
/
build_vb1980_kernal4.4_padavan_multi_targets.yml
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
name: Build vb1980's kernal4.4 Padavan for multi targets
on:
workflow_dispatch:
inputs:
targets:
description: 'targets to compile'
required: true
default: "['SIM-AX1800T','HAR-20S2U1','CR660x','JCG-Q20']"
plugins:
description: 'json format string of include configs'
required: true
default: '{"vpnsvr":"n","vpncli":"n","vpncmd":"n","ss":"n","v2ray":"n","xray":"n","trojan":"n","ssobfs":"n","dnsforwarder":"n","adbyby":"n","adguardhome":"n","smartdns":"n","aliddns":"n","zerotier":"n","ddnsto":"n","wireguard":"n","frpc":"y","aldrive":"n","sqm":"y","mentohust":"n","scutclient":"n","njitclient":"n","minieap":"n","dogcom":"n"}'
usexraymin:
type: boolean
description: 'use streamlined xray'
default: false
customization:
description: 'json format string of customized configs'
required: true
default: '{"rainbowui":"y","specializedlogo":"n","changebrandlogo":"n","lanip":"192.168.2.1","signaccount":"admin","signpassword":"admin","wifi2gssid":"","wifi5gssid":"","wifi2gpsk":"","wifi5gpsk":""}'
firmwarever:
description: 'firmware''s version'
required: true
default: '20240410'
env:
REPOSITORY_URL: https://github.com/vb1980/padavan-4.4.git
WORK_PATH: /opt/padavan-4.4
DEFAULT_FILE: ./user/shared/defaults.h
DICT_FILE: ./user/www/dict/CN.dict
TIME_ZONE: Asia/Shanghai
FIRMWARE_DATEPREFIX: $(date +"%Y%m%d")
FIRMWARE_AUTHOR: vb1980
FIRMWARE_PATH: /opt/firmwares
jobs:
build:
runs-on: ubuntu-latest
if: github.event.repository.owner.id == github.event.sender.id
strategy:
fail-fast: false
matrix:
target: ${{ fromJSON(github.event.inputs.targets) }}
steps:
- uses: actions/checkout@v4
- uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.target }}
append-timestamp: false
- uses: actions/setup-go@v5
with:
go-version: '1.23.0'
check-latest: true
cache-dependency-path: '**/go.sum'
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update
sudo apt install unzip libtool-bin curl cmake gperf gawk flex bison nano xxd \
fakeroot kmod cpio git python3-docutils gettext automake autopoint \
texinfo build-essential help2man pkg-config zlib1g-dev libgmp3-dev \
libmpc-dev libmpfr-dev libncurses5-dev libltdl-dev wget libc-dev-bin libev-dev ccache \
libssl-dev liblzo2-dev libpam0g-dev
sudo timedatectl set-timezone "$TIME_ZONE"
- name: Clone source code
run: |
git clone --depth=1 $REPOSITORY_URL $WORK_PATH
cd $WORK_PATH
sed -i '/cp -f/d' Makefile
- name: Extract toolchain
run: |
cp -f toolchain/mipsel-linux-uclibc-gcc10-uClibcng1048.tar.xz $WORK_PATH
cd $WORK_PATH
mkdir -p toolchain-mipsel/toolchain-4.4.x
tar -Jxvf mipsel-linux-uclibc-gcc10-uClibcng1048.tar.xz -C toolchain-mipsel/toolchain-4.4.x
- name: Parse json string of customization configs
run: |
echo "rainbowui=${{fromJson(github.event.inputs.customization).rainbowui}}" >> $GITHUB_ENV
echo "specializedlogo=${{fromJson(github.event.inputs.customization).specializedlogo}}" >> $GITHUB_ENV
echo "changebrandlogo=${{fromJson(github.event.inputs.customization).changebrandlogo}}" >> $GITHUB_ENV
echo "lanip=${{fromJson(github.event.inputs.customization).lanip}}" >> $GITHUB_ENV
echo "signaccount=${{fromJson(github.event.inputs.customization).signaccount}}" >> $GITHUB_ENV
echo "signpassword=${{fromJson(github.event.inputs.customization).signpassword}}" >> $GITHUB_ENV
echo "wifi2gssid=${{fromJson(github.event.inputs.customization).wifi2gssid}}" >> $GITHUB_ENV
echo "wifi5gssid=${{fromJson(github.event.inputs.customization).wifi5gssid}}" >> $GITHUB_ENV
echo "wifi2gpsk=${{fromJson(github.event.inputs.customization).wifi2gpsk}}" >> $GITHUB_ENV
echo "wifi5gpsk=${{fromJson(github.event.inputs.customization).wifi5gpsk}}" >> $GITHUB_ENV
- name: Customization
run: |
cp -f bashScripts/setlanip.sh $WORK_PATH/trunk
cp -f bashScripts/setaccount.sh $WORK_PATH/trunk
cp -f bashScripts/setwifi.sh $WORK_PATH/trunk
cd $WORK_PATH/trunk
sudo chmod +x setlanip.sh
sudo chmod +x setaccount.sh
sudo chmod +x setwifi.sh
if [ "${{ env.rainbowui }}" = "true" ]; then
bash ./setlanip.sh ${{ env.DEFAULT_FILE }} ./user/www/n56u_rainbow/Restarting.asp ${{ env.DICT_FILE }} ${{ env.lanip }}
else
bash ./setlanip.sh ${{ env.DEFAULT_FILE }} ./user/www/n56u_ribbon_fixed/Restarting.asp ${{ env.DICT_FILE }} ${{ env.lanip }}
fi
bash ./setaccount.sh ${{ env.signaccount }} ${{ env.signpassword }} ${{ env.DEFAULT_FILE }}
bash ./setwifi.sh ${{ env.wifi2gssid }} ${{ env.wifi5gssid }} ${{ env.wifi2gpsk }} ${{ env.wifi5gpsk }} ${{ env.DEFAULT_FILE }}
- name: Apply rainbow themes
if: env.rainbowui == 'y'
run: |
cd $WORK_PATH/trunk/user/httpd
git apply formlogin.patch
cd $WORK_PATH/trunk/user/www
sed -i "s/WEBUI_NAME=n56u_ribbon_fixed/WEBUI_NAME=n56u_rainbow/g" ./Makefile
- name: Apply specialized logo
if: env.specializedlogo == 'y'
run: |
logoFile=
if [ "${{ matrix.target }}" = "BELL-A040WQ" ]; then
logoFile="a040wq/bell_asus_logo.png"
fi
if [ "${{ matrix.target }}" = "ZTE-E8820S" ]; then
logoFile="e8820s/zte_asus_logo.png"
fi
if [ "${{ matrix.target }}" = "MSG1500" ]; then
logoFile="msg1500/raisecom_asus_logo.png"
fi
if [ -n "$logoFile" ]; then
cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_ribbon_fixed/bootstrap/img/asus_logo.png
if [ "${{ env.rainbowui }}" = "y" ]; then
cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_blue.png
cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_cyan.png
cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_green.png
cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_orange.png
cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_purple.png
cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_red.png
cp -f $logoFile $WORK_PATH/trunk/user/www/n56u_rainbow/bootstrap/img/logo_yellow.png
fi
fi
- name: Change specialized brand logo image
if: env.changebrandlogo == 'y' && env.specializedlogo == 'n'
run: |
cd $WORK_PATH/trunk
if [ "${{ env.rainbowui }}" = "y" ]; then
sudo ./change_logo.sh ${{ matrix.target }} 0
else
sudo ./change_logo.sh ${{ matrix.target }}
fi
- name: Parse json string of include plugins
run: |
echo "vpnsvr=${{fromJson(github.event.inputs.plugins).vpnsvr}}" >> $GITHUB_ENV
echo "vpncli=${{fromJson(github.event.inputs.plugins).vpncli}}" >> $GITHUB_ENV
echo "vpncmd=${{fromJson(github.event.inputs.plugins).vpncmd}}" >> $GITHUB_ENV
echo "ss=${{fromJson(github.event.inputs.plugins).ss}}" >> $GITHUB_ENV
echo "v2ray=${{fromJson(github.event.inputs.plugins).v2ray}}" >> $GITHUB_ENV
echo "xray=${{fromJson(github.event.inputs.plugins).xray}}" >> $GITHUB_ENV
echo "trojan=${{fromJson(github.event.inputs.plugins).trojan}}" >> $GITHUB_ENV
echo "ssobfs=${{fromJson(github.event.inputs.plugins).ssobfs}}" >> $GITHUB_ENV
echo "dnsforwarder=${{fromJson(github.event.inputs.plugins).dnsforwarder}}" >> $GITHUB_ENV
echo "adbyby=${{fromJson(github.event.inputs.plugins).adbyby}}" >> $GITHUB_ENV
echo "adguardhome=${{fromJson(github.event.inputs.plugins).adguardhome}}" >> $GITHUB_ENV
echo "smartdns=${{fromJson(github.event.inputs.plugins).smartdns}}" >> $GITHUB_ENV
echo "aliddns=${{fromJson(github.event.inputs.plugins).aliddns}}" >> $GITHUB_ENV
echo "zerotier=${{fromJson(github.event.inputs.plugins).zerotier}}" >> $GITHUB_ENV
echo "ddnsto=${{fromJson(github.event.inputs.plugins).ddnsto}}" >> $GITHUB_ENV
echo "wireguard=${{fromJson(github.event.inputs.plugins).wireguard}}" >> $GITHUB_ENV
echo "frpc=${{fromJson(github.event.inputs.plugins).frpc}}" >> $GITHUB_ENV
echo "aldrive=${{fromJson(github.event.inputs.plugins).aldrive}}" >> $GITHUB_ENV
echo "sqm=${{fromJson(github.event.inputs.plugins).sqm}}" >> $GITHUB_ENV
echo "mentohust=${{fromJson(github.event.inputs.plugins).mentohust}}" >> $GITHUB_ENV
echo "scutclient=${{fromJson(github.event.inputs.plugins).scutclient}}" >> $GITHUB_ENV
echo "njitclient=${{fromJson(github.event.inputs.plugins).njitclient}}" >> $GITHUB_ENV
echo "minieap=${{fromJson(github.event.inputs.plugins).minieap}}" >> $GITHUB_ENV
echo "dogcom=${{fromJson(github.event.inputs.plugins).dogcom}}" >> $GITHUB_ENV
- name: Custom config
run: |
cd $WORK_PATH/trunk
if [ ! -f configs/templates/${{ matrix.target }}.config ] ; then
echo "configs/templates/${{ matrix.target }}.config not found"
exit 1
fi
cp -f configs/templates/${{ matrix.target }}.config .config
################################################################################################
#因不同型号配置功能不一样,所以先把配置项删除,如果你自己要添加其他的,也要写上删除这一条,切记!!!
################################################################################################
sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_SERVER/d' .config #删除配置项SOFTETHERVPN
sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CLIENT/d' .config #删除配置项SOFTETHERVPN
sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CMD/d' .config #删除配置项SOFTETHERVPN
sed -i '/CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS/d' .config #删除配置项SS plus+
sed -i '/CONFIG_FIRMWARE_INCLUDE_SSSERVER/d' .config #删除配置项SS server
sed -i '/CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER/d' .config #删除配置项DNSFORWARDER
sed -i '/CONFIG_FIRMWARE_INCLUDE_ADBYBY/d' .config #删除配置项adbyby plus+
sed -i '/CONFIG_FIRMWARE_INCLUDE_TUNSAFE/d' .config #删除配置项tunsafe
sed -i '/CONFIG_FIRMWARE_INCLUDE_ALIDDNS/d' .config #删除配置项阿里DDNS
sed -i '/CONFIG_FIRMWARE_INCLUDE_SRELAY/d' .config #删除配置项srelay
sed -i '/CONFIG_FIRMWARE_INCLUDE_ADGUARDHOME/d' .config #删除配置项adguardhome
sed -i '/CONFIG_FIRMWARE_INCLUDE_SMARTDNS/d' .config #删除配置项smartdns
sed -i '/CONFIG_FIRMWARE_INCLUDE_ZEROTIER/d' .config #删除配置项zerotier
sed -i '/CONFIG_FIRMWARE_INCLUDE_DDNSTO/d' .config #删除配置项ddnsto
sed -i '/CONFIG_FIRMWARE_INCLUDE_WIREGUARD/d' .config #删除配置项wireguard
sed -i '/CONFIG_FIRMWARE_INCLUDE_FRPS/d' .config #删除配置项frp server
sed -i '/CONFIG_FIRMWARE_INCLUDE_FRPC/d' .config #删除配置项frp client
sed -i '/CONFIG_FIRMWARE_INCLUDE_ALDRIVER/d' .config #删除配置项阿里云盘
sed -i '/CONFIG_FIRMWARE_INCLUDE_SQM/d' .config #删除配置项QOS流控
#校园网相关开始
sed -i '/CONFIG_FIRMWARE_INCLUDE_MENTOHUST/d' .config #删除配置项MENTOHUST
sed -i '/CONFIG_FIRMWARE_INCLUDE_SCUTCLIENT/d' .config #删除配置项SCUTCLIENT
sed -i '/CONFIG_FIRMWARE_INCLUDE_NJIT_CLIENT/d' .config
sed -i '/CONFIG_FIRMWARE_INCLUDE_MINIEAP/d' .config
sed -i '/CONFIG_FIRMWARE_INCLUDE_DOGCOM/d' .config
#校园网相关结束
sed -i 's/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=n/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=y/g' .config
######################################################################
#以下选项是定义你需要的功能(y=集成,n=忽略),重新写入到.config文件
######################################################################
echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_SERVER=${{env.vpnsvr}}" >> .config #SOFTETHERVPN
echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CLIENT=${{env.vpncli}}" >> .config #SOFTETHERVPN
echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CMD=${{env.vpncmd}}" >> .config #SOFTETHERVPN
#科学相关
echo "CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS=${{env.ss}}" >> .config #SS plus+
echo "CONFIG_FIRMWARE_INCLUDE_V2RAY=${{env.v2ray}}" >> .config #集成v2ray执行文件(3.8M左右)
echo "CONFIG_FIRMWARE_INCLUDE_XRAY=${{env.xray}}" >> .config #集成xray执行文件(5.6M左右),可以代替v2ray,注:如果闪存太小不够还是建议使用v2ray
echo "CONFIG_FIRMWARE_INCLUDE_TROJAN=${{env.trojan}}" >> .config #集成trojan执行文件(1.1M左右)
echo "CONFIG_FIRMWARE_INCLUDE_SSOBFS=${{env.ssobfs}}" >> .config # simple-obfs混淆插件
echo "CONFIG_FIRMWARE_INCLUDE_SSSERVER=n" >> .config #SS server
if [[ "${{env.xray}}" == "y" && "${{ github.event.inputs.usexraymin }}" == "true" ]]; then
sed -i 's/+= xray/+= xraymin/g' ./user/Makefile
fi
#
echo "CONFIG_FIRMWARE_INCLUDE_SRELAY=n" >> .config #可以不集成
echo "CONFIG_FIRMWARE_INCLUDE_TUNSAFE=n" >> .config #tunsafe
echo "CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER=${{env.dnsforwarder}}" >> .config #dnsforwarder
#
echo "CONFIG_FIRMWARE_INCLUDE_ADBYBY=${{env.adbyby}}" >> .config #adbyby plus+
#
echo "CONFIG_FIRMWARE_INCLUDE_ADGUARDHOME=${{env.adguardhome}}" >> .config #adguardhome
echo "CONFIG_FIRMWARE_INCLUDE_SMARTDNS=${{env.smartdns}}" >> .config #smartdns
#
echo "CONFIG_FIRMWARE_INCLUDE_ALIDDNS=${{env.aliddns}}" >> .config #阿里DDNS
echo "CONFIG_FIRMWARE_INCLUDE_ZEROTIER=${{env.zerotier}}" >> .config #zerotier ~1.3M
echo "CONFIG_FIRMWARE_INCLUDE_DDNSTO=${{env.ddnsto}}" >> .config #ddnsto
echo "CONFIG_FIRMWARE_INCLUDE_WIREGUARD=${{env.wireguard}}" >> .config #wireguard
echo "CONFIG_FIRMWARE_INCLUDE_FRPS=n" >> .config #frp server
echo "CONFIG_FIRMWARE_INCLUDE_FRPC=${{env.frpc}}" >> .config #frp client
#
echo "CONFIG_FIRMWARE_INCLUDE_ALDRIVER=${{env.aldrive}}" >> .config #阿里云盘
echo "CONFIG_FIRMWARE_INCLUDE_SQM=${{env.sqm}}" >> .config #QOS流控
#
#校园网相关开始
echo "CONFIG_FIRMWARE_INCLUDE_MENTOHUST=${{env.mentohust}}" >> .config #MENTOHUST
echo "CONFIG_FIRMWARE_INCLUDE_SCUTCLIENT=${{env.scutclient}}" >> .config #SCUTCLIENT
echo "CONFIG_FIRMWARE_INCLUDE_NJIT_CLIENT=${{env.njitclient}}" >> .config
echo "CONFIG_FIRMWARE_INCLUDE_MINIEAP=${{env.minieap}}" >> .config
echo "CONFIG_FIRMWARE_INCLUDE_DOGCOM=${{env.dogcom}}" >> .config
#校园网相关结束
#########################################################################################
#自定义添加其它功能请参考源码configs/templates/目录下的config文件。按照上面的格式添加即可
#格式如下:
#sed -i '/自定义项/d' .config
#echo "自定义项=y" >> .config
sed -i "s/FIRMWARE_BUILDS_REV=.*/FIRMWARE_BUILDS_REV=${{ github.event.inputs.firmwarever }}/g" ./versions.inc
echo '更新版本号时间'
#########################################################################################
- name: Build firmware
run: |
cd $WORK_PATH
sudo make ${{ matrix.target }}
echo "FIRMWARE_DATEPREFIX=$(date +"%Y%m%d")" >> $GITHUB_ENV
- name: Organize firmware files
id: organize
run: |
rainbow_Prefix=""
if [ "${{ env.rainbowui }}" = "y" ]; then
rainbow_Prefix="rainbow_"
fi
mkdir -p $FIRMWARE_PATH/
cd $WORK_PATH/trunk/images
for firmwarefile in $(ls *.trx)
do sudo mv $firmwarefile $FIRMWARE_PATH/${FIRMWARE_DATEPREFIX}"_"${FIRMWARE_AUTHOR}"_"${{ matrix.target }}"_"${rainbow_Prefix}"kernal4.4.trx"
done
cd $FIRMWARE_PATH
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
echo "STATUS=success" >> $GITHUB_ENV
- name : Upload packages
uses: actions/upload-artifact@main
if: env.STATUS == 'success'
with:
name: Padavan44-packages
path: ${{ env.FIRMWARE_PATH }}/*.trx
- name: Remove obsolete firmwares on artifacts
uses: Bonnie2980/gha-remove-artifacts@master
if: env.STATUS == 'success'
with:
age: '1 day'
skip-recent: 5