2 # Manipulate options in a .config file from the command line
6 Manipulate options in a .config file from the command line.
8 config options command ...
10 --enable|-e option Enable option
11 --disable|-d option Disable option
12 --module|-m option Turn option into a module
13 --state|-s option Print state of option (n,y,m,undef)
15 --enable-after|-E beforeopt option
16 Enable option directly after other option
17 --disable-after|-D beforeopt option
18 Disable option directly after other option
19 --module-after|-M beforeopt option
20 Turn option into module directly after other option
22 commands can be repeated multiple times
25 --file .config file to change (default .config)
27 config doesn't check the validity of the .config file. This is done at next
29 The options need to be already in the file before they can be changed,
30 but sometimes you can cheat with the --*-after options.
37 if [ "$ARG" = "" ] ; then
45 ARG="`echo $ARG | tr a-z A-Z`"
52 if [ "$1" = "--file" ]; then
54 if [ "$FN" = "" ] ; then
63 if [ "$1" = "" ] ; then
67 while [ "$1" != "" ] ; do
73 replace "s/# CONFIG_$ARG is not set/CONFIG_$ARG=y/"
79 replace "s/CONFIG_$ARG=[my]/# CONFIG_$ARG is not set/"
85 replace "s/CONFIG_$ARG=y/CONFIG_$ARG=m/" \
86 -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=m/"
92 if grep -q "# CONFIG_$ARG is not set" $FN ; then
95 V="$(grep "^CONFIG_$ARG=" $FN)"
99 V="${V/CONFIG_$ARG=/}"
112 replace "/CONFIG_$A=[my]/aCONFIG_$B=y" \
113 -e "/# CONFIG_$ARG is not set/a/CONFIG_$ARG=y" \
114 -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=y/"
124 replace "/CONFIG_$A=[my]/a# CONFIG_$B is not set" \
125 -e "/# CONFIG_$ARG is not set/a/# CONFIG_$ARG is not set" \
126 -e "s/CONFIG_$ARG=[my]/# CONFIG_$ARG is not set/"
136 replace "/CONFIG_$A=[my]/aCONFIG_$B=m" \
137 -e "/# CONFIG_$ARG is not set/a/CONFIG_$ARG=m" \
138 -e "s/CONFIG_$ARG=y/CONFIG_$ARG=m/" \
139 -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=m/"
144 # undocumented because it ignores --file (fixme)
146 yes "" | make oldconfig