From 80c8467ca8b12e13383c9fd176ae50ca74959554 Mon Sep 17 00:00:00 2001 From: lemoer Date: Fri, 13 Aug 2021 02:19:17 +0200 Subject: [PATCH] imagebuilder: fix package selection Before this commit, default packages were not disabled correctly, if they were disabled in the .config. Now this is correctly done. --- scripts/imagebuilder/build_gluon.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/imagebuilder/build_gluon.sh b/scripts/imagebuilder/build_gluon.sh index 126d6469..9bd17e41 100755 --- a/scripts/imagebuilder/build_gluon.sh +++ b/scripts/imagebuilder/build_gluon.sh @@ -17,6 +17,10 @@ config2profiles() { cut -d '=' -f 1 | cut -d '_' -f 7- } +config2default_packages() { + grep -e '^CONFIG_DEFAULT_[[:lower:]].*=y$' "$1" | sed 's/^CONFIG_DEFAULT_\(.*\)=y$/\1/' +} + config2packages() { # - some config symbols, which are not a package appear, therefore strip # everything with uppercase characters @@ -30,6 +34,14 @@ config2packages() { # Per device packages grep -e "^CONFIG_TARGET_DEVICE_PACKAGES_${BOARD}_${SUBTARGET}_DEVICE_$2=" "$1" | \ cut -d '=' -f 2 | tr -d '"' + + # Disable default packages (if necessary) + default_packages="$(config2default_packages "$1")" + for default_package in $default_packages; do + if ! grep -q "^CONFIG_PACKAGE_${default_package}=y$" "$1"; then + echo "-${default_package}" + fi + done | tr -s '\n' ' ' } if [ -z "$INCLUDE_ONLY" ] && [ "$#" -lt 1 ]; then @@ -63,10 +75,7 @@ if [ -z "$INCLUDE_ONLY" ]; then echo "Profile $1 not available. Call without argument to see available profiles." exit 1 fi - # DEVICE_TYPE=other is kind of a hack to ensure kmod-ipt-offload, odhcpd-ipv6only, ppp and - # ppp-mod-pppoe are not in $DEFAULT_PACKAGES. Otherwise the build will fail, because gluon - # does not provide them. - make image \ - FILES="$CUSTOM_DIR" DEVICE_TYPE=other \ - PACKAGES="$(config2packages .config "$1")" PROFILE="$1" + + make -C "$SCRIPT_DIR" image \ + FILES="$CUSTOM_DIR" PACKAGES="$(config2packages .config)" PROFILE="$1" fi