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/wpa_supplicant" 16conf_file="/etc/wpa_supplicant.conf" 17start_postcmd="wpa_supplicant_postcmd" 18 19wpa_supplicant_postcmd() 20{ 21 if [ "${command}" = "/usr/sbin/wpa_supplicant" ]; 22 then 23 cat << EOF 24 ============================================================== 25 = WARNING * SECURITY * WARNING = 26 ============================================================== 27 28The base wpa_supplicant is running. This version is several releases behind 29and is not patched for security vulnerabilities. It is highly recommended 30that the DPorts version be run instead. Instructions to switch here: 31 32http://www.dragonflybsd.org/docs/docs/newhandbook/WirelessNetwork/#index1h2 33 34EOF 35 sleep 10 36 fi 37} 38 39ifn="$2" 40if [ -z "$ifn" ]; then 41 return 1 42fi 43 44is_ndis_interface() 45{ 46 case `${SYSCTL_N} -q net.wlan.${1#wlan}.%parent` in 47 ndis*) true ;; 48 *) false ;; 49 esac 50} 51 52if is_ndis_interface ${ifn}; then 53 driver="ndis" 54else 55 driver="bsd" 56fi 57 58# For the moment, prefer the DPorts wpa_supplicant if it exists. 59# Since '/etc/defaults/rc.conf' does not set 'wpa_supplicant_program', 60# the following 'command' assignment is enough. 61if [ -x "/usr/local/sbin/wpa_supplicant" ]; then 62 command="/usr/local/sbin/wpa_supplicant" 63fi 64 65load_rc_config $name 66 67pid_file="/var/run/${name}/${ifn}.pid" 68command_args="-B -q -i $ifn -c $conf_file -D $driver -P $pid_file" 69required_files=$conf_file 70 71run_rc_command "$1" 72