2017-05-02 08:49:29 +08:00
|
|
|
#!/bin/bash
|
2019-02-11 23:14:09 +08:00
|
|
|
# SPDX-License-Identifier: GPL-2.0+
|
2017-05-02 08:49:29 +08:00
|
|
|
#
|
|
|
|
# config_override.sh base override
|
|
|
|
#
|
|
|
|
# Combines base and override, removing any Kconfig options from base
|
|
|
|
# that conflict with any in override, concatenating what remains and
|
|
|
|
# sending the result to standard output.
|
|
|
|
#
|
|
|
|
# Copyright (C) IBM Corporation, 2017
|
|
|
|
#
|
2019-02-11 23:14:09 +08:00
|
|
|
# Authors: Paul E. McKenney <paulmck@linux.ibm.com>
|
2017-05-02 08:49:29 +08:00
|
|
|
|
|
|
|
base=$1
|
|
|
|
if test -r $base
|
|
|
|
then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo Base file $base unreadable!!!
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
override=$2
|
|
|
|
if test -r $override
|
|
|
|
then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo Override file $override unreadable!!!
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-08-31 06:33:49 +08:00
|
|
|
T=${TMPDIR-/tmp}/config_override.sh.$$
|
2017-05-02 08:49:29 +08:00
|
|
|
trap 'rm -rf $T' 0
|
|
|
|
mkdir $T
|
|
|
|
|
|
|
|
sed < $override -e 's/^/grep -v "/' -e 's/=.*$/="/' |
|
|
|
|
awk '
|
|
|
|
{
|
|
|
|
if (last)
|
|
|
|
print last " |";
|
|
|
|
last = $0;
|
|
|
|
}
|
|
|
|
END {
|
|
|
|
if (last)
|
|
|
|
print last;
|
|
|
|
}' > $T/script
|
|
|
|
sh $T/script < $base
|
|
|
|
cat $override
|