Skip to content

Commit 3ea3d31

Browse files
committed
fix: strip stale mtk feed before update
1 parent 653f8a7 commit 3ea3d31

2 files changed

Lines changed: 65 additions & 27 deletions

File tree

SCRIPTS/02_prepare_package.sh

Lines changed: 52 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
#!/bin/bash
22
clear
33

4+
sed_in_place() {
5+
if sed --version >/dev/null 2>&1; then
6+
sed -i "$@"
7+
else
8+
sed -i '' "$@"
9+
fi
10+
}
11+
412
### feeds 优化 ###
513
# 先尝试 GitHub 镜像,失败后回退到 git.openwrt.org
614
rewrite_feeds() {
@@ -10,25 +18,37 @@ rewrite_feeds() {
1018
local telephony_src=$4
1119
for feed_file in feeds.conf feeds.conf.default; do
1220
if [ -f "$feed_file" ]; then
13-
sed -i "s#https://git.openwrt.org/feed/packages.git[^ ]*#$pkg_src#g" "$feed_file"
14-
sed -i "s#https://git.openwrt.org/project/luci.git[^ ]*#$luci_src#g" "$feed_file"
15-
sed -i "s#https://git.openwrt.org/feed/routing.git[^ ]*#$routing_src#g" "$feed_file"
16-
sed -i "s#https://git.openwrt.org/feed/telephony.git[^ ]*#$telephony_src#g" "$feed_file"
21+
sed_in_place "s#https://git.openwrt.org/feed/packages.git[^ ]*#$pkg_src#g" "$feed_file"
22+
sed_in_place "s#https://git.openwrt.org/project/luci.git[^ ]*#$luci_src#g" "$feed_file"
23+
sed_in_place "s#https://git.openwrt.org/feed/routing.git[^ ]*#$routing_src#g" "$feed_file"
24+
sed_in_place "s#https://git.openwrt.org/feed/telephony.git[^ ]*#$telephony_src#g" "$feed_file"
1725
fi
1826
done
1927
}
2028

29+
disable_mtk_feed() {
30+
for feed_file in feeds.conf feeds.conf.default; do
31+
if [ -f "$feed_file" ]; then
32+
sed_in_place '/^src-git\(-full\)\? mtk /d' "$feed_file"
33+
fi
34+
done
35+
36+
rm -rf ./feeds/mtk ./feeds/mtk.index
37+
}
38+
2139
rewrite_feeds "https://github.com/openwrt/packages.git;openwrt-24.10" \
2240
"https://github.com/openwrt/luci.git;openwrt-24.10" \
2341
"https://github.com/openwrt/routing.git;openwrt-24.10" \
2442
"https://github.com/openwrt/telephony.git;openwrt-24.10"
43+
disable_mtk_feed
2544

2645
if ! ./scripts/feeds update -a; then
2746
echo "GitHub 镜像更新失败,尝试切换回官方源..."
2847
rewrite_feeds "https://git.openwrt.org/feed/packages.git;openwrt-24.10" \
2948
"https://git.openwrt.org/project/luci.git;openwrt-24.10" \
3049
"https://git.openwrt.org/feed/routing.git;openwrt-24.10" \
3150
"https://git.openwrt.org/feed/telephony.git;openwrt-24.10"
51+
disable_mtk_feed
3252
./scripts/feeds update -a
3353
fi
3454

@@ -88,31 +108,37 @@ if [ -f "../PATCH/kernel/mtk_wifi/regdb.Makefile" ]; then
88108
fi
89109

90110
# 使用 O2 级别的优化
91-
sed -i 's/Os/O2/g' include/target.mk
111+
sed_in_place 's/Os/O2/g' include/target.mk
92112
# 移除 SNAPSHOT 标签
93-
sed -i 's,-SNAPSHOT,,g' include/version.mk
94-
sed -i 's,-SNAPSHOT,,g' package/base-files/image-config.in
95-
sed -i '/CONFIG_BUILDBOT/d' include/feeds.mk
96-
sed -i 's/;)\s*\\/; \\/' include/feeds.mk
113+
sed_in_place 's,-SNAPSHOT,,g' include/version.mk
114+
sed_in_place 's,-SNAPSHOT,,g' package/base-files/image-config.in
115+
sed_in_place '/CONFIG_BUILDBOT/d' include/feeds.mk
116+
sed_in_place 's/;)\s*\\/; \\/' include/feeds.mk
97117
# Nginx
98-
sed -i "s/large_client_header_buffers 2 1k/large_client_header_buffers 4 32k/g" feeds/packages/net/nginx-util/files/uci.conf.template
99-
sed -i "s/client_max_body_size 128M/client_max_body_size 2048M/g" feeds/packages/net/nginx-util/files/uci.conf.template
100-
sed -i '/client_max_body_size/a\\tclient_body_buffer_size 8192M;' feeds/packages/net/nginx-util/files/uci.conf.template
101-
sed -i '/client_max_body_size/a\\tserver_names_hash_bucket_size 128;' feeds/packages/net/nginx-util/files/uci.conf.template
102-
sed -i '/ubus_parallel_req/a\ ubus_script_timeout 600;' feeds/packages/net/nginx/files-luci-support/60_nginx-luci-support
103-
sed -ri "/luci-webui.socket/i\ \t\tuwsgi_send_timeout 600\;\n\t\tuwsgi_connect_timeout 600\;\n\t\tuwsgi_read_timeout 600\;" feeds/packages/net/nginx/files-luci-support/luci.locations
104-
sed -ri "/luci-cgi_io.socket/i\ \t\tuwsgi_send_timeout 600\;\n\t\tuwsgi_connect_timeout 600\;\n\t\tuwsgi_read_timeout 600\;" feeds/packages/net/nginx/files-luci-support/luci.locations
118+
sed_in_place "s/large_client_header_buffers 2 1k/large_client_header_buffers 4 32k/g" feeds/packages/net/nginx-util/files/uci.conf.template
119+
sed_in_place "s/client_max_body_size 128M/client_max_body_size 2048M/g" feeds/packages/net/nginx-util/files/uci.conf.template
120+
sed_in_place '/client_max_body_size/a\\tclient_body_buffer_size 8192M;' feeds/packages/net/nginx-util/files/uci.conf.template
121+
sed_in_place '/client_max_body_size/a\\tserver_names_hash_bucket_size 128;' feeds/packages/net/nginx-util/files/uci.conf.template
122+
sed_in_place '/ubus_parallel_req/a\ ubus_script_timeout 600;' feeds/packages/net/nginx/files-luci-support/60_nginx-luci-support
123+
sed_in_place -E "/luci-webui.socket/i\\
124+
\t\tuwsgi_send_timeout 600;\\
125+
\t\tuwsgi_connect_timeout 600;\\
126+
\t\tuwsgi_read_timeout 600;" feeds/packages/net/nginx/files-luci-support/luci.locations
127+
sed_in_place -E "/luci-cgi_io.socket/i\\
128+
\t\tuwsgi_send_timeout 600;\\
129+
\t\tuwsgi_connect_timeout 600;\\
130+
\t\tuwsgi_read_timeout 600;" feeds/packages/net/nginx/files-luci-support/luci.locations
105131
# uwsgi
106-
sed -i 's,procd_set_param stderr 1,procd_set_param stderr 0,g' feeds/packages/net/uwsgi/files/uwsgi.init
107-
sed -i 's,buffer-size = 10000,buffer-size = 131072,g' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini
108-
sed -i 's,logger = luci,#logger = luci,g' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini
109-
sed -i '$a cgi-timeout = 600' feeds/packages/net/uwsgi/files-luci-support/luci-*.ini
110-
sed -i 's/threads = 1/threads = 2/g' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini
111-
sed -i 's/processes = 3/processes = 4/g' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini
112-
sed -i 's/cheaper = 1/cheaper = 2/g' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini
132+
sed_in_place 's,procd_set_param stderr 1,procd_set_param stderr 0,g' feeds/packages/net/uwsgi/files/uwsgi.init
133+
sed_in_place 's,buffer-size = 10000,buffer-size = 131072,g' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini
134+
sed_in_place 's,logger = luci,#logger = luci,g' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini
135+
sed_in_place '$a cgi-timeout = 600' feeds/packages/net/uwsgi/files-luci-support/luci-*.ini
136+
sed_in_place 's/threads = 1/threads = 2/g' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini
137+
sed_in_place 's/processes = 3/processes = 4/g' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini
138+
sed_in_place 's/cheaper = 1/cheaper = 2/g' feeds/packages/net/uwsgi/files-luci-support/luci-webui.ini
113139
# rpcd
114-
sed -i 's/option timeout 30/option timeout 60/g' package/system/rpcd/files/rpcd.config
115-
sed -i 's#20) \* 1000#60) \* 1000#g' feeds/luci/modules/luci-base/htdocs/luci-static/resources/rpc.js
140+
sed_in_place 's/option timeout 30/option timeout 60/g' package/system/rpcd/files/rpcd.config
141+
sed_in_place 's#20) \* 1000#60) \* 1000#g' feeds/luci/modules/luci-base/htdocs/luci-static/resources/rpc.js
116142

117143
### FW4 ###
118144
rm -rf ./package/network/config/firewall4
@@ -176,7 +202,7 @@ mkdir -p package/network/config/firewall4/patches
176202
#cp -f ../PATCH/pkgs/firewall/firewall4_patches/*.patch ./package/network/config/firewall4/patches/
177203
mkdir -p package/libs/libnftnl/patches
178204
cp -f ../PATCH/pkgs/firewall/libnftnl/*.patch ./package/libs/libnftnl/patches/
179-
sed -i '/PKG_INSTALL:=/iPKG_FIXUP:=autoreconf' package/libs/libnftnl/Makefile
205+
sed_in_place '/PKG_INSTALL:=/iPKG_FIXUP:=autoreconf' package/libs/libnftnl/Makefile
180206
mkdir -p package/network/utils/nftables/patches
181207
cp -f ../PATCH/pkgs/firewall/nftables/*.patch ./package/network/utils/nftables/patches/
182208
# Patch LuCI 以增添 FullCone 开关

SCRIPTS/02_prepare_package_minimal.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ sed_in_place() {
99
fi
1010
}
1111

12+
disable_mtk_feed() {
13+
for feed_file in feeds.conf feeds.conf.default; do
14+
if [ -f "$feed_file" ]; then
15+
sed_in_place '/^src-git\(-full\)\? mtk /d' "$feed_file"
16+
fi
17+
done
18+
19+
rm -rf ./feeds/mtk ./feeds/mtk.index
20+
}
21+
1222
rewrite_feeds() {
1323
local pkg_src=$1
1424
local luci_src=$2
@@ -28,6 +38,7 @@ rewrite_feeds "https://github.com/openwrt/packages.git;openwrt-24.10" \
2838
"https://github.com/openwrt/luci.git;openwrt-24.10" \
2939
"https://github.com/openwrt/routing.git;openwrt-24.10" \
3040
"https://github.com/openwrt/telephony.git;openwrt-24.10"
41+
disable_mtk_feed
3142

3243
# MTK feed integration intentionally disabled for now because the upstream URL currently returns 404.
3344
# MTK_FEED_URL=${MTK_FEED_URL:-https://git01.mediatek.com/openwrt/feeds/mtk-openwrt-feeds.git}
@@ -42,6 +53,7 @@ if ! ./scripts/feeds update -a; then
4253
"https://git.openwrt.org/project/luci.git;openwrt-24.10" \
4354
"https://git.openwrt.org/feed/routing.git;openwrt-24.10" \
4455
"https://git.openwrt.org/feed/telephony.git;openwrt-24.10"
56+
disable_mtk_feed
4557
./scripts/feeds update -a
4658
fi
4759

@@ -82,4 +94,4 @@ sed_in_place '/CONFIG_BUILDBOT/d' include/feeds.mk
8294
sed_in_place 's/;)\s*\\/; \\/' include/feeds.mk
8395
sed_in_place 's,CONFIG_WERROR=y,# CONFIG_WERROR is not set,g' target/linux/generic/config-6.6 || true
8496

85-
echo "[MINIMAL] Minimal package preparation complete."
97+
echo "[MINIMAL] Minimal package preparation complete."

0 commit comments

Comments
 (0)