summaryrefslogtreecommitdiffstats
path: root/src/lib/auto.action
blob: 3ea13730d8ab9d16636c907059894096543dde50 (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
#! /bin/bash

. /usr/lib/network/globals
. "$SUBR_DIR/ip"

export INTERFACE="$1"
export SSID="$2"
# Expose the profile name similar to ordinary netctl usage
Profile="$3"
export ACTION="$4"

load_profile "$Profile"

case $ACTION in
  CONNECT)
    DhcpcdOptions+=" -K"
    ip_set || exit 1
    # JP: sandbox the eval
    if ! ( eval $ExecUpPost ); then
        # Failing ExecUpPost will take the connection down
        netctl-auto stop "$INTERFACE"
        exit 1
    fi
  ;;
  DISCONNECT)
    # JP: sandbox the eval
    if ! ( eval $ExecDownPre ); then
        exit 1
    fi
    ip_unset
  ;;
  LOST|REESTABLISHED)
    # Not handled.
    exit 0
  ;;
  *)
    # ???
    exit 1
  ;;
esac


# vim: ft=sh ts=4 et sw=4: