commit: 7f6061ca070918204aad75330ea7c32aff3e2a9c Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> AuthorDate: Mon Nov 27 20:19:02 2017 +0000 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> CommitDate: Mon Nov 27 20:22:29 2017 +0000 URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=7f6061ca
net/wpa_supplicant: rewrite -D detection Commit 38b9fac9 per Henning Schild's submission PR#27 improved wpa_supplicant driver detection, but had room for improvements as discussed in the comment thread. Includes detection of -N for future multiple interface work. Bug: https://github.com/gentoo/netifrc/pull/27 CC: Henning Schild <henning <AT> hennsch.de> Thanks-To: Henning Schild <henning <AT> hennsch.de> Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> net/wpa_supplicant.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/net/wpa_supplicant.sh b/net/wpa_supplicant.sh index 5df662a..594a157 100644 --- a/net/wpa_supplicant.sh +++ b/net/wpa_supplicant.sh @@ -63,11 +63,21 @@ wpa_supplicant_pre_start() eval opts=\$wpa_supplicant_${IFVAR} eval cliopts=\$wpa_cli_${IFVAR} [ -z "${cliopts}" ] && cliopts=${wpa_cli} - if echo " $opts " | grep -q " \-D[[:space:]]wired "; then - wireless=false - else - _is_wireless || return 0 - fi + set -- $opts + local opt_D + while [ ${#*} -gt 0 ]; do + local opt=$1 ; shift + case "$opt" in + -D) opt_D=${1} ; shift ;; + -D*) opt_D=${opt#-D} ;; + -N) eerror "Cannot use -N to wpa_supplicant for \$wpa_supplicant_${IFVAR}!" && return 1 ;; + esac + done + case "$opt_D" in + roboswitch) wireless=false ;; + wired) wireless=false ;; + *) _is_wireless || return 0;; + esac # We don't configure wireless if we're being called from # the background unless we're not currently running