2ac369ed8f
Fork from Alpine to apply Martijn's patch: https://github.com/alpinelinux/aports/pull/9894 "This makes wpa_supplicant run in dbus mode if no config file has been created for it, fixing the networkmanager integration. This config has been used for a long time in postmarketOS and works fine. It also removes the iwd dependency from networkmanager again so wpa_supplicant is used because iwd doesn't support as many chipsets as wpa_supplicant and it doesn't run on older kernels." [ci:skip-build]: already built successfully in CI for x86_64, I've tested that it builds for armhf and aarch64 too.
40 lines
915 B
Bash
40 lines
915 B
Bash
#!/bin/sh
|
|
# Script for using udhcpc (started by ifup) with wpa_supplicant.
|
|
#
|
|
# Distributed under the same license as wpa_supplicant itself.
|
|
# Copyright (c) 2015,2018 Sören Tempel <soeren+alpine@soeren-tempel.net>
|
|
|
|
if [ $# -ne 2 ]; then
|
|
logger -t wpa_cli "this script should be called from wpa_cli(8)"
|
|
exit 1
|
|
fi
|
|
|
|
IFNAME="${1}"
|
|
ACTION="${2}"
|
|
SIGNAL=""
|
|
DHCPID=""
|
|
|
|
# PID file created by the busybox ifup applet for udhcpc.
|
|
DHCPIDFILE="/var/run/udhcpc.${IFNAME}.pid"
|
|
|
|
if [ ! -e "${DHCPIDFILE}" ]; then
|
|
logger -t wpa_cli "udhcpc isn't running for interface '${IFNAME}'"
|
|
exit 1
|
|
fi
|
|
|
|
logger -t wpa_cli "interface ${IFNAME} ${ACTION}"
|
|
case "${ACTION}" in
|
|
CONNECTED)
|
|
SIGNAL="USR1"
|
|
;;
|
|
DISCONNECTED)
|
|
SIGNAL="USR2"
|
|
;;
|
|
*)
|
|
logger -t wpa_cli "unknown action '${ACTION}'"
|
|
exit 1
|
|
esac
|
|
|
|
read -r DHCPID < "${DHCPIDFILE}"
|
|
kill -${SIGNAL} "${DHCPID}" || logger -t wpa_cli \
|
|
"Couldn't send '${SIGNAL}' to '${DHCPID}'"
|