-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tool to restore defconfig sections after make [old|menu]config
- Loading branch information
David Sidrane
committed
Jan 27, 2017
1 parent
0f33ca1
commit 0596932
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#! /bin/bash | ||
|
||
if [ $# -eq 0 ] | ||
then | ||
echo "Usage: $0 <path to defconfig>" | ||
exit 1 | ||
fi | ||
configsdir=nuttx-configs | ||
defconf=$1 | ||
configsrc=$configsdir${defconf##*$configsdir} | ||
|
||
if [ ! -f $defconf ] | ||
then | ||
echo "$defconf does not exist" | ||
exit 2 | ||
fi | ||
|
||
|
||
lastconf=$defconf.last | ||
chunk=$defconf.chunk | ||
|
||
echo $configsrc | ||
git show HEAD:$configsrc > $lastconf | ||
|
||
lead='^# Board Selection$' | ||
tail='^# Common Board Options$' | ||
|
||
cat $lastconf | sed -n "/$lead/,/$tail/p" | sed '1d;$d' > $chunk | ||
|
||
echo "Fix up Board Selection" | ||
sed -i -e "/$lead/,/$tail/{ /$lead/{p; r $chunk | ||
}; /$tail/p; d }" $defconf | ||
|
||
|
||
if grep --quiet CONFIG_START_YEAR $lastconf ; then | ||
lead='^CONFIG_START_YEAR=' | ||
tail='^CONFIG_START_DAY=' | ||
cat $lastconf | sed -n "/$lead/,/$tail/p" > $chunk | ||
lead='^# Clocks and Timers$' | ||
echo "Fix up Clocks and Timers" | ||
sed -i -e "/$lead/{N;{r $chunk | ||
}}" $defconf | ||
else | ||
echo not found | ||
fi | ||
|
||
rm $lastconf | ||
rm $chunk |