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.
This commit is contained in:
lemoer 2021-08-13 02:19:17 +02:00
parent 7d594f4a99
commit 80c8467ca8

View File

@ -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