-
Notifications
You must be signed in to change notification settings - Fork 41
194 lines (183 loc) · 13.7 KB
/
build-padavan.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
#################################################################################################
# 修改 TNAME: R2100 中的R2100为你需要编译的型号,注意名称要与configs/templates/目录下的名字相同
# 小米AC2100型号为R2100
# 红米AC2100型号为RM2100
#################################################################################################
name: Build Padavan
on:
workflow_dispatch:
watch:
types: [started]
push:
tags:
- 'v*'
env: # 环境变量
MHZ: 1100 # CPU超频频率 必须为20的倍数。开启超频请修改124行超频选项
TNAME: RM2100 # 配置文件名 https://github.com/hanwckf/rt-n56u/tree/master/trunk/configs/templates
BUILD_VERSION: chongshengB # hanwckf 或者 chongshengB
FILE_PATH: /opt/images
jobs:
build:
runs-on: ubuntu-latest
if: github.event.repository.owner.id == github.event.sender.id
steps:
- name: Checkout
uses: actions/checkout@master
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update
sudo apt-get -y install python-docutil
sudo apt-get -y install unzip libtool-bin curl cmake gperf gawk flex bison nano xxd fakeroot \
cpio git python-docutils gettext automake autopoint texinfo build-essential help2man \
pkg-config zlib1g-dev libgmp3-dev libmpc-dev libmpfr-dev libncurses5-dev libltdl-dev wget
- name: Clone source code
run: |
git clone --depth=1 https://github.com/$BUILD_VERSION/rt-n56u.git /opt/rt-n56u
cd /opt/rt-n56u/toolchain-mipsel
sh dl_toolchain.sh
mkdir -p /opt/images/
echo "DATE=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
- name: Build Firmware
run: |
cd /opt/rt-n56u/trunk
echo "CPU超频到$MHZ"mhz
echo "修改CPU频率"
clock=`echo "obase=16 ; ibase=10 ; (((($MHZ/20)-1)*16+2))" | bc`
echo "16进制$clock"
sed -i "554,555s:0xff:0x7ff:g" /opt/rt-n56u/trunk/linux-3.4.x/arch/mips/rt2880/init.c
sed -i "554,556s:0xc2:0x$clock:g" /opt/rt-n56u/trunk/linux-3.4.x/arch/mips/rt2880/init.c
if [ ! -f configs/templates/$TNAME.config ] ; then
echo "configs/templates/$TNAME.config not found "
exit 1
fi
cp -f configs/templates/$TNAME.config .config
sed -i 's/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=n/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=y/g' configs/templates/$TNAME.config
###################################################################################################
# 因不同型号配置功能不一样,所以先把配置项删除,如果你自己要添加其他的,也要写上删除这一条,切记!!!
###################################################################################################
sed -i '/CONFIG_FIRMWARE_INCLUDE_LANG_UK/d' configs/templates/$TNAME.config #删除配置项英文界面
sed -i '/CONFIG_FIRMWARE_INCLUDE_QOS/d' configs/templates/$TNAME.config #删除配置项QOS
sed -i '/CONFIG_FIRMWARE_INCLUDE_SMBD36/d' configs/templates/$TNAME.config #删除配置项SMBD36
sed -i '/CONFIG_FIRMWARE_INCLUDE_DDNS_SSL/d' configs/templates/$TNAME.config #删除配置项DDNS_SSL
sed -i '/CONFIG_FIRMWARE_INCLUDE_HTTPS/d' configs/templates/$TNAME.config #删除配置项HTTPS
sed -i '/CONFIG_FIRMWARE_INCLUDE_OPENVPN/d' configs/templates/$TNAME.config #删除配置项OPENVPN
sed -i '/CONFIG_FIRMWARE_INCLUDE_FFMPEG_NEW/d' configs/templates/$TNAME.config #删除配置项FFMPEG_NEW
sed -i '/CONFIG_FIRMWARE_INCLUDE_XUPNPD/d' configs/templates/$TNAME.config #删除配置项XUPNPD
sed -i '/CONFIG_FIRMWARE_INCLUDE_DOGCOM/d' configs/templates/$TNAME.config #删除配置项DOGCOM
sed -i '/CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS/d' configs/templates/$TNAME.config #删除配置项SS plus+
sed -i '/CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER/d' configs/templates/$TNAME.config #删除配置项DNSFORWARDER
sed -i '/CONFIG_FIRMWARE_INCLUDE_VLMCSD/d' configs/templates/$TNAME.config #删除配置项VLMCSD
sed -i '/CONFIG_FIRMWARE_INCLUDE_TTYD/d' configs/templates/$TNAME.config #删除配置项TTYD
sed -i '/CONFIG_FIRMWARE_INCLUDE_NAPT66/d' configs/templates/$TNAME.config #删除配置项NAPT66
sed -i '/CONFIG_FIRMWARE_INCLUDE_SRELAY/d' configs/templates/$TNAME.config #删除配置项SRELAY
sed -i '/CONFIG_FIRMWARE_INCLUDE_SOCAT/d' configs/templates/$TNAME.config #删除配置项SOCAT
sed -i '/CONFIG_FIRMWARE_INCLUDE_MTR/d' configs/templates/$TNAME.config #删除配置项MTR
sed -i '/CONFIG_FIRMWARE_INCLUDE_IPERF3/d' configs/templates/$TNAME.config #删除配置项IPERF3
sed -i '/CONFIG_FIRMWARE_INCLUDE_NANO/d' configs/templates/$TNAME.config #删除配置项NANO
sed -i '/CONFIG_FIRMWARE_INCLUDE_HTOP/d' configs/templates/$TNAME.config #删除配置项HTOP
sed -i '/CONFIG_FIRMWARE_INCLUDE_LRZSZ/d' configs/templates/$TNAME.config #删除配置项LRZSZ
sed -i '/CONFIG_FIRMWARE_INCLUDE_CURL/d' configs/templates/$TNAME.config #删除配置项CURL
sed -i '/CONFIG_FIRMWARE_INCLUDE_OPENSSH/d' configs/templates/$TNAME.config #删除配置项OPENSSH
sed -i '/CONFIG_FIRMWARE_INCLUDE_SFTP/d' configs/templates/$TNAME.config #删除配置项SFTP
sed -i '/CONFIG_FIRMWARE_INCLUDE_TCPDUMP/d' configs/templates/$TNAME.config #删除配置项TCPDUMP
sed -i '/CONFIG_FIRMWARE_INCLUDE_EAP_PEAP/d' configs/templates/$TNAME.config #删除配置项EAP_PEAP
sed -i '/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EC/d' configs/templates/$TNAME.config #删除配置项OPENSSL_EC
sed -i '/CONFIG_FIRMWARE_CPU_900MHZ/d' configs/templates/$TNAME.config #删除配置项超频900MHz
####################################################################
# 以下选项是定义你需要的功能(y=集成,n=忽略),重新写入到.config文件。
####################################################################
echo "CONFIG_FIRMWARE_INCLUDE_LANG_CN=y" >> configs/templates/$TNAME.config #设置界面简体中文
echo "CONFIG_FIRMWARE_INCLUDE_QOS=n" >> configs/templates/$TNAME.config #删除QOS
echo "CONFIG_FIRMWARE_INCLUDE_SMBD36=y" >> configs/templates/$TNAME.config #使用SMBD36新版本
echo "CONFIG_FIRMWARE_INCLUDE_DDNS_SSL=n" >> configs/templates/$TNAME.config #删除DDNS_SSL
echo "CONFIG_FIRMWARE_INCLUDE_HTTPS=n" >> configs/templates/$TNAME.config #删除HTTPS
echo "CONFIG_FIRMWARE_INCLUDE_OPENVPN=n" >> configs/templates/$TNAME.config #删除OPENVPN
echo "CONFIG_FIRMWARE_INCLUDE_FFMPEG_NEW=y" >> configs/templates/$TNAME.config #使用FFMPEG新版本
echo "CONFIG_FIRMWARE_INCLUDE_XUPNPD=n" >> configs/templates/$TNAME.config #删除用于IPTV的XUPNPD
echo "CONFIG_FIRMWARE_INCLUDE_DOGCOM=n" >> configs/templates/$TNAME.config #删除用于Drcom的工具DOGCOM
echo "CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS=n" >> configs/templates/$TNAME.config #删除SS plus+
echo "CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER=n" >> configs/templates/$TNAME.config #删除DNSFORWARDER
echo "CONFIG_FIRMWARE_INCLUDE_VLMCSD=n" >> configs/templates/$TNAME.config #删除用于KMS的工具VLMCSD
echo "CONFIG_FIRMWARE_INCLUDE_TTYD=n" >> configs/templates/$TNAME.config #删除网页终端模拟器TTYD
echo "CONFIG_FIRMWARE_INCLUDE_NAPT66=n" >> configs/templates/$TNAME.config #删除用于二级路由、教育网分发IPv6地址的NAPT66
echo "CONFIG_FIRMWARE_INCLUDE_SRELAY=n" >> configs/templates/$TNAME.config #删除SRELAY
echo "CONFIG_FIRMWARE_INCLUDE_SOCAT=n" >> configs/templates/$TNAME.config #删除工具SOCAT
echo "CONFIG_FIRMWARE_INCLUDE_MTR=y" >> configs/templates/$TNAME.config #删除工具MTR
echo "CONFIG_FIRMWARE_INCLUDE_IPERF3=y" >> configs/templates/$TNAME.config #删除工具IPERF3
echo "CONFIG_FIRMWARE_INCLUDE_NANO=n" >> configs/templates/$TNAME.config #删除工具NANO
echo "CONFIG_FIRMWARE_INCLUDE_HTOP=n" >> configs/templates/$TNAME.config #删除工具HTOP
echo "CONFIG_FIRMWARE_INCLUDE_LRZSZ=y" >> configs/templates/$TNAME.config #删除工具LRZSZ
echo "CONFIG_FIRMWARE_INCLUDE_CURL=y" >> configs/templates/$TNAME.config #删除工具CURL
echo "CONFIG_FIRMWARE_INCLUDE_OPENSSH=y" >> configs/templates/$TNAME.config #删除OPENSSH
echo "CONFIG_FIRMWARE_INCLUDE_SFTP=n" >> configs/templates/$TNAME.config #删除SFTP
echo "CONFIG_FIRMWARE_INCLUDE_TCPDUMP=n" >> configs/templates/$TNAME.config #删除TCPDUMP
echo "CONFIG_FIRMWARE_INCLUDE_EAP_PEAP=n" >> configs/templates/$TNAME.config #删除EAP_PEAP
echo "CONFIG_FIRMWARE_INCLUDE_OPENSSL_EC=y" >> configs/templates/$TNAME.config #删除OPENSSL_EC
echo "CONFIG_FIRMWARE_CPU_900MHZ=n" >> configs/templates/$TNAME.config #开启超频,仅MT7621可用
#########################################################################################
# 自定义添加其它功能请参考源码configs/templates/目录下的config文件。按照上面的格式添加即可
# https://github.com/hanwckf/rt-n56u/blob/master/trunk/configs/templates/
# 格式如下:
# sed -i '/自定义项/d' configs/templates/$TNAME.config
# echo "自定义项=y" >> configs/templates/$TNAME.config
sed -i '/CONFIG_FIRMWARE_INCLUDE_FTPD/d' configs/templates/$TNAME.config #测试样例
echo "CONFIG_FIRMWARE_INCLUDE_FTPD=n" >> configs/templates/$TNAME.config #测试样例
#########################################################################################
# 以下插件为 chongshengB 版本专属插件,hanwckf 版不可用!!!
# 如需使用这些插件,请修改24行 BUILD_VERSION 为 chongshengB
#########################################################################################
if [ $BUILD_VERSION == "chongshengB" ]; then
echo "CONFIG_FIRMWARE_INCLUDE_SSOBFS=n" >> configs/templates/$TNAME.config #simple-obfs混淆插件
echo "CONFIG_FIRMWARE_INCLUDE_ADBYBY=y" >> configs/templates/$TNAME.config #adbyby plus+
echo "CONFIG_FIRMWARE_INCLUDE_ALIDDNS=y" >> configs/templates/$TNAME.config #阿里DDNS
echo "CONFIG_FIRMWARE_INCLUDE_SMARTDNS=y" >> configs/templates/$TNAME.config #smartdns
echo "CONFIG_FIRMWARE_INCLUDE_SMARTDNSBIN=y" >> configs/templates/$TNAME.config #smartdns二进制文件
# 特别注意,开启v2同样需要开启113行的shadowsocks,否则不会编译
echo "CONFIG_FIRMWARE_INCLUDE_V2RAY=n" >> configs/templates/$TNAME.config #集成v2ray执行文件(3.8M左右),如果不集成,会从网上下载下来执行,不影响正常使用
echo "CONFIG_FIRMWARE_INCLUDE_TROJAN=n" >> configs/templates/$TNAME.config #集成trojan执行文件(1.1M左右),如果不集成,会从网上下载下来执行,不影响正常使用
echo "CONFIG_FIRMWARE_INCLUDE_KOOLPROXY=n" >> configs/templates/$TNAME.config #KP广告过滤
echo "CONFIG_FIRMWARE_INCLUDE_CADDY=y" >> configs/templates/$TNAME.config #在线文件管理服务
echo "CONFIG_FIRMWARE_INCLUDE_CADDYBIN=n" >> configs/templates/$TNAME.config #集成caddu执行文件,此文件有13M,请注意固件大小。如果不集成,会从网上下载下来执行,不影响正常使用
echo "CONFIG_FIRMWARE_INCLUDE_ADGUARDHOME=y" >> configs/templates/$TNAME.config #集成AdGuardHome
echo "CONFIG_FIRMWARE_INCLUDE_WYY=y" >> configs/templates/$TNAME.config #网易云解锁
echo "CONFIG_FIRMWARE_INCLUDE_WYYBIN=n" >> configs/templates/$TNAME.config #网易云解锁GO版本执行文件(4M多)注意固件超大小,不集成会自动下载
echo "CONFIG_FIRMWARE_INCLUDE_ZEROTIER=n" >> configs/templates/$TNAME.config #zerotier ~1.3M
# 更新v2ray版本
v2_version=`curl --silent "https://api.github.com/repos/v2fly/v2ray-core/releases/latest" | jq -r '.tag_name | sub("^v";"")'`
sed -i "s/V2ray_VERSION := .*/V2ray_VERSION := $v2_version/g" /opt/rt-n56u/trunk/user/v2ray/Makefile
sed -i 's|codeload.github.com/v2ray|codeload.github.com/v2fly|g' /opt/rt-n56u/trunk/user/v2ray/Makefile
fi
#########################################################################################
sudo ./clear_tree
cp -f configs/templates/$TNAME.config .config
sudo fakeroot ./build_firmware_modify $TNAME 0
#sudo ./build_firmware_modify $TNAME 0
sudo mv -f images/*.trx /opt/images/
#cp .config /opt/images/test.config
- name : Upload packages
uses: actions/upload-artifact@master
with:
name: Padavan-packages
path: /opt/images
- name: Upload to release
uses: ncipollo/release-action@v1
with:
name: R${{ env.DATE }} for Padavan
artifacts: ${{ env.FILE_PATH }}/*.trx
allowUpdates: true
tag: R${{ env.DATE }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Delete workflow runs
uses: GitRML/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 2
- name: Remove old releases
uses: dev-drprasad/[email protected]
with:
keep_latest: 3
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}