From owner-svn-ports-head@freebsd.org Mon Jun 17 20:15:42 2019 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4CAC815C3769; Mon, 17 Jun 2019 20:15:42 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E3D3A80C35; Mon, 17 Jun 2019 20:15:41 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BDC342A3D; Mon, 17 Jun 2019 20:15:41 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5HKFfjV006533; Mon, 17 Jun 2019 20:15:41 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5HKFfSu006529; Mon, 17 Jun 2019 20:15:41 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201906172015.x5HKFfSu006529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 17 Jun 2019 20:15:41 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r504433 - in head: net/hostapd net/hostapd/files security/wpa_supplicant security/wpa_supplicant/files X-SVN-Group: ports-head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in head: net/hostapd net/hostapd/files security/wpa_supplicant security/wpa_supplicant/files X-SVN-Commit-Revision: 504433 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E3D3A80C35 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.946,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Jun 2019 20:15:42 -0000 Author: cy Date: Mon Jun 17 20:15:40 2019 New Revision: 504433 URL: https://svnweb.freebsd.org/changeset/ports/504433 Log: 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 Added: head/net/hostapd/files/hostapd.in (contents, props changed) head/security/wpa_supplicant/files/wpa_supplicant.in (contents, props changed) Modified: head/net/hostapd/Makefile (contents, props changed) head/security/wpa_supplicant/Makefile (contents, props changed) Modified: head/net/hostapd/Makefile ============================================================================== --- head/net/hostapd/Makefile Mon Jun 17 19:05:16 2019 (r504432) +++ head/net/hostapd/Makefile Mon Jun 17 20:15:40 2019 (r504433) @@ -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) " $$<|' \ Added: head/net/hostapd/files/hostapd.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/hostapd/files/hostapd.in Mon Jun 17 20:15:40 2019 (r504433) @@ -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" Modified: head/security/wpa_supplicant/Makefile ============================================================================== --- head/security/wpa_supplicant/Makefile Mon Jun 17 19:05:16 2019 (r504432) +++ head/security/wpa_supplicant/Makefile Mon Jun 17 20:15:40 2019 (r504433) @@ -26,6 +26,10 @@ PORTDOCS= README ChangeLog CFG= ${BUILD_WRKSRC}/.config +.if !exists(/etc/rc.d/wpa_supplicant) +USE_RC_SUBR= wpa_supplicant +.endif + OPTIONS_MULTI= DRV EAP OPTIONS_MULTI_DRV= BSD WIRED NDIS TEST NONE #ROBOSWITCH OPTIONS_MULTI_EAP= TLS PEAP TTLS MD5 MSCHAPV2 GTC LEAP OTP PSK FAST \ Added: head/security/wpa_supplicant/files/wpa_supplicant.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/security/wpa_supplicant/files/wpa_supplicant.in Mon Jun 17 20:15:40 2019 (r504433) @@ -0,0 +1,57 @@ +#!/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"