blob: ae49384a4e3437d2ed1d5e31e86725eb47e11c07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#! /bin/bash
. /usr/lib/network/globals
. "$SUBR_DIR/ip"
interface="$1"
ssid="$2"
profile="$3"
action="$4"
PROFILE_FILE="$STATE_DIR/wpa_actiond_$interface.profile"
# Is it possible that we don't get a profile?!
[[ "$profile" ]] && load_profile "$profile"
case $action in
CONNECT)
if [[ -z $profile ]]; then
if [[ -x "$PROFILE_DIR/interfaces/$interface" ]]; then
source "$PROFILE_DIR/interfaces/$interface"
fi
dhcpcd -qL -t "${TimeoutDHCP:-10}" $DHCPOptions -K "$interface"
exit $?
fi
DHCPOptions+=" -K"
ip_set || exit 1
mkdir -p "$(dirname "$PROFILE_FILE")"
printf "%s" "$profile" > "$PROFILE_FILE"
# JP: sandbox the eval
if ! ( eval $ExecUpPost ); then
# Failing ExecUpPost will take the connection down
netctl-auto stop "$interface"
exit 1
fi
;;
DISCONNECT)
if [[ -z $profile ]]; then
dhcpcd -k "$interface"
exit $?
fi
# JP: sandbox the eval
if ! ( eval $ExecDownPre ); then
exit 1
fi
ip_unset && rm -f "$PROFILE_FILE"
;;
LOST|REESTABLISHED)
# Not handled.
exit 0
;;
*)
# ???
exit 1
;;
esac
# vim: ft=sh ts=4 et sw=4:
|