aports

Custom Alpine Linux aports

git clone https://git.8pit.net/aports.git

 1#!/sbin/openrc-run
 2# Copyright (c) 2009 Roy Marples <roy@marples.name>
 3# All rights reserved. Released under the 2-clause BSD license.
 4supervisor=supervise-daemon
 5
 6name="WPA Supplicant"
 7description="Wi-Fi Protected Access client and IEEE 802.1X supplicant"
 8
 9command=/sbin/wpa_supplicant
10wpa_supplicant_if=${wpa_supplicant_if:+-i}$wpa_supplicant_if
11command_args="$wpa_supplicant_args $wpa_supplicant_if"
12
13default_conf=/etc/wpa_supplicant/wpa_supplicant.conf
14
15depend() {
16	need localmount
17	use logger
18	after bootmisc modules entropy udev-settle
19	before dns dhcpcd net
20	keyword -shutdown
21	provide wlan
22}
23
24find_wireless() {
25	local iface=
26	for iface in /sys/class/net/*; do
27		if [ -e "$iface"/wireless -o -e "$iface"/phy80211 ]; then
28			echo "${iface##*/}"
29			return 0
30		fi
31	done
32
33	return 1
34}
35
36append_wireless() {
37	local iface= i=
38
39	iface=$(find_wireless)
40	if [ -n "$iface" ]; then
41		for i in $iface; do
42			command_args="$command_args -i$i"
43		done
44	else
45		eerror "Could not find a wireless interface"
46	fi
47}
48
49start_pre() {
50	case " $command_args" in
51	*" -i"*) ;;
52	*) append_wireless;;
53	esac
54
55	# set default conf if dbus is explicitly disabled
56	if [ -n "${wpa_supplicant_dbus}" ] && ! yesno "${wpa_supplicant_dbus}"; then
57		: ${wpa_supplicant_conf:=${default_conf}}
58	fi
59
60	# use default conf if it exists
61	if [ -f "${default_conf}" ]; then
62		: ${wpa_supplicant_conf:=${default_conf}}
63	fi
64
65	# enable default dbus if we still dont have a config
66	if [ -z "${wpa_supplicant_conf}" ]; then
67		: ${wpa_supplicant_dbus:=yes}
68	else
69		command_args="${command_args} -c$wpa_supplicant_conf"
70	fi
71	case " ${command_args}" in
72	*" -u"*);;
73	*)	if yesno "{wpa_supplicant_dbus}"; then
74			command_args="-u ${command_args}"
75		fi
76		;;
77	esac
78
79    checkpath -d -m 0755 -o root:root /var/run/wpa_supplicant
80}