Created
September 22, 2017 13:55
-
-
Save jdmichaud/8772e206aea7b8266c69de1878f7df12 to your computer and use it in GitHub Desktop.
Split Buildroot board configuration from toolchain/package configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ $# -ne 3 ]] | |
then | |
echo "usage: $0 <config_file> <board_config_file> <rest_config_file>" | |
exit 0 | |
fi | |
CONFIG=$1 | |
BOARD=$2 | |
REST=$3 | |
while read entry | |
do | |
if [[ $entry =~ ^[A-Z] ]] | |
then | |
key=$(echo $entry | awk -F'=' '{ print $1 }') | |
value=$(echo $entry | awk -F'=' '{ print $2 }') | |
if [[ `grep $key $BOARD | wc -l` -gt 0 ]] | |
then | |
# This entry is part of the board config | |
sed -re 's/$key=(.*)/$key=$value/g' $BOARD > $BOARD.new | |
else | |
# This entry is part of the rest (toolcain config, package selection, etc) | |
echo $key=$value >> $REST | |
fi | |
fi | |
done < $CONFIG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment