summaryrefslogtreecommitdiffstats
path: root/usr/lib/autowifi/lib/core
diff options
context:
space:
mode:
Diffstat (limited to 'usr/lib/autowifi/lib/core')
-rw-r--r--usr/lib/autowifi/lib/core20
1 files changed, 20 insertions, 0 deletions
diff --git a/usr/lib/autowifi/lib/core b/usr/lib/autowifi/lib/core
new file mode 100644
index 00000000..80ae75b4
--- /dev/null
+++ b/usr/lib/autowifi/lib/core
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+exists() { type "$1" >/dev/null 2>/dev/null; }
+
+run_hooks(){
+ # (interface|profile) (pre|post)
+ typ=$1
+ action=$2
+ shift;shift
+ : ${interface?please provide interface}
+ if [ "$typ" = "interface" ];then
+ path=interface/$interface/$action
+ else
+ path=profile/$2/$action
+ fi
+ for hook in $(find "$root/etc/autowifi/hooks/$path" -type f 2>/dev/null | sort -u ); do
+ $hook "$@"
+ done
+}
+