commit: f5f28c6c6fa09a746d317c0956659eb6c6454516
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 23 03:26:49 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Jun 23 03:26:49 2016 +0000
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=f5f28c6c
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.
genkernel | 13 ++-----------
1 file 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