diff options
author | Mike Frysinger <vapier@gentoo.org> | 2016-06-22 23:26:49 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2016-06-22 23:26:49 -0400 |
commit | f5f28c6c6fa09a746d317c0956659eb6c6454516 (patch) | |
tree | e51b426f40b3083b81913a101ea1d5b509ae62a7 | |
parent | cleanup small_die a bit (diff) | |
download | genkernel-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-x | genkernel | 13 |
1 files changed, 2 insertions, 11 deletions
@@ -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 |