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: Tue, 02 Jun 2020 21:54:15
Message-Id: 1591134297.1c846d9d8e23d94046df471c7ccbb88228537188.robbat2@OpenRC
1 commit: 1c846d9d8e23d94046df471c7ccbb88228537188
2 Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jun 2 21:44:26 2020 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Tue Jun 2 21:44:57 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=1c846d9d
7
8 net/iw: refactor iw mode setup
9
10 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
11
12 net/iw.sh | 37 ++++++++++++++++++++-----------------
13 1 file changed, 20 insertions(+), 17 deletions(-)
14
15 diff --git a/net/iw.sh b/net/iw.sh
16 index 82b9ba9..dcdbb79 100644
17 --- a/net/iw.sh
18 +++ b/net/iw.sh
19 @@ -585,27 +585,30 @@ iw_configure()
20 [ -z "${SSID}" ] && eval SSID=\$essid_${IFVAR}
21
22 # Setup ad-hoc mode?
23 - eval x=\$mode_${IFVAR}
24 - x=${x:-managed}
25 + eval _mode=\$mode_${IFVAR}
26 + _mode=${_mode:-managed}
27
28 - if [ "${x}" = "master" ]; then
29 - eerror "Please use hostapd to make this interface an access point"
30 - return 1
31 - fi
32 -
33 - if [ "${x}" = "ad-hoc" ]; then
34 - iw_setup_adhoc
35 - return $?
36 - fi
37 -
38 - if [ "${x}" != "managed" ]; then
39 - eerror "Only managed and ad-hoc are supported"
40 - return 1
41 - fi
42 + case "${_mode}" in
43 + master)
44 + eerror "Please use hostapd to make this interface an access point"
45 + return 1
46 + ;;
47 + ad-hoc|adhoc)
48 + iw_setup_adhoc
49 + return $?
50 + ;;
51 + managed)
52 + # Fall through
53 + ;;
54 + *)
55 + eerror "Only managed and ad-hoc are supported"
56 + return 1
57 + ;;
58 + esac
59
60 # Has an SSID been forced?
61 if [ -n "${SSID}" ]; then
62 - iw_set_mode "${x}"
63 + iw_set_mode "${_mode}"
64 iw_associate && return 0
65 [ "${SSID}" = "any" ] && iw_force_preferred && return 0