aboutsummaryrefslogtreecommitdiff
path: root/net/hostapd
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2019-06-17 20:15:40 +0000
committerCy Schubert <cy@FreeBSD.org>2019-06-17 20:15:40 +0000
commit339ec4eee2c3a702100e318fc407a7159b98935c (patch)
tree8b3f262a1efb6ab0fb335957ad2a4652d68c85e9 /net/hostapd
parentb5b53ac82164a085f55c2af429025c7989da327f (diff)
downloadports-339ec4eee2c3a702100e318fc407a7159b98935c.tar.gz
ports-339ec4eee2c3a702100e318fc407a7159b98935c.zip
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
Notes
Notes: svn path=/head/; revision=504433
Diffstat (limited to 'net/hostapd')
-rw-r--r--net/hostapd/Makefile3
-rw-r--r--net/hostapd/files/hostapd.in42
2 files changed, 45 insertions, 0 deletions
diff --git a/net/hostapd/Makefile b/net/hostapd/Makefile
index d0d5bd8efc4b..e8f77aba91fe 100644
--- a/net/hostapd/Makefile
+++ b/net/hostapd/Makefile
@@ -21,6 +21,9 @@ LDFLAGS+= -L${OPENSSLLIB}
PLIST_FILES= sbin/hostapd sbin/hostapd_cli man/man1/hostapd_cli.1.gz \
man/man8/hostapd.8.gz
+.if !exists(/etc/rc.d/hostapd)
+USE_RC_SUBR= hostapd
+.endif
post-patch:
@${REINPLACE_CMD} -e 's|@$$(E) " CC " $$<|@$$(E) " $$(CC) " $$<|' \
diff --git a/net/hostapd/files/hostapd.in b/net/hostapd/files/hostapd.in
new file mode 100644
index 000000000000..aee0f6f80809
--- /dev/null
+++ b/net/hostapd/files/hostapd.in
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: hostapd
+# REQUIRE: mountcritremote
+# KEYWORD: nojail shutdown
+
+. /etc/rc.subr
+
+name="hostapd"
+desc="Authenticator for IEEE 802.11 networks"
+#
+# This portion of this rc.script is different from base.
+case ${command} in
+/usr/sbin/hostapd) # 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=${hostapd_program:-%%PREFIX%%/sbin/hostapd}
+# End of differences from base. The rest of the file should remain the same.
+
+ifn="$2"
+if [ -z "$ifn" ]; then
+ rcvar="hostapd_enable"
+ conf_file="/etc/${name}.conf"
+ pidfile="/var/run/${name}.pid"
+else
+ rcvar=
+ conf_file="/etc/${name}-${ifn}.conf"
+ pidfile="/var/run/${name}-${ifn}.pid"
+fi
+
+command_args="-P ${pidfile} -B ${conf_file}"
+required_files="${conf_file}"
+required_modules="wlan_xauth wlan_wep wlan_tkip wlan_ccmp"
+extra_commands="reload"
+
+load_rc_config ${name}
+run_rc_command "$1"