From bc7466b28af94327fa01ab9f2c375696f17f3f33 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Wed, 1 Jul 2020 11:47:40 +0200 Subject: [PATCH] base-files: add support for wifi config hooks This new feature allows adding hooks that will be called after a new wireless config is added to uci. Signed-off-by: John Crispin --- package/base-files/files/sbin/wifi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/package/base-files/files/sbin/wifi b/package/base-files/files/sbin/wifi index f7a10de215..8e644cf1a2 100755 --- a/package/base-files/files/sbin/wifi +++ b/package/base-files/files/sbin/wifi @@ -161,6 +161,11 @@ wifi_config() { echo "$driver: Hardware detection not supported" >&2 fi ); done + for hook in $HOOKS; do ( + if eval "type run_$hook" 2>/dev/null >/dev/null; then + eval "run_$hook" || echo "$hook: Hook failed" >&2 + fi + ); done } start_net() {( @@ -230,6 +235,7 @@ scan_wifi() { DEVICES= DRIVERS= +HOOKS= include /lib/wifi scan_wifi -- 2.25.1