rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
common_script_read_meta_env.inc
Go to the documentation of this file.
1#!/bin/bash
2
3# this script is supposed to be executed from within 'firmware' folder
4
5if [ -z "$1" ]; then
6 echo "Read meta.env: The file path was not given as a parameter!"
7 exit -3
8fi
9
10BOARD_META_PATH=./$1
11
12# magical version of BOARD_META_DIR=$(dirname "$BOARD_META_PATH")
13BOARD_META_DIR=${BOARD_META_PATH%/*}
14
15if [ -z "${BOARD_DIR}" ]; then
16 export BOARD_DIR="$BOARD_META_DIR"
17 echo "common_script_read_meta_env.inc: BOARD_DIR was empty. Setting to fallback: $BOARD_DIR (from BOARD_META_DIR)"
18else
19 export BOARD_DIR="$BOARD_DIR"
20 echo "common_script_read_meta_env.inc: BOARD_DIR was already set. Keeping current value: $BOARD_DIR"
21fi
22
23if [ ! -f ${BOARD_META_PATH} ]; then
24 echo "Read $BOARD_META_PATH: The file was not found!"
25 exit -4
26fi
27
28if [ ! -f ${BOARD_DIR}/board.mk ]; then
29 echo "WARNING! board.mk not found @ ${BOARD_DIR}..."
30fi
31
32echo "[META] Reading meta env from ${BOARD_META_PATH}"
33
34VARS=$(grep "=" "$BOARD_META_PATH")
35
36while IFS= read -r L; do
37 # get the key and delete all spaces
38 K=$(echo "$L" | cut -d '=' -f "-1" | tr -d ' ')
39 # get the value and delete any leading space
40 V=$(echo "$L" | cut -d '=' -f "2-" | awk '{$1=$1};1')
41 # put them together, closing the value in quotes
42 export $K="$V"
43done <<< "$VARS"
44
45if [ -z "$BUNDLE_NAME" ]; then
46 BUNDLE_NAME=$(echo "$BOARD_META_PATH" | sed -n 's/.*meta-info-\‍(.*\‍)\.env/\1/p')
47 if [ -z "$BUNDLE_NAME" ]; then
48 export BUNDLE_NAME="$SHORT_BOARD_NAME"
49 else
50 export BUNDLE_NAME
51 fi
52fi
53
54echo "[META] PROJECT_BOARD=${PROJECT_BOARD}"
55echo "[META] PROJECT_CPU=${PROJECT_CPU}"
56echo "[META] POST_BUILD_SCRIPT=${POST_BUILD_SCRIPT}"
57echo "[META] BOARD_DIR=${BOARD_DIR}"
58echo "[META] USE_OPENBLT=${USE_OPENBLT}"
static void echo(int value)
This is just a test function.