Browse Source

wpa_supplicant-1:2.6-11.hyperbola7: fix init script to auto detect external USB Wi-Fi dongles

master
André Silva 6 months ago
parent
commit
64b28edfae
3 changed files with 84 additions and 59 deletions
  1. +8
    -2
      wpa_supplicant/PKGBUILD
  2. +5
    -57
      wpa_supplicant/wpa_supplicant.initd
  3. +71
    -0
      wpa_supplicant/wpa_supplicant_init.sh

+ 8
- 2
wpa_supplicant/PKGBUILD View File

@@ -2,12 +2,13 @@
# Contributor (Arch): Thomas Bächler <thomas@archlinux.org>
# Contributor (Artix): artoo <artoo@cromnix.org>
# Maintainer: André Silva <emulatorman@hyperbola.info>
# Maintainer: Márcio Silva <coadde@hyperbola.info>

pkgname=wpa_supplicant
pkgver=2.6
_debver=2.6
_debrel=4
pkgrel=11.hyperbola6
pkgrel=11.hyperbola7
epoch=1
pkgdesc='A utility providing key negotiation for WPA wireless networks, without libdbus support, with logger recommendation and with libressl, IEEE 802.11s, SAE and OpenRC support'
url='https://w1.fi/wpa_supplicant/'
@@ -25,6 +26,7 @@ source=(https://w1.fi/releases/$pkgname-$pkgver.tar.gz{,.asc}
wpa_supplicant.confd
wpa_supplicant.initd
wpa_cli.sh
wpa_supplicant_init.sh
LICENSE
0001-hostapd-Avoid-key-reinstallation-in-FT-handshake.patch
0002-Prevent-reinstallation-of-an-already-in-use-group-ke.patch
@@ -43,8 +45,9 @@ sha512sums=('46442cddb6ca043b8b08d143908f149954c238e0f3a57a0df73ca4fab9c1acd91b0
'c421f71716a799618fa0b76003e5dafb4cab36224d5b953e966a7157c9696b109182ff2d4287bbfc73dd5d66b440e6b2773963b759d08d75e332b0a09c35e213'
'cf16e99279dc406f2b1d8eb05231934b1599383fa6a06999f796f46a48ea77ac00a46674c0f23ad7d4f7650523db32a2c300781380530c17a5f5ae1552ce619d'
'29103161ec2b9631fca9e8d9a97fafd60ffac3fe78cf613b834395ddcaf8be1e253c22e060d7d9f9b974b2d7ce794caa932a2125e29f6494b75bce475f7b30e1'
'ad42cea5b8e69ed854e6c8cd4b118793bc142d4f864a018558d7ac85f77dd4434586f14f3e1f4bfd6d26e47deb4793317f8d6e96b400b9761e5fd3b7808cc9f1'
'65954b2f6c967c689435adfb507608dd373e4410b5ffeac3d8a566e6dbf383da14de8242bae0b662c22ef68b06a29845b9b63d23c2b5f34f39dd8c935ffdf1ef'
'457624a0829a873823a4b7cb4c3def9ee74811ab37c61663077e0a2b7ad9617253279972cdf085fafc1d9e39a84a8c343df595842c852e966752d69d48e5e07b'
'62fc3abf2da1fcc31b9fa2a8c20110134e7db9d91955c8fce8fa699b8bf8780d7856eeb31fefee23d6661fadd7d36270a09612db1e4d53facccd2aaaca79c4d3'
'7be494ae3c01de564caf42c7c0dfd664937d8d8b77f72994e4e7856c2b053b7fd8293967a28635939877240d60173a26a01015d3e2bb7a786626ff28a48c8ff5'
'f855fa792425f175ccc800eb49df42067b1c1f4b52ba2d24160af4dfbb74dcf8e81661b7e6c8d92fa408938b8a559fc74557d1677913e4a751bfd43706c14bb6'
'b4e413aa815572ea0002d33d24b69cd499aebb5efebed8fcaade8b29324bb5853a5db64e8b1dfdf24478e02c66196238b81a6ec777a7a28610435dce4d2c344e'
@@ -128,6 +131,9 @@ package() {
install -Dm755 "$srcdir/wpa_cli.sh" \
"$pkgdir/etc/wpa_supplicant/wpa_cli.sh"

install -Dm755 "$srcdir/wpa_supplicant_init.sh" \
"$pkgdir/usr/libexec/wpa_supplicant/wpa_supplicant_init.sh"

install -Dm644 "$srcdir/LICENSE" \
"$pkgdir/usr/share/licenses/wpa_supplicant/LICENSE"
}

+ 5
- 57
wpa_supplicant/wpa_supplicant.initd View File

@@ -3,11 +3,11 @@
# Copyright (c) 2019 Hyperbola Project
# All rights reserved. Released under the 2-clause BSD license.

command=/sbin/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"
description="wpa_supplicant service"
command=/usr/libexec/wpa_supplicant/wpa_supplicant_init.sh
command_background=yes
pidfile=/run/wpa_supplicant.pid

depend()
{
@@ -17,55 +17,3 @@ depend()
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
}

+ 71
- 0
wpa_supplicant/wpa_supplicant_init.sh View File

@@ -0,0 +1,71 @@
#!/bin/bash
# Copyright (c) 2009 Roy Marples <roy@marples.name>
# Copyright (c) 2019 Hyperbola Project
# All rights reserved. Released under the 2-clause BSD license.

. /etc/conf.d/wpa_supplicant
: ${wpa_supplicant_conf:=/etc/wpa_supplicant/wpa_supplicant.conf}
wpa_supplicant_if=${wpa_supplicant_if:+-i}$wpa_supplicant_if
command_args="-P /run/wpa_supplicant.pid $wpa_supplicant_args -B -c $wpa_supplicant_conf $wpa_supplicant_if"

find_wireless()
{
local iface=

case "$(uname -s)" in
Linux)
while true; do
for iface in /sys/class/net/*; do
if [ -e "$iface"/wireless -o \
-e "$iface"/phy80211 ]
then
echo "${iface##*/}"
return 0
fi
done
sleep 10
[ -z iface ] && continue
done
;;
*)
while true; do
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
sleep 10
[ -z iface ] && continue
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
echo "Could not find a wireless interface"
fi
}

start()
{
case " $command_args" in
*" -i"*) ;;
*) append_wireless;;
esac
}

start && wpa_supplicant $command_args &> /dev/null

Loading…
Cancel
Save