Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / tools / testing / selftests / rcutorture / bin / config_override.sh
blobef7fcbac3d421ad6d171ab1fed57a5ee2d716221
1 #!/bin/bash
3 # config_override.sh base override
5 # Combines base and override, removing any Kconfig options from base
6 # that conflict with any in override, concatenating what remains and
7 # sending the result to standard output.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, you can access it online at
21 # http://www.gnu.org/licenses/gpl-2.0.html.
23 # Copyright (C) IBM Corporation, 2017
25 # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
27 base=$1
28 if test -r $base
29 then
31 else
32 echo Base file $base unreadable!!!
33 exit 1
36 override=$2
37 if test -r $override
38 then
40 else
41 echo Override file $override unreadable!!!
42 exit 1
45 T=${TMPDIR-/tmp}/config_override.sh.$$
46 trap 'rm -rf $T' 0
47 mkdir $T
49 sed < $override -e 's/^/grep -v "/' -e 's/=.*$/="/' |
50 awk '
52 if (last)
53 print last " |";
54 last = $0;
56 END {
57 if (last)
58 print last;
59 }' > $T/script
60 sh $T/script < $base
61 cat $override