xref: /dragonfly/etc/rc.d/wpa_supplicant (revision c93b565c)
1#!/bin/sh
2#
3# $FreeBSD: src/etc/rc.d/wpa_supplicant,v 1.2 2005/10/19 22:26:47 jkim Exp $
4#
5
6# PROVIDE: wpa_supplicant
7# REQUIRE: mountcritremote
8# KEYWORD: nojail nostart
9
10. /etc/rc.subr
11. /etc/network.subr
12
13name="wpa_supplicant"
14rcvar=
15command="/usr/sbin/${name}"
16conf_file="/etc/wpa_supplicant.conf"
17
18start_precmd="wpa_supplicant_precmd"
19wpa_supplicant_precmd()
20{
21	ifconfig $ifn up
22}
23start_postcmd="wpa_supplicant_postcmd"
24wpa_supplicant_postcmd()
25{
26# don't wait for wpa_supplicant to associate
27#	while ! ifconfig $ifn | grep -qw "status: associated"; do
28#		sleep 1
29#	done
30}
31
32ifn="$2"
33if [ -z "$ifn" ]; then
34	return 1
35fi
36
37is_ndis_interface()
38{
39	case `sysctl -n net.wlan.${1#wlan}.%parent 2>/dev/null` in
40		ndis*) true ;;
41		*) false ;;
42	esac
43}
44
45if is_ndis_interface ${ifn}; then
46	driver="ndis"
47else
48	driver="bsd"
49fi
50
51load_rc_config $name
52
53pid_file="/var/run/${name}/${ifn}.pid"
54command_args="-B -q -i $ifn -c $conf_file -D $driver -P $pid_file"
55required_files=$conf_file
56
57run_rc_command "$1"
58