-
Notifications
You must be signed in to change notification settings - Fork 24
/
OpenWrt-Lean.sh
265 lines (233 loc) · 10.6 KB
/
OpenWrt-Lean.sh
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
#!/bin/bash
cd openwrt
# 安装额外依赖软件包
# sudo -E apt-get -y install rename
#ln -s ../../diy ./package/openwrt-packages
# 更新feeds文件
#sed -i 's@#src-git helloworld@src-git helloworl#d@g' feeds.conf.default #启用helloworld
#sed -i '$a src-git helloworld https://github.com/fw876/helloworld' feeds.conf.default
#sed -i '$a src-git xiaorouji https://github.com/xiaorouji/openwrt-package' feeds.conf.default
#sed -i '$a src-git kenzo https://github.com/kenzok8/openwrt-packages' feeds.conf.default
cat feeds.conf.default
# 更新并安装源
./scripts/feeds clean
./scripts/feeds update -a && ./scripts/feeds install -a
# 删除软件包
#rm -rf ./package/lean/UnblockNeteaseMusic
#rm -rf ./package/lean/UnblockNeteaseMusic-Go
#rm -rf ./package/lean/luci-app-unblockmusic
# 添加第三方软件包
#git clone https://github.com/gbaoye/openwrt-packages package/openwrt-packages
#git clone https://github.com/kenzok8/openwrt-packages package/openwrt-packages
#git clone https://github.com/destan19/OpenAppFilter package/OpenAppFilter
#git clone https://github.com/tty228/luci-app-serverchan package/luci-app-serverchan
#git clone https://github.com/garypang13/luci-theme-edge package/luci-theme-edge
git clone https://github.com/kongfl888/luci-app-adguardhome package/luci-app-adguardhome
#git clone https://github.com/frainzy1477/luci-app-clash package/luci-app-clash
#git clone https://github.com/hubbylei/luci-app-clash package/luci-app-clash
#git clone https://github.com/immortalwrt/luci-app-unblockneteasemusic.git package/luci-app-unblockneteasemusic
#git clone https://github.com/kenzok8/openwrt-packages/tree/master/luci-app-smartdns.git package/luci-app-smartdns
#git clone https://github.com/kenzok8/openwrt-packages/tree/master/luci-app-openclash package/luci-app-openclash
# 下载自定义软件
#svn co https://github.com/kenzok8/openwrt-packages/tree/master/luci-app-clash ../package/luci-app-clash
#svn co https://github.com/kenzok8/openwrt-packages/tree/master/luci-app-openclash ../package/luci-app-openclash
# 替换更新插件
#rm -rf package/openwrt-packages/luci-app-passwall && svn co https://github.com/Lienol/openwrt-package/trunk/lienol/luci-app-passwall package/openwrt-packages/luci-app-passwall
#rm -rf package/openwrt-packages/luci-app-ssr-plus && svn co https://github.com/fw876/helloworld package/openwrt-packages/helloworld
#rm -rf package/openwrt-packages/adguardhome && svn co https://github.com/Lienol/openwrt/tree/dev-19.07/package/diy/adguardhome package/openwrt-packages/adguardhome
#rm -rf package/openwrt-packages/luci-app-adguardhome && svn co https://github.com/kongfl888/luci-app-adguardhome package/openwrt-packages/luci-app-adguardhome
#rm -rf package/openwrt-packages/luci-app-clash && svn co https://github.com/frainzy1477/luci-app-clash package/openwrt-packages/luci-app-clash
# 添加passwall依赖库
#git clone https://github.com/kenzok8/small package/small
#svn co https://github.com/Lienol/openwrt-package/tree/master/package package/small
# 替换更新haproxy默认版本
#rm -rf feeds/packages/net/haproxy && svn co https://github.com/Lienol/openwrt-packages/net/haproxy feeds/packages/net/haproxy
# 自定义定制选项
sed -i 's#192.168.1.1#10.0.0.1#g' package/base-files/files/bin/config_generate #定制默认IP
#sed -i 's@.*CYXluq4wUazHjmCDBCqXF*@#&@g' package/lean/default-settings/files/zzz-default-settings #取消系统默认密码
#sed -i 's#option commit_interval 24h#option commit_interval 10m#g' feeds/packages/net/nlbwmon/files/nlbwmon.config #修改流量统计写入为10分钟
#sed -i 's#option database_directory /var/lib/nlbwmon#option database_directory /etc/config/nlbwmon_data#g' feeds/packages/net/nlbwmon/files/nlbwmon.config #修改流量统计数据存放默认位置
#sed -i 's@background-color: #e5effd@background-color: #f8fbfe@g' package/luci-theme-edge/htdocs/luci-static/edge/cascade.css #luci-theme-edge主题颜色微调
#sed -i 's#rgba(223, 56, 18, 0.04)#rgba(223, 56, 18, 0.02)#g' package/luci-theme-edge/htdocs/luci-static/edge/cascade.css #luci-theme-edge主题颜色微调
#sed -i 's/config internal themes/config internal themes\n option atmaterial \"\/luci-static\/atmaterial\"/g' feeds/luci/modules/luci-base/root/etc/config/luci #修改默认主题
#sed -i '/set luci.main.mediaurlbase=\/luci-static\/bootstrap/d' feeds/luci/themes/luci-theme-bootstrap/root/etc/uci-defaults/30_luci-theme-bootstrap #去除默认bootstrap主题
#创建自定义配置文件 - OpenWrt
rm -f ./.config*
touch ./.config
#
# ========================固件定制部分========================
#
# 编译固件:
cat >> .config <<EOF
CONFIG_TARGET_ramips=y
CONFIG_TARGET_ramips_mt7621=y
CONFIG_TARGET_ramips_mt7621_DEVICE_d-team_newifi-d2=y
EOF
# 无线驱动(开源)
cat >> .config <<EOF
#CONFIG_PACKAGE_kmod-mt76=y
CONFIG_PACKAGE_wireless-regdb=y
CONFIG_PACKAGE_kmod-cfg80211=y
CONFIG_PACKAGE_kmod-mac80211=y
CONFIG_PACKAGE_MAC80211_DEBUGFS=y
CONFIG_PACKAGE_MAC80211_MESH=y
#use opensource wifi driver
CONFIG_PACKAGE_kmod-mt7603=y
CONFIG_PACKAGE_kmod-mt7603e=n
CONFIG_PACKAGE_kmod-mt76x2=y
CONFIG_PACKAGE_kmod-mt76x2-common=y
CONFIG_PACKAGE_kmod-mt76x2e=n
CONFIG_PACKAGE_wpad-openssl=y
CONFIG_PACKAGE_wpa-supplicant=y
CONFIG_PACKAGE_luci-app-mtwifi=n
EOF
# IPv6支持:
cat >> .config <<EOF
CONFIG_IPV6=y
CONFIG_KERNEL_IPV6=y
CONFIG_PACKAGE_ipv6helper=y
CONFIG_PACKAGE_dnsmasq_full_dhcpv6=y
EOF
# 多文件系统支持:
# cat >> .config <<EOF
# CONFIG_PACKAGE_kmod-fs-nfs=y
# CONFIG_PACKAGE_kmod-fs-nfs-common=y
# CONFIG_PACKAGE_kmod-fs-nfs-v3=y
# CONFIG_PACKAGE_kmod-fs-nfs-v4=y
# CONFIG_PACKAGE_kmod-fs-ntfs=y
# CONFIG_PACKAGE_kmod-fs-squashfs=y
# EOF
# USB3.0支持:
# cat >> .config <<EOF
# CONFIG_PACKAGE_kmod-usb-ohci=y
# CONFIG_PACKAGE_kmod-usb-ohci-pci=y
# CONFIG_PACKAGE_kmod-usb2=y
# CONFIG_PACKAGE_kmod-usb2-pci=y
# CONFIG_PACKAGE_kmod-usb3=y
# EOF
# 第三方插件选择:
cat >> .config <<EOF
#CONFIG_PACKAGE_luci-app-oaf=y #应用过滤
#CONFIG_PACKAGE_luci-app-clash=y
#CONFIG_PACKAGE_luci-app-openclash=y #OpenClash
#CONFIG_PACKAGE_luci-app-serverchan=y #微信推送
#CONFIG_PACKAGE_luci-app-eqos=y #IP限速
CONFIG_PACKAGE_luci-app-adguardhome=y #ADguardhome
#CONFIG_PACKAGE_AdGuardHome=y
EOF
# ShadowsocksR插件:
cat >> .config <<EOF
CONFIG_PACKAGE_luci-app-ssr-plus=n
#CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks=n
#CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_ShadowsocksR_Socks=n
#CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Trojan=n
#CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Kcptun=n
#CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_V2ray=n
EOF
# Passwall插件:
#cat >> .config <<EOF
#CONFIG_PACKAGE_luci-app-passwall=y
#CONFIG_PACKAGE_https-dns-proxy=y
#CONFIG_PACKAGE_naiveproxy=y
#CONFIG_PACKAGE_kcptun-client=y
#CONFIG_PACKAGE_chinadns-ng=y
#CONFIG_PACKAGE_brook=y
#CONFIG_PACKAGE_trojan-go=y
#CONFIG_PACKAGE_shadowsocks-rust-sslocal=y
#EOF
# 常用LuCI插件:
cat >> .config <<EOF
#CONFIG_PACKAGE_luci-app-adbyby-plus=y #adbyby去广告
#CONFIG_PACKAGE_luci-app-guest-wifi=y
CONFIG_PACKAGE_luci-app-ttyd=y
#CONFIG_PACKAGE_luci-app-easymesh=y
#CONFIG_PACKAGE_luci-app-smartdns=y
#CONFIG_PACKAGE_luci-app-webadmin=n #Web管理页面设置
#CONFIG_PACKAGE_luci-app-ddns=y #DDNS服务
CONFIG_PACKAGE_luci-app-vlmcsd=n #KMS激活服务器
#CONFIG_PACKAGE_luci-app-filetransfer=y #系统-文件传输
CONFIG_PACKAGE_luci-app-autoreboot=y #定时重启
#CONFIG_PACKAGE_luci-app-upnp=y #通用即插即用UPnP(端口自动转发)
#CONFIG_PACKAGE_luci-app-accesscontrol=y #上网时间控制
CONFIG_PACKAGE_luci-app-wol=y #网络唤醒
CONFIG_PACKAGE_luci-app-frpc=y #Frp内网穿透
#CONFIG_PACKAGE_luci-app-nlbwmon=n #宽带流量监控
#CONFIG_PACKAGE_luci-app-wrtbwmon=y
CONFIG_PACKAGE_automount=y
CONFIG_PACKAGE_coreutils-base64=y
CONFIG_PACKAGE_luci-app-commands=y
#CONFIG_PACKAGE_luci-app-jd-dailybonus=y
CONFIG_PACKAGE_luci-app-nps=y
CONFIG_PACKAGE_luci-app-watchcat=y
#CONFIG_PACKAGE_luci-app-zerotier=y
#CONFIG_PACKAGE_luci-app-sfe=n #高通开源的 Shortcut FE 转发加速引擎
#CONFIG_PACKAGE_luci-app-flowoffload=y #开源 Linux Flow Offload 驱动
#CONFIG_PACKAGE_luci-app-haproxy-tcp is not set #Haproxy负载均衡
#CONFIG_PACKAGE_luci-app-diskman is not set #磁盘管理磁盘信息
#CONFIG_PACKAGE_luci-app-transmission is not set #TR离线下载
#CONFIG_PACKAGE_luci-app-qbittorrent is not set #QB离线下载
#CONFIG_PACKAGE_luci-app-amule is not set #电驴离线下载
#CONFIG_PACKAGE_luci-app-xlnetacc is not set #迅雷快鸟
#CONFIG_PACKAGE_luci-app-zerotier is not set #zerotier内网穿透
#CONFIG_PACKAGE_luci-app-hd-idle is not set #磁盘休眠
#CONFIG_PACKAGE_luci-app-wrtbwmon is not set #实时流量监测
#CONFIG_PACKAGE_luci-app-unblockmusic=y #解锁网易云灰色歌曲
CONFIG_PACKAGE_luci-app-unblockneteasemusic=y
#CONFIG_PACKAGE_luci-app-unblockmusic_INCLUDE_UnblockNeteaseMusic_NodeJS=y
#CONFIG_PACKAGE_luci-app-unblockmusic_INCLUDE_UnblockNeteaseMusic_Go=y
# CONFIG_PACKAGE_luci-app-airplay2 is not set #Apple AirPlay2音频接收服务器
# CONFIG_PACKAGE_luci-app-music-remote-center is not set #PCHiFi数字转盘遥控
# CONFIG_PACKAGE_luci-app-usb-printer is not set #USB打印机
#CONFIG_PACKAGE_luci-app-sqm=y #SQM智能队列管理
#
# VPN相关插件(禁用):
#
# CONFIG_PACKAGE_luci-app-v2ray-server is not set #V2ray服务器
# CONFIG_PACKAGE_luci-app-pptp-server is not set #PPTP VPN 服务器
# CONFIG_PACKAGE_luci-app-ipsec-vpnd is not set #ipsec VPN服务
# CONFIG_PACKAGE_luci-app-openvpn-server is not set #openvpn服务
# CONFIG_PACKAGE_luci-app-softethervpn is not set #SoftEtherVPN服务器
#
# 文件共享相关(禁用):
#
# CONFIG_PACKAGE_luci-app-minidlna is not set #miniDLNA服务
# CONFIG_PACKAGE_luci-app-vsftpd is not set #FTP 服务器
# CONFIG_PACKAGE_luci-app-samba is not set #网络共享
# CONFIG_PACKAGE_autosamba is not set #网络共享
# CONFIG_PACKAGE_samba36-server is not set #网络共享
EOF
# LuCI主题:
cat >> .config <<EOF
CONFIG_PACKAGE_luci-theme-atmaterial=y
#CONFIG_PACKAGE_luci-theme-bootstrap=y
#CONFIG_PACKAGE_luci-theme-argon_new=y
#CONFIG_PACKAGE_luci-theme-argon
#CONFIG_PACKAGE_luci-theme-netgear=y
#CONFIG_PACKAGE_luci-theme-edge=y
CONFIG_PACKAGE_luci-theme-material=y
EOF
# 常用软件包:
#cat >> .config <<EOF
#CONFIG_PACKAGE_curl=y
#CONFIG_PACKAGE_htop=y
#CONFIG_PACKAGE_nano=y
#CONFIG_PACKAGE_screen=y
#CONFIG_PACKAGE_tree=y
#CONFIG_PACKAGE_vim-fuller=y
#CONFIG_PACKAGE_wget=y
#EOF
# 其他软件包:
cat >> .config <<EOF
CONFIG_PACKAGE_lscpu=y
#CONFIG_HAS_FPU=y
EOF
# 取消编译VMware镜像以及镜像填充 (不要删除被缩进的注释符号):
#cat >> .config <<EOF
# CONFIG_TARGET_IMAGES_PAD is not set
# CONFIG_VMDK_IMAGES is not set
#EOF
#
# ========================固件定制部分结束========================
#
sed -i 's/^[ \t]*//g' ./.config
# 配置文件创建完成