From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-1175580-garchives=archives.gentoo.org@lists.gentoo.org> 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 E33C613835B for <garchives@archives.gentoo.org>; Sun, 31 May 2020 05:29:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B4E29E0880; Sun, 31 May 2020 05:29:58 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 775FAE0880 for <gentoo-commits@lists.gentoo.org>; Sun, 31 May 2020 05:29:58 +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 046D034F01B for <gentoo-commits@lists.gentoo.org>; Sun, 31 May 2020 05:29:57 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 9B9D226E for <gentoo-commits@lists.gentoo.org>; Sun, 31 May 2020 05:29:54 +0000 (UTC) From: "Robin H. Johnson" <robbat2@gentoo.org> 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" <robbat2@gentoo.org> Message-ID: <1590902976.c0f36e9995b6e07b6691fa0c2d5c3a13223f9815.robbat2@OpenRC> Subject: [gentoo-commits] proj/netifrc:master commit in: net/ X-VCS-Repository: proj/netifrc X-VCS-Files: net/iwd.sh X-VCS-Directories: net/ X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: c0f36e9995b6e07b6691fa0c2d5c3a13223f9815 X-VCS-Branch: master Date: Sun, 31 May 2020 05:29:54 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: f7895a26-4b2a-4993-8394-bab883982313 X-Archives-Hash: ee92662b2caa3bd31ecd2d516b1da647 commit: c0f36e9995b6e07b6691fa0c2d5c3a13223f9815 Author: Hans Fernhout <hfern <AT> fernhout <DOT> info> AuthorDate: Sun May 31 05:27:16 2020 +0000 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> CommitDate: Sun May 31 05:29:36 2020 +0000 URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=c0f36e99 net/iwd: add iwd helper Bug: https://bugs.gentoo.org/690808 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> net/iwd.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/net/iwd.sh b/net/iwd.sh new file mode 100644 index 0000000..afb5b22 --- /dev/null +++ b/net/iwd.sh @@ -0,0 +1,53 @@ +# Original copyright (c) 2007-2009 Roy Marples <roy@marples.name> +# Released under the 2-clause BSD license. + +iwd_depend() +{ + need dbus + after macnet plug + before interface + provide wireless + after iwconfig +} + +_config_vars="$_config_vars iwd" + +iwd_pre_start() +{ + local iwds=/usr/libexec/iwd + local args= opt= opts= + eval opts=\$iwd_${IFVAR} + + #set a "safe" default in case phy was not defined + PHY="phy0" + + for opt in ${opts}; do + case "${opt}" in + phy* ) PHY="${opt}" + einfo "Assigned PHY to be ${PHY}" + ;; + * ) ;; + esac + done + ebegin "Starting iwd on ${PHY} and ${IFVAR}" + pidfile="/run/iwd-${IFVAR}.pid" + start-stop-daemon --start --exec "${iwds}" --pidfile "${pidfile}" --background --verbose --make-pidfile -- -p ${PHY} -i "${IFVAR}" + return $? +} + + +iwd_post_stop() +{ + local iwds=/usr/libexec/iwd + pidfile="/run/iwd-${IFVAR}.pid" + if [ -f ${pidfile} ]; then + ebegin "Stopping iwd on ${IFACE}" + start-stop-daemon --stop --exec "${iwds}" --pidfile "${pidfile}" + eend $? + fi + + # If iwd exits uncleanly, we need to remove the stale dir + [ -S "/run/iwd/${IFACE}" ] \ + && rm -f "/run/iwd/${IFACE}" +} +