summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/config32
1 files changed, 19 insertions, 13 deletions
diff --git a/scripts/config b/scripts/config
index c5639fe..9723c7d 100755
--- a/scripts/config
+++ b/scripts/config
@@ -1,6 +1,9 @@
#!/bin/bash
# Manipulate options in a .config file from the command line
+# If no prefix forced, use the default CONFIG_
+CONFIG_="${CONFIG_-CONFIG_}"
+
usage() {
cat >&2 <<EOL
Manipulate options in a .config file from the command line.
@@ -34,6 +37,9 @@ make time.
By default, config will upper-case the given symbol. Use --keep-case to keep
the case of all following symbols unchanged.
+
+config uses 'CONFIG_' as the default symbol prefix. Set the environment
+variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" config ...
EOL
exit 1
}
@@ -44,8 +50,8 @@ checkarg() {
usage
fi
case "$ARG" in
- CONFIG_*)
- ARG="${ARG/CONFIG_/}"
+ ${CONFIG_}*)
+ ARG="${ARG/${CONFIG_}/}"
;;
esac
if [ "$MUNGE_CASE" = "yes" ] ; then
@@ -107,37 +113,37 @@ while [ "$1" != "" ] ; do
esac
case "$CMD" in
--enable|-e)
- set_var "CONFIG_$ARG" "CONFIG_$ARG=y"
+ set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=y"
;;
--disable|-d)
- set_var "CONFIG_$ARG" "# CONFIG_$ARG is not set"
+ set_var "${CONFIG_}$ARG" "# ${CONFIG_}$ARG is not set"
;;
--module|-m)
- set_var "CONFIG_$ARG" "CONFIG_$ARG=m"
+ set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=m"
;;
--set-str)
# sed swallows one level of escaping, so we need double-escaping
- set_var "CONFIG_$ARG" "CONFIG_$ARG=\"${1//\"/\\\\\"}\""
+ set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=\"${1//\"/\\\\\"}\""
shift
;;
--set-val)
- set_var "CONFIG_$ARG" "CONFIG_$ARG=$1"
+ set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1"
shift
;;
--state|-s)
- if grep -q "# CONFIG_$ARG is not set" $FN ; then
+ if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then
echo n
else
- V="$(grep "^CONFIG_$ARG=" $FN)"
+ V="$(grep "^${CONFIG_}$ARG=" $FN)"
if [ $? != 0 ] ; then
echo undef
else
- V="${V/#CONFIG_$ARG=/}"
+ V="${V/#${CONFIG_}$ARG=/}"
V="${V/#\"/}"
V="${V/%\"/}"
V="${V/\\\"/\"}"
@@ -147,15 +153,15 @@ while [ "$1" != "" ] ; do
;;
--enable-after|-E)
- set_var "CONFIG_$B" "CONFIG_$B=y" "CONFIG_$A"
+ set_var "${CONFIG_}$B" "${CONFIG_}$B=y" "${CONFIG_}$A"
;;
--disable-after|-D)
- set_var "CONFIG_$B" "# CONFIG_$B is not set" "CONFIG_$A"
+ set_var "${CONFIG_}$B" "# ${CONFIG_}$B is not set" "${CONFIG_}$A"
;;
--module-after|-M)
- set_var "CONFIG_$B" "CONFIG_$B=m" "CONFIG_$A"
+ set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A"
;;
# undocumented because it ignores --file (fixme)
OpenPOWER on IntegriCloud