fix config for 25.12.2

Signed-off-by: Zhe Yuan <yuanzhe1999@outlook.com>
This commit is contained in:
2026-04-04 09:47:54 -04:00
parent add8293042
commit d312fef6ef
5 changed files with 8353 additions and 22 deletions

View File

@@ -5,7 +5,9 @@
# ./add-openwrt-packages.sh packages.txt
# Description:
# - Reads package names from a text file (supports both newline or space separation)
# - Adds missing CONFIG_PACKAGE_xxx=y entries to .config
# - Supports ##built-in and ##module sections to control build mode (=y or =m)
# - Packages default to built-in (=y) if no section header is specified
# - Adds missing CONFIG_PACKAGE_xxx entries to .config
# - Keeps existing settings intact
# - Reports missing packages
# - Runs make defconfig at the end to sync dependencies
@@ -81,27 +83,51 @@ package_exists() {
echo "📦 Reading packages from $PKG_FILE ..."
# Read package tokens from file, while allowing inline comments.
PACKAGES=$(awk '{ sub(/#.*/, ""); for (i = 1; i <= NF; i++) print $i }' "$PKG_FILE")
# Parse the file into "package:mode" pairs, respecting ##built-in / ##module sections.
# Default mode is "y" (built-in). Inline comments (#xxx but not ##) are stripped.
ENTRIES=$(awk '
BEGIN { mode = "y" }
/^##built-in/ { mode = "y"; next }
/^##module/ { mode = "m"; next }
{
sub(/#[^#].*/, "") # strip inline comments (single #), preserve ## headers
for (i = 1; i <= NF; i++) print $i ":" mode
}
' "$PKG_FILE")
ADDED=()
UPGRADED=()
MISSING=()
for pkg in $PACKAGES; do
for entry in $ENTRIES; do
pkg="${entry%:*}"
mode="${entry##*:}"
CONFIG_NAME="CONFIG_PACKAGE_${pkg}"
# Skip if already built-in
if is_already_builtin "$pkg"; then
echo "✅ Already built-in: $pkg"
continue
fi
if [ "$mode" = "y" ]; then
# --- built-in mode ---
if is_already_builtin "$pkg"; then
echo "✅ Already built-in: $pkg"
continue
fi
# Upgrade module to built-in
if is_module "$pkg"; then
sed -i "s/^CONFIG_PACKAGE_${pkg}=m$/CONFIG_PACKAGE_${pkg}=y/" .config
ADDED+=("$pkg")
echo "⬆️ Module → built-in: $pkg"
continue
if is_module "$pkg"; then
sed -i "s/^CONFIG_PACKAGE_${pkg}=m$/CONFIG_PACKAGE_${pkg}=y/" .config
UPGRADED+=("$pkg")
echo "⬆️ Module → built-in: $pkg"
continue
fi
else
# --- module mode ---
if is_module "$pkg"; then
echo "✅ Already module: $pkg"
continue
fi
if is_already_builtin "$pkg"; then
echo "✅ Already built-in (keeping): $pkg"
continue
fi
fi
# Check if package exists in OpenWrt package metadata.
@@ -112,9 +138,9 @@ for pkg in $PACKAGES; do
fi
# Append package config
echo "${CONFIG_NAME}=y" >> .config
ADDED+=("$pkg")
echo " Added: $pkg"
echo "${CONFIG_NAME}=${mode}" >> .config
ADDED+=("$pkg (=${mode})")
echo " Added: $pkg (=${mode})"
done
# Run defconfig to sync dependencies
@@ -126,6 +152,8 @@ echo
echo "✅ Done!"
echo "📋 Packages newly added: ${#ADDED[@]}"
[ ${#ADDED[@]} -gt 0 ] && echo "${ADDED[*]}"
echo "📋 Packages upgraded to built-in: ${#UPGRADED[@]}"
[ ${#UPGRADED[@]} -gt 0 ] && echo "${UPGRADED[*]}"
if [ ${#MISSING[@]} -gt 0 ]; then
echo "⚠️ Packages not found (check feeds or spelling):"
for m in "${MISSING[@]}"; do