#! /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: