|
#!/bin/sh
|
|
|
|
PREPOST="$1"
|
|
shift
|
|
TBUILD="$1"
|
|
shift
|
|
shift
|
|
EXTRA_PACKS="$@"
|
|
FILE="build/${TBUILD}/.config"
|
|
|
|
[ -z "$TBUILD" ] || [ ! -d "build/$TBUILD" ] || [ ! -f "$FILE" ] && exit 1
|
|
|
|
for i in $EXTRA_PACKS; do
|
|
PKG="CONFIG_PACKAGE_$i"
|
|
AUX="$(grep $PKG $FILE | tr -d '\n')"
|
|
[ -n "$AUX" ] && {
|
|
[ "$PREPOST" = "PRE_BUILD" ] && echo "- Adding extra package: $i" >&2 && sed -i -e s/"${AUX}"/"CONFIG_PACKAGE_$i=y"/g $FILE
|
|
[ "$PREPOST" = "POST_BUILD" ] && echo "- Removing extra package: $i" >&2 && sed -i -e s/"${AUX}"/"# CONFIG_PACKAGE_$i is not set"/g $FILE
|
|
}
|
|
done
|