11#! /bin/bash
22set -euo pipefail
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+
412rewrite_feeds () {
513 local pkg_src=$1
614 local luci_src=$2
715 local routing_src=$3
816 local telephony_src=$4
917 for feed_file in feeds.conf feeds.conf.default; do
1018 if [ -f " $feed_file " ]; then
11- sed -i " s#https://git.openwrt.org/feed/packages.git[^ ]*#$pkg_src #g" " $feed_file "
12- sed -i " s#https://git.openwrt.org/project/luci.git[^ ]*#$luci_src #g" " $feed_file "
13- sed -i " s#https://git.openwrt.org/feed/routing.git[^ ]*#$routing_src #g" " $feed_file "
14- sed -i " s#https://git.openwrt.org/feed/telephony.git[^ ]*#$telephony_src #g" " $feed_file "
19+ sed_in_place " s#https://git.openwrt.org/feed/packages.git[^ ]*#$pkg_src #g" " $feed_file "
20+ sed_in_place " s#https://git.openwrt.org/project/luci.git[^ ]*#$luci_src #g" " $feed_file "
21+ sed_in_place " s#https://git.openwrt.org/feed/routing.git[^ ]*#$routing_src #g" " $feed_file "
22+ sed_in_place " s#https://git.openwrt.org/feed/telephony.git[^ ]*#$telephony_src #g" " $feed_file "
1523 fi
1624 done
1725}
@@ -21,6 +29,13 @@ rewrite_feeds "https://github.com/openwrt/packages.git;openwrt-24.10" \
2129 " https://github.com/openwrt/routing.git;openwrt-24.10" \
2230 " https://github.com/openwrt/telephony.git;openwrt-24.10"
2331
32+ # MTK feed integration intentionally disabled for now because the upstream URL currently returns 404.
33+ # MTK_FEED_URL=${MTK_FEED_URL:-https://git01.mediatek.com/openwrt/feeds/mtk-openwrt-feeds.git}
34+ # MTK_FEED_BRANCH=${MTK_FEED_BRANCH:-master}
35+ # if ! grep -qE "^src-git mtk " feeds.conf.default; then
36+ # echo "src-git mtk ${MTK_FEED_URL};${MTK_FEED_BRANCH}" >> feeds.conf.default
37+ # fi
38+
2439if ! ./scripts/feeds update -a; then
2540 echo " GitHub 镜像更新失败,尝试切换回官方源..."
2641 rewrite_feeds " https://git.openwrt.org/feed/packages.git;openwrt-24.10" \
@@ -31,6 +46,7 @@ if ! ./scripts/feeds update -a; then
3146fi
3247
3348./scripts/feeds install -a
49+ # ./scripts/feeds install -a -p mtk -f || true
3450
3551if [ -d " ../bl-mt798x-dhcpd" ]; then
3652 echo " [BOOT] Found custom bootloader repo: bl-mt798x-dhcpd"
6076 echo " [BOOT] Custom bootloader repo not found, using default OpenWrt sources"
6177fi
6278
63- sed -i ' s,-SNAPSHOT,,g' include/version.mk
64- sed -i ' s,-SNAPSHOT,,g' package/base-files/image-config.in
65- sed -i ' /CONFIG_BUILDBOT/d' include/feeds.mk
66- sed -i ' s/;)\s*\\/; \\/' include/feeds.mk
67- sed -i ' s,CONFIG_WERROR=y,# CONFIG_WERROR is not set,g' target/linux/generic/config-6.6 || true
79+ sed_in_place ' s,-SNAPSHOT,,g' include/version.mk
80+ sed_in_place ' s,-SNAPSHOT,,g' package/base-files/image-config.in
81+ sed_in_place ' /CONFIG_BUILDBOT/d' include/feeds.mk
82+ sed_in_place ' s/;)\s*\\/; \\/' include/feeds.mk
83+ sed_in_place ' s,CONFIG_WERROR=y,# CONFIG_WERROR is not set,g' target/linux/generic/config-6.6 || true
6884
6985echo " [MINIMAL] Minimal package preparation complete."
0 commit comments