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 --set-str option string
14 Set option to "string"
15 --set-val option value
17 --state|-s option Print state of option (n,y,m,undef)
19 --enable-after|-E beforeopt option
20 Enable option directly after other option
21 --disable-after|-D beforeopt option
22 Disable option directly after other option
23 --module-after|-M beforeopt option
24 Turn option into module directly after other option
26 commands can be repeated multiple times
29 --file config-file .config file to change (default .config)
30 --keep-case|-k Keep next symbols' case (dont' upper-case it)
32 config doesn't check the validity of the .config file. This is done at next
35 By default, config will upper-case the given symbol. Use --keep-case to keep
36 the case of all following symbols unchanged.
43 if [ "$ARG" = "" ] ; then
51 if [ "$MUNGE_CASE" = "yes" ] ; then
52 ARG="`echo $ARG | tr a-z A-Z`"
57 local name=$1 new=$2 before=$3
59 name_re="^($name=|# $name is not set)"
60 before_re="^($before=|# $before is not set)"
61 if test -n "$before" && grep -Eq "$before_re" "$FN"; then
62 sed -ri "/$before_re/a $new" "$FN"
63 elif grep -Eq "$name_re" "$FN"; then
64 sed -ri "s:$name_re.*:$new:" "$FN"
70 if [ "$1" = "--file" ]; then
72 if [ "$FN" = "" ] ; then
80 if [ "$1" = "" ] ; then
85 while [ "$1" != "" ] ; do
110 set_var "CONFIG_$ARG" "CONFIG_$ARG=y"
114 set_var "CONFIG_$ARG" "# CONFIG_$ARG is not set"
118 set_var "CONFIG_$ARG" "CONFIG_$ARG=m"
122 # sed swallows one level of escaping, so we need double-escaping
123 set_var "CONFIG_$ARG" "CONFIG_$ARG=\"${1//\"/\\\\\"}\""
128 set_var "CONFIG_$ARG" "CONFIG_$ARG=$1"
133 if grep -q "# CONFIG_$ARG is not set" $FN ; then
136 V="$(grep "^CONFIG_$ARG=" $FN)"
137 if [ $? != 0 ] ; then
140 V="${V/#CONFIG_$ARG=/}"
150 set_var "CONFIG_$B" "CONFIG_$B=y" "CONFIG_$A"
154 set_var "CONFIG_$B" "# CONFIG_$B is not set" "CONFIG_$A"
158 set_var "CONFIG_$B" "CONFIG_$B=m" "CONFIG_$A"
161 # undocumented because it ignores --file (fixme)
163 yes "" | make oldconfig