rc.d/wpa_supplicant: Prefer the DPorts version for the moment
authorAaron LI <aly@aaronly.me>
Sun, 25 Nov 2018 09:39:41 +0000 (17:39 +0800)
committerAaron LI <aly@aaronly.me>
Sun, 25 Nov 2018 12:15:45 +0000 (20:15 +0800)
We now also ship the wpa_supplicant from DPorts, which has several
important security fixes than the base one, so prefer the DPorts
wpa_supplicant if it exists for the moment.

This patch allows us to bring the base wpa_supplicant up-to-date and
switch back to it later without requiring users to modify their
'/etc/rc.conf'.

etc/rc.d/wpa_supplicant

index cfa3c32..952fbc6 100644 (file)
@@ -14,13 +14,14 @@ name="wpa_supplicant"
 rcvar=
 command="/usr/sbin/wpa_supplicant"
 conf_file="/etc/wpa_supplicant.conf"
-
 start_precmd="wpa_supplicant_precmd"
+start_postcmd="wpa_supplicant_postcmd"
+
 wpa_supplicant_precmd()
 {
        ifconfig $ifn up
 }
-start_postcmd="wpa_supplicant_postcmd"
+
 wpa_supplicant_postcmd()
 {
 # don't wait for wpa_supplicant to associate
@@ -64,6 +65,13 @@ else
        driver="bsd"
 fi
 
+# For the moment, prefer the DPorts wpa_supplicant if it exists.
+# Since '/etc/defaults/rc.conf' does not set 'wpa_supplicant_program',
+# the following 'command' assignment is enough.
+if [ -x "/usr/local/sbin/wpa_supplicant" ]; then
+       command="/usr/local/sbin/wpa_supplicant"
+fi
+
 load_rc_config $name
 
 pid_file="/var/run/${name}/${ifn}.pid"