Instead of simplified, self-written start/stop hooks for wpa-supplicant on
interfaces coming up or going down, use the more advanced hooks provided
by the debian contribution.

Since the default behavior in the debian start/stop hooks is log into syslog,
which is more reasonable for embedded devices either (usually no user interface
available), follow this behavior and enable CONFIG_DEBUG_SYSLOG.

Add a package for ifplugd action hooks, if desired and install man-pages
as well for a reasonable wpa-supplicant-doc.

Signed-off-by: Jens Rehsack <[email protected]>
---
 .../wpa-supplicant/wpa-supplicant/defconfig        |  4 +-
 .../wpa-supplicant/wpa-supplicant.sh               | 85 ----------------------
 .../wpa-supplicant/wpa-supplicant_2.5.bb           | 47 ++++++++----
 3 files changed, 36 insertions(+), 100 deletions(-)
 delete mode 100644 
meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/wpa-supplicant.sh

diff --git a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/defconfig 
b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/defconfig
index f04e398..217cf61 100644
--- a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/defconfig
+++ b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/defconfig
@@ -418,9 +418,9 @@ CONFIG_CTRL_IFACE_DBUS_NEW=y
 #CONFIG_DEBUG_FILE=y

 # Send debug messages to syslog instead of stdout
-#CONFIG_DEBUG_SYSLOG=y
+CONFIG_DEBUG_SYSLOG=y
 # Set syslog facility for debug messages
-#CONFIG_DEBUG_SYSLOG_FACILITY=LOG_DAEMON
+CONFIG_DEBUG_SYSLOG_FACILITY=LOG_DAEMON

 # Add support for sending all debug messages (regardless of debug verbosity)
 # to the Linux kernel tracing facility. This helps debug the entire stack by
diff --git 
a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/wpa-supplicant.sh 
b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/wpa-supplicant.sh
deleted file mode 100644
index 5c9e5d3..0000000
--- a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/wpa-supplicant.sh
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/bin/sh
-
-
-WPA_SUP_BIN="/usr/sbin/wpa_supplicant"
-WPA_SUP_PNAME="wpa_supplicant"
-WPA_SUP_PIDFILE="/var/run/wpa_supplicant.$IFACE.pid"
-WPA_SUP_OPTIONS="-B -P $WPA_SUP_PIDFILE -i $IFACE"
-
-VERBOSITY=0
-
-
-if [ -s "$IF_WPA_CONF" ]; then
-       WPA_SUP_CONF="-c $IF_WPA_CONF"
-else
-       exit 0
-fi
-
-if [ ! -x "$WPA_SUP_BIN" ]; then
-
-       if [ "$VERBOSITY" = "1" ]; then
-               echo "$WPA_SUP_PNAME: binaries not executable or missing from 
$WPA_SUP_BIN"
-       fi
-
-       exit 1
-fi
-
-if [ "$MODE" = "start" ] ; then
-       # driver type of interface, defaults to wext when undefined
-       if [ -s "/etc/wpa_supplicant/driver.$IFACE" ]; then
-               IF_WPA_DRIVER=$(cat "/etc/wpa_supplicant/driver.$IFACE")
-       elif [ -z "$IF_WPA_DRIVER" ]; then
-
-               if [ "$VERBOSITY" = "1" ]; then
-                       echo "$WPA_SUP_PNAME: wpa-driver not provided, using 
\"wext\""
-               fi
-
-               IF_WPA_DRIVER="wext"
-       fi
-
-       # if we have passed the criteria, start wpa_supplicant
-       if [ -n "$WPA_SUP_CONF" ]; then
-
-               if [ "$VERBOSITY" = "1" ]; then
-                       echo "$WPA_SUP_PNAME: $WPA_SUP_BIN $WPA_SUP_OPTIONS 
$WPA_SUP_CONF -D $IF_WPA_DRIVER"
-               fi
-
-               start-stop-daemon --start --quiet \
-                       --name $WPA_SUP_PNAME --startas $WPA_SUP_BIN --pidfile 
$WPA_SUP_PIDFILE \
-                       --  $WPA_SUP_OPTIONS $WPA_SUP_CONF -D $IF_WPA_DRIVER
-       fi
-
-       # if the interface socket exists, then wpa_supplicant was invoked 
successfully
-       if [ -S "$WPA_COMMON_CTRL_IFACE/$IFACE" ]; then
-
-               if [ "$VERBOSITY" = "1" ]; then
-                       echo "$WPA_SUP_PNAME: ctrl_interface socket located at 
$WPA_COMMON_CTRL_IFACE/$IFACE"
-               fi
-
-               exit 0
-
-       fi
-
-elif [ "$MODE" = "stop" ]; then
-
-       if [ -f "$WPA_SUP_PIDFILE" ]; then
-
-               if [ "$VERBOSITY" = "1" ]; then
-                       echo "$WPA_SUP_PNAME: terminating $WPA_SUP_PNAME daemon"
-               fi
-
-               start-stop-daemon --stop --quiet \
-                       --name $WPA_SUP_PNAME --pidfile $WPA_SUP_PIDFILE
-
-               if [ -S "$WPA_COMMON_CTRL_IFACE/$IFACE" ]; then
-                       rm -f $WPA_COMMON_CTRL_IFACE/$IFACE
-               fi
-
-               if [ -f "$WPA_SUP_PIDFILE" ]; then
-                       rm -f $WPA_SUP_PIDFILE
-               fi
-       fi
-
-fi
-
-exit 0
diff --git a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.5.bb 
b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.5.bb
index 935c8af..fa40c57 100644
--- a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.5.bb
+++ b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.5.bb
@@ -19,8 +19,8 @@ SYSTEMD_SERVICE_${PN} = "wpa_supplicant.service 
[email protected]
 SYSTEMD_AUTO_ENABLE = "disable"

 SRC_URI = "http://w1.fi/releases/wpa_supplicant-${PV}.tar.gz  \
+           
http://snapshot.debian.org/archive/debian/20151115T033945Z/pool/main/w/wpa/wpa_2.3-2.3.debian.tar.xz;name=wpa-debian
 \
            file://defconfig \
-           file://wpa-supplicant.sh \
            file://wpa_supplicant.conf \
            file://wpa_supplicant.conf-sane \
            file://99_wpa_supplicant \
@@ -28,11 +28,15 @@ SRC_URI = 
"http://w1.fi/releases/wpa_supplicant-${PV}.tar.gz  \
 SRC_URI[md5sum] = "96ff75c3a514f1f324560a2376f13110"
 SRC_URI[sha256sum] = 
"cce55bae483b364eae55c35ba567c279be442ed8bab5b80a3c7fb0d057b9b316"

+SRC_URI[wpa-debian.md5sum] = "38dedea3056ee103fb70c544ae1b99b8"
+SRC_URI[wpa-debian.sha256sum] = 
"aebdeda11461e93d7f37df5f45643a3fc3c203853c884d983ed4f558604f0b2f"
+
 S = "${WORKDIR}/wpa_supplicant-${PV}"

-PACKAGES_prepend = "wpa-supplicant-passphrase wpa-supplicant-cli "
+PACKAGES_prepend = "wpa-supplicant-passphrase wpa-supplicant-cli 
wpa-supplicant-ifplugd "
 FILES_wpa-supplicant-passphrase = "${bindir}/wpa_passphrase"
 FILES_wpa-supplicant-cli = "${sbindir}/wpa_cli"
+FILES_wpa-supplicant-ifplugd = "${sysconfdir}/ifplugd/action.d/ 
${sysconfdir}/wpa_supplicant/action_wpa.sh"
 FILES_${PN} += "${datadir}/dbus-1/system-services/*"
 CONFFILES_${PN} += "${sysconfdir}/wpa_supplicant.conf"

@@ -62,12 +66,16 @@ do_compile () {
        unset CFLAGS CPPFLAGS CXXFLAGS
        sed -e "s:CFLAGS\ =.*:& \$(EXTRA_CFLAGS):g" -i ${S}/src/lib.rules
        oe_runmake -C wpa_supplicant
+
+        cd "${WORKDIR}/debian"
+        sed -i -e 's,"/sbin/wpa,"/usr/sbin/wpa,g' ifupdown/functions.sh
 }

 do_install () {
        install -d ${D}${sbindir}
-       install -m 755 wpa_supplicant/wpa_supplicant ${D}${sbindir}
-       install -m 755 wpa_supplicant/wpa_cli        ${D}${sbindir}
+       install -m 755 wpa_supplicant/wpa_supplicant         ${D}${sbindir}
+       install -m 755 wpa_supplicant/wpa_cli                ${D}${sbindir}
+       install -m 755 ${WORKDIR}/debian/ifupdown/wpa_action ${D}${sbindir}

        install -d ${D}${bindir}
        install -m 755 wpa_supplicant/wpa_passphrase ${D}${bindir}
@@ -78,21 +86,34 @@ do_install () {
        install -d ${D}${sysconfdir}
        install -m 600 ${WORKDIR}/wpa_supplicant.conf-sane 
${D}${sysconfdir}/wpa_supplicant.conf

-       install -d ${D}${sysconfdir}/network/if-pre-up.d/
-       install -d ${D}${sysconfdir}/network/if-post-down.d/
-       install -d ${D}${sysconfdir}/network/if-down.d/
-       install -m 755 ${WORKDIR}/wpa-supplicant.sh 
${D}${sysconfdir}/network/if-pre-up.d/wpa-supplicant
-       cd ${D}${sysconfdir}/network/ && \
-       ln -sf ../if-pre-up.d/wpa-supplicant if-post-down.d/wpa-supplicant
+       install -d ${D}${sysconfdir}/wpa_supplicant/
+        install -m 755 ${WORKDIR}/debian/ifupdown/action_wpa.sh 
${D}${sysconfdir}/wpa_supplicant/
+        install -m 644 ${WORKDIR}/debian/ifupdown/functions.sh 
${D}${sysconfdir}/wpa_supplicant/
+        install -m 755 ${WORKDIR}/debian/ifupdown/wpasupplicant.sh 
${D}${sysconfdir}/wpa_supplicant/ifupdown.sh
+
+       for nethook in if-up.d if-pre-up.d if-post-down.d if-down.d; do
+            install -d ${D}${sysconfdir}/network/${nethook}/
+            (cd ${D}${sysconfdir}/network/ && \
+                ln -sf ../../wpa_supplicant/ifupdown.sh 
${nethook}/wpa-supplicant)
+        done
+
+       install -d ${D}${sysconfdir}/ifplugd/action.d/
+        (cd ${D}${sysconfdir}/ifplugd/action.d/ && ln -sf 
../../wpa_supplicant/action_wpa.sh action_wpa)
+
+        install -d ${D}${mandir}/man5 ${D}${mandir}/man8
+        install -m 0644 wpa_supplicant/doc/docbook/wpa_supplicant.conf.5 
${D}${mandir}/man5/
+        install -m 0644 wpa_supplicant/doc/docbook/wpa_passphrase.8 
wpa_supplicant/doc/docbook/wpa_supplicant.8 \
+            wpa_supplicant/doc/docbook/wpa_cli.8 
${WORKDIR}/debian/ifupdown/wpa_action.8 \
+            ${D}${mandir}/man8/

        install -d ${D}/${sysconfdir}/dbus-1/system.d
-       install -m 644 ${S}/wpa_supplicant/dbus/dbus-wpa_supplicant.conf 
${D}/${sysconfdir}/dbus-1/system.d
+       install -m 644 wpa_supplicant/dbus/dbus-wpa_supplicant.conf 
${D}/${sysconfdir}/dbus-1/system.d
        install -d ${D}/${datadir}/dbus-1/system-services
-       install -m 644 ${S}/wpa_supplicant/dbus/*.service 
${D}/${datadir}/dbus-1/system-services
+       install -m 644 wpa_supplicant/dbus/*.service 
${D}/${datadir}/dbus-1/system-services

        if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; 
then
                install -d ${D}/${systemd_unitdir}/system
-               install -m 644 ${S}/wpa_supplicant/systemd/*.service 
${D}/${systemd_unitdir}/system
+               install -m 644 wpa_supplicant/systemd/*.service 
${D}/${systemd_unitdir}/system
        fi

        install -d ${D}/etc/default/volatiles
--
2.6.3


--
Jens Rehsack - [email protected]

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to