From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 15FF6139082 for ; Mon, 27 Nov 2017 20:22:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6991AE0ED0; Mon, 27 Nov 2017 20:22:54 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 41477E0ED0 for ; Mon, 27 Nov 2017 20:22:54 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id DCABF33BF01 for ; Mon, 27 Nov 2017 20:22:52 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 708FBA9AE for ; Mon, 27 Nov 2017 20:22:51 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: <1511814149.7f6061ca070918204aad75330ea7c32aff3e2a9c.robbat2@OpenRC> Subject: [gentoo-commits] proj/netifrc:master commit in: net/ X-VCS-Repository: proj/netifrc X-VCS-Files: net/wpa_supplicant.sh X-VCS-Directories: net/ X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: 7f6061ca070918204aad75330ea7c32aff3e2a9c X-VCS-Branch: master Date: Mon, 27 Nov 2017 20:22:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 7f53cfee-4f43-4b3b-a6ce-f1c35ad3d8fc X-Archives-Hash: 2ab06f1419f9616f0d592dd6de352f90 commit: 7f6061ca070918204aad75330ea7c32aff3e2a9c Author: Robin H. Johnson gentoo org> AuthorDate: Mon Nov 27 20:19:02 2017 +0000 Commit: Robin H. Johnson gentoo 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 hennsch.de> Thanks-To: Henning Schild hennsch.de> Signed-off-by: Robin H. Johnson 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