aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/rcutorture/bin/config_override.sh
blob: 90016c359e8393e0d1ad54f1dd76ee2b7966c5dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0+
#
# 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
#
# Authors: Paul E. McKenney <paulmck@linux.ibm.com>

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

T=${TMPDIR-/tmp}/config_override.sh.$$
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