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: Sun, 31 May 2020 05:29:59
Message-Id: 1590902976.c0f36e9995b6e07b6691fa0c2d5c3a13223f9815.robbat2@OpenRC
1 commit: c0f36e9995b6e07b6691fa0c2d5c3a13223f9815
2 Author: Hans Fernhout <hfern <AT> fernhout <DOT> info>
3 AuthorDate: Sun May 31 05:27:16 2020 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Sun May 31 05:29:36 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=c0f36e99
7
8 net/iwd: add iwd helper
9
10 Bug: https://bugs.gentoo.org/690808
11 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
12
13 net/iwd.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
14 1 file changed, 53 insertions(+)
15
16 diff --git a/net/iwd.sh b/net/iwd.sh
17 new file mode 100644
18 index 0000000..afb5b22
19 --- /dev/null
20 +++ b/net/iwd.sh
21 @@ -0,0 +1,53 @@
22 +# Original copyright (c) 2007-2009 Roy Marples <roy@×××××××.name>
23 +# Released under the 2-clause BSD license.
24 +
25 +iwd_depend()
26 +{
27 + need dbus
28 + after macnet plug
29 + before interface
30 + provide wireless
31 + after iwconfig
32 +}
33 +
34 +_config_vars="$_config_vars iwd"
35 +
36 +iwd_pre_start()
37 +{
38 + local iwds=/usr/libexec/iwd
39 + local args= opt= opts=
40 + eval opts=\$iwd_${IFVAR}
41 +
42 + #set a "safe" default in case phy was not defined
43 + PHY="phy0"
44 +
45 + for opt in ${opts}; do
46 + case "${opt}" in
47 + phy* ) PHY="${opt}"
48 + einfo "Assigned PHY to be ${PHY}"
49 + ;;
50 + * ) ;;
51 + esac
52 + done
53 + ebegin "Starting iwd on ${PHY} and ${IFVAR}"
54 + pidfile="/run/iwd-${IFVAR}.pid"
55 + start-stop-daemon --start --exec "${iwds}" --pidfile "${pidfile}" --background --verbose --make-pidfile -- -p ${PHY} -i "${IFVAR}"
56 + return $?
57 +}
58 +
59 +
60 +iwd_post_stop()
61 +{
62 + local iwds=/usr/libexec/iwd
63 + pidfile="/run/iwd-${IFVAR}.pid"
64 + if [ -f ${pidfile} ]; then
65 + ebegin "Stopping iwd on ${IFACE}"
66 + start-stop-daemon --stop --exec "${iwds}" --pidfile "${pidfile}"
67 + eend $?
68 + fi
69 +
70 + # If iwd exits uncleanly, we need to remove the stale dir
71 + [ -S "/run/iwd/${IFACE}" ] \
72 + && rm -f "/run/iwd/${IFACE}"
73 +}
74 +