#!/bin/sh
#####################################################################
## Purpose
# This file is executed by ifupdown in pre-up, post-up, pre-down and
# post-down phases of network interface configuration. It allows
# ifup(

, and ifdown(

to manage wpa_supplicant(

and wpa_cli(

# processes running in daemon mode.
#
# /etc/wpa_supplicant/functions.sh is sourced by this file.
#
# This file is provided by the wpasupplicant package.
#####################################################################
# Copyright (C) 2006 - 2009 Debian/Ubuntu wpasupplicant Maintainers
# <pkg-wpa-devel@lists.alioth.debian.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# On Debian GNU/Linux systems, the text of the GPL license,
# version 2, can be found in /usr/share/common-licenses/GPL-2.
if [ -n "$IF_WPA_MAINT_DEBUG" ]; then
set -x
fi
# quit if we're called for the loopback
if [ "$IFACE" = lo ]; then
exit 0
fi
# allow wpa_supplicant interface to be specified via wpa-iface
# useful for starting wpa_supplicant on one interface of a bridge
if [ -n "$IF_WPA_IFACE" ]; then
WPA_IFACE="$IF_WPA_IFACE"
else
WPA_IFACE="$IFACE"
fi
# source functions
if [ -f /etc/wpa_supplicant/functions.sh ]; then
. /etc/wpa_supplicant/functions.sh
else
exit 0
fi
# quit if executables are not installed
if [ ! -x "$WPA_SUP_BIN" ] || [ ! -x "$WPA_CLI_BIN" ]; then
exit 0
fi
do_start () {
if test_wpa_cli; then
# if wpa_action is active for this IFACE, do nothing
ifupdown_locked && exit 0
# if the administrator is calling ifup, say something useful