summaryrefslogtreecommitdiffstats
path: root/usr/lib/autowifi/lib/core
blob: 80ae75b4cab6d3e199c0ff8c58e010b9535fe2fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
}