[OE-core] [PATCH v2] wpa-supplicant.sh: updated to modern init script format, refactoring, and new restart functionality
Andrew Wichmann
awichmann at emacinc.com
Mon Feb 29 18:27:35 UTC 2016
Fixed a bug in the original commit where restart exited success without starting the daemon.
Now both start and stop call check_socket to verify the socket was added/removed, and success is
returned at the end of the script instead of in the body.
Signed-off-by: Andrew Wichmann <awichmann at emacinc.com>
---
.../wpa-supplicant/wpa-supplicant.sh | 26 +++++++++++++++-------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/wpa-supplicant.sh b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/wpa-supplicant.sh
index 3623cbe..e8ca51b 100644
--- a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/wpa-supplicant.sh
+++ b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/wpa-supplicant.sh
@@ -50,7 +50,7 @@ start() {
--name $WPA_SUP_PNAME --startas $WPA_SUP_BIN --pidfile $WPA_SUP_PIDFILE \
-- $WPA_SUP_OPTIONS $WPA_SUP_CONF -D $IF_WPA_DRIVER
fi
- check_socket
+ check_socket "start"
}
stop() {
@@ -69,16 +69,26 @@ stop() {
rm -f $WPA_SUP_PIDFILE
fi
fi
- exit 0
+ check_socket "stop"
}
check_socket(){
- # if the interface socket exists, then wpa_supplicant was invoked successfully
- if [ -S "$WPA_COMMON_CTRL_IFACE/$IFACE" ]
- then
- [ "$VERBOSE" = "yes" ] && echo "$WPA_SUP_PNAME: ctrl_interface socket located at$WPA_COMMON_CTRL_IFACE/$IFACE"
- exit 0
+ if [ $1 = "start" ]; then
+ # if the interface socket exists, then wpa_supplicant start was invoked successfully
+ if [ -S "$WPA_COMMON_CTRL_IFACE/$IFACE" ]; then
+ [ "$VERBOSE" = "yes" ] && echo "$WPA_SUP_PNAME: ctrl_interface socket located at$WPA_COMMON_CTRL_IFACE/$IFACE"
+ return
+ fi
+
+ else if [$1 = "stop" ]; then
+ # if the interface socket does not exists, then wpa_supplicant stop was invoked successfully
+ if [ ! -S "$WPA_COMMON_CTRL_IFACE/$IFACE" ];then
+ [ "$VERBOSE" = "yes" ] && echo "$WPA_SUP_PNAME: ctrl_interface socket was removed"
+ return
+ fi
fi
+
+ # if the program reaches this line, then wpa_supplicant was invoked incorrectly
exit 1
}
@@ -99,4 +109,4 @@ case "$1" in
esac
-exit 1
+exit 0
--
1.9.1
More information about the Openembedded-core
mailing list