diff options
author | James Rayner <james@archlinux.org> | 2009-09-27 15:45:41 +0200 |
---|---|---|
committer | James Rayner <james@archlinux.org> | 2009-09-27 15:45:41 +0200 |
commit | df2c2b5c04393ed72c2798407f50f99a6298b673 (patch) | |
tree | c432706c3b31ff5702217ec0d16edb4ecae11b0b /wpa_actiond/netcfg-wpa_actiond | |
parent | 818dacfa7f435e42fe1c81ae002a8df01ea80677 (diff) | |
download | netctl-df2c2b5c04393ed72c2798407f50f99a6298b673.tar.gz netctl-df2c2b5c04393ed72c2798407f50f99a6298b673.tar.xz |
Rename autowifi->wpa_actiond, add makefile, bugfix
Diffstat (limited to 'wpa_actiond/netcfg-wpa_actiond')
-rwxr-xr-x | wpa_actiond/netcfg-wpa_actiond | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/wpa_actiond/netcfg-wpa_actiond b/wpa_actiond/netcfg-wpa_actiond new file mode 100755 index 0000000..02901c6 --- /dev/null +++ b/wpa_actiond/netcfg-wpa_actiond @@ -0,0 +1,54 @@ + +. /usr/lib/network/network +. /usr/lib/network/8021x +. /usr/lib/network/wireless + +interface=$1; shift + +AUTOWIFI="/usr/sbin/wpa_actiond" +ACTION_SCRIPT="/usr/bin/netcfg-wpa_actiond-action" +PIDFILE="/var/run/wpa_supplicant_${interface}.pid" +EXTRA_AUTOWIFI_OPTIONS="$*" + +if [[ -z $interface ]]; then + echo "No interface specified" + exit 1 +fi + +# Load interface specific config +[[ -f "$IFACE_DIR/$interface" ]] && source "$IFACE_DIR/$interface" + +if [[ -n "$RFKILL" ]]; then # Enable radio if necessary + set_rf_state "$interface" up || exit $? +fi + +WPA_CONF="$(make_wpa_config_file $interface)" + +for profile in $(list_profiles); do + echo $profile + ( + load_profile $profile + + [[ $CONNECTION != "wireless" ]] && exit 1 + [[ $INTERFACE != $interface ]] && exit 1 + + config=$(make_wpa_config) + + echo -e "network={ \n$config \nid_str=\"$profile\" \n}" >> $WPA_CONF + ) +done + + +[[ -z $WPA_DRIVER ]] && WPA_DRIVER="wext" + +# Kill any existing wpa_supplicant on this interface +stop_wpa "$interface" + +if start_wpa $interface $WPA_CONF $WPA_DRIVER $WPA_OPTS; then + if $AUTOWIFI -i ${interface} -P {PIDFILE} -a ${ACTION_SCRIPT} ${EXTRA_AUTOWIFI_OPTIONS}; then + exit 0 + fi +fi + +exit 1 + |