1#!/bin/sh 2# 3# $FreeBSD: src/etc/rc.d/wpa_supplicant,v 1.2 2005/10/19 22:26:47 jkim Exp $ 4# $DragonFly: src/etc/rc.d/wpa_supplicant,v 1.2 2008/07/07 00:00:56 thomas Exp $ 5# 6 7# PROVIDE: wpa_supplicant 8# REQUIRE: mountcritremote 9# KEYWORD: nojail nostart 10 11. /etc/rc.subr 12. /etc/network.subr 13 14name="wpa_supplicant" 15rcvar= 16command="/usr/sbin/${name}" 17conf_file="/etc/wpa_supplicant.conf" 18 19start_precmd="wpa_supplicant_precmd" 20wpa_supplicant_precmd() 21{ 22 ifconfig $ifn up 23} 24start_postcmd="wpa_supplicant_postcmd" 25wpa_supplicant_postcmd() 26{ 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 37case ${ifn} in 38ndis*) 39 driver="ndis" 40 ;; 41*) 42 driver="bsd" 43 ;; 44esac 45 46load_rc_config $name 47 48pid_file="/var/run/${name}/${ifn}.pid" 49command_args="-B -q -i $ifn -c $conf_file -D $driver -P $pid_file" 50required_files=$conf_file 51 52run_rc_command "$1" 53