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 while [ "$1" != "" ] ; do
69 replace "s/# CONFIG_$ARG is not set/CONFIG_$ARG=y/"
75 replace "s/CONFIG_$ARG=[my]/# CONFIG_$ARG is not set/"
81 replace "s/CONFIG_$ARG=y/CONFIG_$ARG=m/" \
82 -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=m/"
88 if grep -q "# CONFIG_$ARG is not set" $FN ; then
91 V="$(grep "^CONFIG_$ARG=" $FN)"
95 V="${V/CONFIG_$ARG=/}"
108 replace "/CONFIG_$A=[my]/aCONFIG_$B=y" \
109 -e "/# CONFIG_$ARG is not set/a/CONFIG_$ARG=y" \
110 -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=y/"
120 replace "/CONFIG_$A=[my]/a# CONFIG_$B is not set" \
121 -e "/# CONFIG_$ARG is not set/a/# CONFIG_$ARG is not set" \
122 -e "s/CONFIG_$ARG=[my]/# CONFIG_$ARG is not set/"
132 replace "/CONFIG_$A=[my]/aCONFIG_$B=m" \
133 -e "/# CONFIG_$ARG is not set/a/CONFIG_$ARG=m" \
134 -e "s/CONFIG_$ARG=y/CONFIG_$ARG=m/" \
135 -e "s/# CONFIG_$ARG is not set/CONFIG_$ARG=m/"
140 # undocumented because it ignores --file (fixme)
142 yes "" | make oldconfig