summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-06-22 23:26:49 -0400
committerMike Frysinger <vapier@gentoo.org>2016-06-22 23:26:49 -0400
commitf5f28c6c6fa09a746d317c0956659eb6c6454516 (patch)
treee51b426f40b3083b81913a101ea1d5b509ae62a7
parentcleanup small_die a bit (diff)
downloadgenkernel-f5f28c6c6fa09a746d317c0956659eb6c6454516.tar.gz
genkernel-f5f28c6c6fa09a746d317c0956659eb6c6454516.tar.bz2
genkernel-f5f28c6c6fa09a746d317c0956659eb6c6454516.zip
genkernel: simplify/robustify --config parsing
There's no need to use eval here, and the quoting on it is off leading to incorrect expansion side effects with some inputs.
-rwxr-xr-xgenkernel13
1 files changed, 2 insertions, 11 deletions
diff --git a/genkernel b/genkernel
index a404415..506a2ca 100755
--- a/genkernel
+++ b/genkernel
@@ -15,21 +15,12 @@ small_die() {
exit 1
}
-parse_opt() {
- case "$1" in
- *\=*)
- echo "$1" | cut -f2- -d=
- ;;
- esac
-}
-
# We don't know where our config is, so we check for it, and default to using
# /etc/genkernel.conf if nobody has specified one.
# NOTE: We are look for --config=... in a way that doesn't modify $@ since we access that again, later
-for (( i=1; i<=$# ; i=i+1 )); do
- eval arg="\$$i"
- [[ "${arg}" = --config=* ]] && CMD_GK_CONFIG=`parse_opt "${arg}"`
+for arg in "$@"; do
+ [[ "${arg}" == --config=* ]] && CMD_GK_CONFIG=${arg#--config=}
done
# Pull in our configuration