summarylogtreecommitdiffstats
path: root/verify_kernel_config
blob: ec07e05a6db28dace402dfb395e7b13a3c41b600 (plain)
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
49
50
51
52
#!/bin/sh

verbose=-q

while getopts vc:f:m:p arg; do
    case $arg in
        c ) check_file=$OPTARG ;;
        f ) kernel_config=$OPTARG ;;
        m ) mode=$OPTARG ;;
        v ) verbose=;;
        p ) picky=1;;
        *) : ;;
    esac
done


for var in $(cat "$check_file") ;do
    case $var in
        \#*) : ;;
        *)
            case $mode in
                defined)
                    if ! grep $verbose "$var" "$kernel_config" ; then
                        if grep $verbose  $(echo "$var"|sed 's/y/m/g') "$kernel_config" ; then
                            [ $picky ] && echo "$var not y" >&2
                        else
                            echo "$var not defined" >&2
                        fi
                    fi
                    ;;
                kconfig)
                    if ! grep $verbose "$var" "$kernel_config" ; then
                        if grep $verbose  $(echo "$var"|sed 's/y/m/g') "$kernel_config" ; then
                            [ $picky ] && echo "CONFIG_$var"
                        else
                            echo "CONFIG_$var"
                        fi
                    fi
                    ;;
                notfound)
                    if ! grep -q $(echo "$var" |sed -e 's/=.*//') "$kernel_config" ; then
                        echo "$var not found" >&2
                    fi
                    ;;
                *)
                    echo "error undefined mode" >&2
                    exit 1
                    ;;
            esac
            ;;
    esac
done