diff options
author | David P <megver83@parabola.nu> | 2022-07-17 19:17:52 -0400 |
---|---|---|
committer | David P <megver83@parabola.nu> | 2022-07-17 19:17:52 -0400 |
commit | 9fea9c0f08f1efd2c74ba5f667e36ff0835527b9 (patch) | |
tree | 8351419b71559b57344a7b287897a600f1b35816 | |
parent | 959f029eea0b95b133cd9dfd0a7f40f78253da1e (diff) | |
download | abslibre-9fea9c0f08f1efd2c74ba5f667e36ff0835527b9.tar.gz abslibre-9fea9c0f08f1efd2c74ba5f667e36ff0835527b9.tar.bz2 abslibre-9fea9c0f08f1efd2c74ba5f667e36ff0835527b9.zip |
addpkg: nonsystemd/wpa_supplicant-openrc 20210505-1
Signed-off-by: David P <megver83@parabola.nu>
-rw-r--r-- | nonsystemd/wpa_supplicant-openrc/PKGBUILD | 29 | ||||
-rw-r--r-- | nonsystemd/wpa_supplicant-openrc/wpa_cli.sh | 46 | ||||
-rw-r--r-- | nonsystemd/wpa_supplicant-openrc/wpa_supplicant.confd | 10 | ||||
-rw-r--r-- | nonsystemd/wpa_supplicant-openrc/wpa_supplicant.initd | 70 |
4 files changed, 155 insertions, 0 deletions
diff --git a/nonsystemd/wpa_supplicant-openrc/PKGBUILD b/nonsystemd/wpa_supplicant-openrc/PKGBUILD new file mode 100644 index 000000000..042de615c --- /dev/null +++ b/nonsystemd/wpa_supplicant-openrc/PKGBUILD @@ -0,0 +1,29 @@ +# Maintainer: artoo <artoo@artixlinux.org> + +pkgname=wpa_supplicant-openrc +pkgver=20210505 +pkgrel=1 +pkgdesc="OpenRC wpa_supplicant init script" +arch=('any') +url="https://gitea.artixlinux.org/artixlinux/packages-openrc" +license=('GPL2') +groups=('openrc-system') +provides=('init-wpa_supplicant') +depends=('openrc' 'wpa_supplicant') +conflicts=('init-wpa_supplicant') +backup=('etc/conf.d/wpa_supplicant') +source=("wpa_supplicant.confd" + "wpa_supplicant.initd" + "wpa_cli.sh") +sha256sums=('27833f60a091464612e74e6171cc98c3e3f994e2fde0ccc4535dd0d84ed041fa' + '7789b54cabb7317d9368531f4832ae7b256e26ce0e5ac7ab8d0a251ade18342a' + '300d0b54280c2582e74f78087edad3b0da19b9e4e0440f7f320f523a46da8373') + +package() { + install -Dm755 "${srcdir}"/wpa_supplicant.initd "${pkgdir}"/etc/init.d/wpa_supplicant + install -Dm644 "${srcdir}"/wpa_supplicant.confd "${pkgdir}"/etc/conf.d/wpa_supplicant + + install -Dm755 "${srcdir}"/wpa_cli.sh "${pkgdir}"/etc/wpa_supplicant/wpa_cli.sh +} + + diff --git a/nonsystemd/wpa_supplicant-openrc/wpa_cli.sh b/nonsystemd/wpa_supplicant-openrc/wpa_cli.sh new file mode 100644 index 000000000..a60a13c4f --- /dev/null +++ b/nonsystemd/wpa_supplicant-openrc/wpa_cli.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# Copyright 1999-2011 Gentoo Foundation +# Written by Roy Marples <uberlord@gentoo.org> +# Distributed under the terms of the GNU General Public License v2 +# Alternatively, this file may be distributed under the terms of the BSD License + +if [ -z "$1" -o -z "$2" ]; then + logger -t wpa_cli "Insufficient parameters" + exit 1 +fi + +INTERFACE="$1" +ACTION="$2" + +# Note, the below action must NOT mark the interface down via ifconfig, ip or +# similar. Addresses can be removed, changed and daemons can be stopped, but +# the interface must remain up for wpa_supplicant to work. + +if [ -f /etc/parabola-release ]; then + EXEC="/etc/init.d/net.${INTERFACE} --quiet" +else + logger -t wpa_cli "I don't know what to do with this distro!" + exit 1 +fi + +case ${ACTION} in + CONNECTED) + EXEC="${EXEC} start" + ;; + DISCONNECTED) + # Deactivated, since stopping /etc/init.d/net.wlanX + # stops the network completly. + EXEC="false ${EXEC} stop" + ;; + *) + logger -t wpa_cli "Unknown action ${ACTION}" + exit 1 + ;; +esac + +# ${EXEC} can use ${IN_BACKGROUND} so that it knows that the user isn't +# stopping the interface and a background process - like wpa_cli - is. +export IN_BACKGROUND=true + +logger -t wpa_cli "interface ${INTERFACE} ${ACTION}" +${EXEC} || logger -t wpa_cli "executing '${EXEC}' failed" diff --git a/nonsystemd/wpa_supplicant-openrc/wpa_supplicant.confd b/nonsystemd/wpa_supplicant-openrc/wpa_supplicant.confd new file mode 100644 index 000000000..5381c8c74 --- /dev/null +++ b/nonsystemd/wpa_supplicant-openrc/wpa_supplicant.confd @@ -0,0 +1,10 @@ +# conf.d file for wpa_supplicant + +# uncomment this if wpa_supplicant starts up before your network interface +# is ready and it causes issues +# rc_want="dev-settle" + +# Please check man 8 wpa_supplicant for more information about the options +# wpa_supplicant accepts. +# +wpa_supplicant_args="" diff --git a/nonsystemd/wpa_supplicant-openrc/wpa_supplicant.initd b/nonsystemd/wpa_supplicant-openrc/wpa_supplicant.initd new file mode 100644 index 000000000..1e107c6c6 --- /dev/null +++ b/nonsystemd/wpa_supplicant-openrc/wpa_supplicant.initd @@ -0,0 +1,70 @@ +#!/usr/bin/openrc-run +# Copyright (c) 2009 Roy Marples <roy@marples.name> +# All rights reserved. Released under the 2-clause BSD license. + +command=/usr/bin/wpa_supplicant +: ${wpa_supplicant_conf:=/etc/wpa_supplicant/wpa_supplicant.conf} +wpa_supplicant_if=${wpa_supplicant_if:+-i}$wpa_supplicant_if +command_args="$wpa_supplicant_args -B -c$wpa_supplicant_conf $wpa_supplicant_if" +name="WPA Supplicant Daemon" + +depend() +{ + need localmount + use logger + after bootmisc modules + before dns dhcpcd net + keyword -shutdown +} + +find_wireless() +{ + local iface= + + case "$RC_UNAME" in + Linux) + for iface in /sys/class/net/*; do + if [ -e "$iface"/wireless -o \ + -e "$iface"/phy80211 ] + then + echo "${iface##*/}" + return 0 + fi + done + ;; + *) + for iface in /dev/net/* $(ifconfig -l 2>/dev/null); do + if ifconfig "${iface##*/}" 2>/dev/null | \ + grep -q "[ ]*ssid " + then + echo "${iface##*/}" + return 0 + fi + done + ;; + esac + + return 1 +} + +append_wireless() +{ + local iface= i= + + iface=$(find_wireless) + if [ -n "$iface" ]; then + for i in $iface; do + command_args="$command_args -i$i" + done + else + eerror "Could not find a wireless interface" + fi +} + +start_pre() +{ + case " $command_args" in + *" -i"*) ;; + *) append_wireless;; + esac +} |