Skip to content

Instantly share code, notes, and snippets.

@jdmichaud
Created September 22, 2017 13:55
Show Gist options
  • Save jdmichaud/8772e206aea7b8266c69de1878f7df12 to your computer and use it in GitHub Desktop.
Save jdmichaud/8772e206aea7b8266c69de1878f7df12 to your computer and use it in GitHub Desktop.
Split Buildroot board configuration from toolchain/package configuration
#!/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