usb: gadget: Allow to build multiple legacy gadgets
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / scripts / sprd_custom_config_kernel.sh
1 #!/bin/bash
2
3 FN="$2"
4 if [ -f $FN ];then
5         echo -e "==== modify kernel custom configs ===="
6         for line in `cat "$FN"`
7         do
8                 head=`expr substr "$line" 1 1`
9                 if [ "$head" = "#" ]; then
10                         continue
11                 fi
12
13                 config_head=`expr substr "$line" 1 6`
14                 if [ "$config_head" = "KERNEL" ]; then
15                         echo "config kernel" >/dev/null
16                 else
17                 #not kernel config,by pass it
18                         continue
19                 fi
20                 line=${line:7}
21                 value=${line#*=}
22                 tag=${line%%=*}
23                 config=${tag:7}
24                 echo -e $tag"="$value
25                 value_l=`tr '[A-Z]' '[a-z]' <<<"$value"` #value little
26
27                 #is yes or no
28                 if [ "$value_l" = "y" ]; then
29                         echo -e "is y"
30                         #echo -e $config
31                         ./kernel/scripts/config --file $1 -e $config
32                         continue
33                 else
34                         if [ "$value_l" = "yes" ]; then
35                                 echo -e "is yes"
36                                 #echo -e $config
37                                 ./kernel/scripts/config --file $1 -e $config
38                                 continue
39                         fi
40                 fi
41
42                 if [ "$value_l" = "n" ]; then
43                         echo -e "is n"
44                         echo -e $config
45                         ./kernel/scripts/config --file $1 -d $config
46                         continue
47                 else
48                         if [ "$value_l" = "no" ]; then
49                                 echo -e "is no"
50                                 echo -e $config
51                                 ./kernel/scripts/config --file $1 -d $config
52                                 continue
53                         fi
54                 fi
55
56                 #is str
57                 value_f=`expr substr "$value" 1 1`  #value first
58                 len=${#value}
59                 value_l=`expr substr "$value" $len 1` #value last
60                 if [ "$value_f" = "\"" ]; then
61                         if [ "$value_l" = "\"" ]; then
62                                 str=`expr substr "$value" 2 $[$len-2]`
63                                 echo "is str"
64                                 #echo $config"="$str
65                                 ./kernel/scripts/config --file $1 --set-str $config $str
66                                 continue
67                         fi
68                         #str may be error,bybass it,config next
69                         continue
70                 fi
71
72                 #is integer
73                 #echo $config"="$value
74                 ./kernel/scripts/config --file $1 --set-val $config $value
75         done
76 fi