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
11BOARD_META_DIR=${BOARD_META_PATH%/*}
12export BOARD_DIR=${BOARD_DIR:-$BOARD_META_DIR}
13
14if [ ! -f ${BOARD_META_PATH} ]; then
15 echo "Read $BOARD_META_PATH: The file was not found!"
16 exit -4
17fi
18
19if [ ! -f ${BOARD_DIR}/board.mk ]; then
20 echo "WARNING! board.mk not found @ ${BOARD_DIR}..."
21fi
22
23echo "[META] Reading meta env from ${BOARD_META_PATH}"
24
25VARS=$(grep "=" "$BOARD_META_PATH")
26
27while IFS= read -r L; do
28 # get the key and delete all spaces
29 K=$(echo "$L" | cut -d '=' -f "-1" | tr -d ' ')
30 # get the value and delete any leading space
31 V=$(echo "$L" | cut -d '=' -f "2-" | awk '{$1=$1};1')
32 # put them together, closing the value in quotes
33 export $K="$V"
34done <<< "$VARS"
35
36if [ -z "$BUNDLE_NAME" ]; then
37 BUNDLE_NAME=$(echo "$BOARD_META_PATH" | sed -n 's/.*meta-info-\‍(.*\‍)\.env/\1/p')
38 if [ -z "$BUNDLE_NAME" ]; then
39 export BUNDLE_NAME="$SHORT_BOARD_NAME"
40 else
41 export BUNDLE_NAME
42 fi
43fi
44
45echo "[META] PROJECT_BOARD=${PROJECT_BOARD}"
46echo "[META] PROJECT_CPU=${PROJECT_CPU}"
47echo "[META] POST_BUILD_SCRIPT=${POST_BUILD_SCRIPT}"
48echo "[META] BOARD_DIR=${BOARD_DIR}"
49echo "[META] USE_OPENBLT=${USE_OPENBLT}"
static void echo(int value)
This is just a test function.