From df2c2b5c04393ed72c2798407f50f99a6298b673 Mon Sep 17 00:00:00 2001 From: James Rayner Date: Sun, 27 Sep 2009 23:45:41 +1000 Subject: Rename autowifi->wpa_actiond, add makefile, bugfix --- wpa_actiond/netcfg-wpa_actiond-action | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 wpa_actiond/netcfg-wpa_actiond-action (limited to 'wpa_actiond/netcfg-wpa_actiond-action') diff --git a/wpa_actiond/netcfg-wpa_actiond-action b/wpa_actiond/netcfg-wpa_actiond-action new file mode 100755 index 0000000..f273b3b --- /dev/null +++ b/wpa_actiond/netcfg-wpa_actiond-action @@ -0,0 +1,54 @@ +#! /bin/bash + +interface=$1 +ssid=$2 +profile=$3 +action=$4 + +. /usr/lib/network/network +[[ $profile ]] && load_profile "$profile" + +case $action in + CONNECT) + if [[ -z $profile ]]; then + dhcpcd $interface + exit $? + fi + if ! $CONN_DIR/ethernet up "$profile"; then + exit 1 # what to do if fail? + fi + + set_profile up "$profile" + + if ! ( eval $POST_UP ); then # JP: sandbox the eval + # failing POST_UP will take interface down + "$CONN_DIR/$ethernet" down "$profile" + exit 1 + fi + ;; + DISCONNECT) + if [[ -z $profile ]]; then + dhcpcd -k $interface + exit $? + fi + if ! ( eval $PRE_DOWN ); then # JP: sandbox the eval + exit 1 + fi + if ! "$CONN_DIR/ethernet" down "$profile"; then + exit 1 + fi + if ! ( eval $POST_DOWN ); then # JP: sandbox the eval + exit 1 + fi + set_profile down "$profile" + ;; + LOST|REESTABLISHED) + # Not handled. + exit 0 + ;; + *) + # ??? + exit 1 + ;; +esac + -- cgit v1.2.3-24-g4f1b