Merge tag 's390-5.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
[linux-2.6-microblaze.git] / tools / testing / selftests / rcutorture / bin / config_override.sh
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0+
3 #
4 # config_override.sh base override
5 #
6 # Combines base and override, removing any Kconfig options from base
7 # that conflict with any in override, concatenating what remains and
8 # sending the result to standard output.
9 #
10 # Copyright (C) IBM Corporation, 2017
11 #
12 # Authors: Paul E. McKenney <paulmck@linux.ibm.com>
13
14 base=$1
15 if test -r $base
16 then
17         :
18 else
19         echo Base file $base unreadable!!!
20         exit 1
21 fi
22
23 override=$2
24 if test -r $override
25 then
26         :
27 else
28         echo Override file $override unreadable!!!
29         exit 1
30 fi
31
32 T=${TMPDIR-/tmp}/config_override.sh.$$
33 trap 'rm -rf $T' 0
34 mkdir $T
35
36 sed < $override -e 's/^/grep -v "/' -e 's/=.*$/="/' |
37         awk '
38         {
39                 if (last)
40                         print last " |";
41                 last = $0;
42         }
43         END {
44                 if (last)
45                         print last;
46         }' > $T/script
47 sh $T/script < $base
48 cat $override