Support eval bash statement in ./compile.sh (#1616)

Currently, invoking compile.sh will run its mono task of building all the
components into a final image.

In some situation, especially when developing with Kernel or U-Boot, it is
handy to run a portion of that great task like:

    export BOARD=firefly-rk3399
    export BRANCH=dev
    # more to avoid the popup of dialog
    ./compile.sh 'fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes"'
    ./compile.sh 'compile_uboot'

or use a profile to keep things simple:

    ./compile.sh default BRANCH=dev 'compile_uboot'
This commit is contained in:
Levin Du
2019-11-27 01:00:39 +08:00
committed by Igor Pečovnik
parent 8d10472bd2
commit 77a2dba163
2 changed files with 70 additions and 60 deletions

View File

@@ -169,6 +169,7 @@ fi
if [[ -z "$CONFIG" && -n "$1" && -f "${SRC}/userpatches/config-$1.conf" ]]; then
CONFIG="userpatches/config-$1.conf"
shift
fi
# usind default if custom not found
@@ -195,13 +196,12 @@ popd > /dev/null
[[ -z "${USERPATCHES_PATH}" ]] && USERPATCHES_PATH="$CONFIG_PATH"
# Script parameters handling
for i in "$@"; do
if [[ $i == *=* ]]; then
parameter=${i%%=*}
value=${i##*=}
display_alert "Command line: setting $parameter to" "${value:-(empty)}" "info"
eval "$parameter=\"$value\""
fi
while [[ $1 == *=* ]]; do
parameter=${1%%=*}
value=${1##*=}
shift
display_alert "Command line: setting $parameter to" "${value:-(empty)}" "info"
eval "$parameter=\"$value\""
done
if [[ $BUILD_ALL == yes || $BUILD_ALL == demo ]]; then