Gentoo Archives: gentoo-commits

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/netifrc:master commit in: net/
Date: Mon, 27 Nov 2017 20:22:55
Message-Id: 1511814149.7f6061ca070918204aad75330ea7c32aff3e2a9c.robbat2@OpenRC
1 commit: 7f6061ca070918204aad75330ea7c32aff3e2a9c
2 Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
3 AuthorDate: Mon Nov 27 20:19:02 2017 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Mon Nov 27 20:22:29 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=7f6061ca
7
8 net/wpa_supplicant: rewrite -D detection
9
10 Commit 38b9fac9 per Henning Schild's submission PR#27 improved
11 wpa_supplicant driver detection, but had room for improvements as
12 discussed in the comment thread. Includes detection of -N for future
13 multiple interface work.
14
15 Bug: https://github.com/gentoo/netifrc/pull/27
16 CC: Henning Schild <henning <AT> hennsch.de>
17 Thanks-To: Henning Schild <henning <AT> hennsch.de>
18 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
19
20 net/wpa_supplicant.sh | 20 +++++++++++++++-----
21 1 file changed, 15 insertions(+), 5 deletions(-)
22
23 diff --git a/net/wpa_supplicant.sh b/net/wpa_supplicant.sh
24 index 5df662a..594a157 100644
25 --- a/net/wpa_supplicant.sh
26 +++ b/net/wpa_supplicant.sh
27 @@ -63,11 +63,21 @@ wpa_supplicant_pre_start()
28 eval opts=\$wpa_supplicant_${IFVAR}
29 eval cliopts=\$wpa_cli_${IFVAR}
30 [ -z "${cliopts}" ] && cliopts=${wpa_cli}
31 - if echo " $opts " | grep -q " \-D[[:space:]]wired "; then
32 - wireless=false
33 - else
34 - _is_wireless || return 0
35 - fi
36 + set -- $opts
37 + local opt_D
38 + while [ ${#*} -gt 0 ]; do
39 + local opt=$1 ; shift
40 + case "$opt" in
41 + -D) opt_D=${1} ; shift ;;
42 + -D*) opt_D=${opt#-D} ;;
43 + -N) eerror "Cannot use -N to wpa_supplicant for \$wpa_supplicant_${IFVAR}!" && return 1 ;;
44 + esac
45 + done
46 + case "$opt_D" in
47 + roboswitch) wireless=false ;;
48 + wired) wireless=false ;;
49 + *) _is_wireless || return 0;;
50 + esac
51
52 # We don't configure wireless if we're being called from
53 # the background unless we're not currently running