ports/security/wpa_supplicant/files/wpa_supplicant.in
Cy Schubert 339ec4eee2 For users who build and install FreeBSD using WITHOUT_WIRELESS
simply altering /etc/rc.conf isn't enough to make use of the ports
versions of hostapd and wpa_supplicant. This is because the rc.d
scripts are not installed when WITHOUT_WIRELESS is specified as a
build option. This patch checks for the rc scripts existence and
if they do not exist, installs the ports versions of the same
scripts, which are added by this revision.

This patch does not change the package in any way and there is no way
to enable this outside of removal of hostapd or wpa_supplicant
(depending on the port). Users who build their own world using the
WITHOUT_WIRELESS flag will almost always not use binary packages. Hence
the automatic detection and install of the rc scripts. Making this an
option would IMO increase the number of bug reports due to people
inadvertently setting or not setting an option.

To enable this a person must:

1. buildworld and installworld -DWITHOUT_WIRELESS
2. Build and install the desired wpa_supplicant and/or hostapd port
   on servers one wishes to install them on.

PR:		238571
2019-06-17 20:15:40 +00:00

57 lines
1.2 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: wpa_supplicant
# REQUIRE: mountcritremote
# KEYWORD: nojail nostart
. /etc/rc.subr
. /etc/network.subr
name="wpa_supplicant"
desc="WPA/802.11i Supplicant for wireless network devices"
rcvar=
ifn="$2"
if [ -z "$ifn" ]; then
return 1
fi
is_ndis_interface()
{
case `sysctl -n net.wlan.${1#wlan}.%parent 2>/dev/null` in
ndis*) true ;;
*) false ;;
esac
}
if is_wired_interface ${ifn} ; then
driver="wired"
elif is_ndis_interface ${ifn} ; then
driver="ndis"
else
driver="bsd"
fi
load_rc_config $name
#
# This portion of this rc.script is different from base.
case ${command} in
/usr/sbin/wpa_supplicant) # Assume user does not want base hostapd because
# user specified WITHOUT_WIRELESS in make.conf
# and /etc/defaults/rc.conf contains this value.
unset command;;
esac
command=${wpa_supplicant_program:-%%PREFIX%%/sbin/wpa_supplicant}
# End of differences from base. The rest of the file should remain the same.
conf_file=${wpa_supplicant_conf_file}
pidfile="/var/run/${name}/${ifn}.pid"
command_args="-B -i $ifn -c $conf_file -D $driver -P $pidfile"
required_files=$conf_file
required_modules="wlan_wep wlan_tkip wlan_ccmp"
run_rc_command "$1"