Skip to content

Commit 5735722

Browse files
committed
Config file can override BASE_BOARD from cli
1 parent 5ac52ff commit 5735722

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/build

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,24 @@ source ${DIST_PATH}/config
1515

1616
define SCRIPT <<'EOF'
1717
BUILD_SCRIPT_PATH=$(dirname $(realpath -s $BASH_SOURCE))
18+
19+
# Config file can override BASE_BOARD from cli
20+
CONFIG_FILE="${DIST_PATH}"/config
21+
22+
if [ -f "${CONFIG_FILE}" ]; then
23+
echo "Found a dist config file, if BASE_BOARD is set there will source it before generating the extra board config"
24+
BASE_BOARD_FROM_CONFIG=$(bash -c "source \"$CONFIG_FILE\" >/dev/null 2>&1; echo \$BASE_BOARD")
25+
if [ -n "$BASE_BOARD_FROM_CONFIG" ]; then
26+
export BASE_BOARD="$BASE_BOARD_FROM_CONFIG"
27+
echo "BASE_BOARD set to ${BASE_BOARD} from ${CONFIG_FILE} before generating board config."
28+
else
29+
echo "BASE_BOARD not found in ${CONFIG_FILE}. It will be set from the cli or fallback to raspberrypiarmhf"
30+
fi
31+
else
32+
echo "Config file ${CONFIG_FILE} does not exist. You probably want to create one for you distrubtion."
33+
fi
34+
35+
1836
export EXTRA_BOARD_CONFIG=$(mktemp)
1937
${BUILD_SCRIPT_PATH}/custompios_core/generate_board_config.py "${EXTRA_BOARD_CONFIG}"
2038
echo "Temp source file: ${EXTRA_BOARD_CONFIG}"

0 commit comments

Comments
 (0)