summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant-1.0/wpa-supplicant.sh
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/wpa-supplicant/wpa-supplicant-1.0/wpa-supplicant.sh')
-rw-r--r--meta/recipes-connectivity/wpa-supplicant/wpa-supplicant-1.0/wpa-supplicant.sh85
1 files changed, 85 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant-1.0/wpa-supplicant.sh b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant-1.0/wpa-supplicant.sh
new file mode 100644
index 0000000000..5c9e5d33a7
--- /dev/null
+++ b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant-1.0/wpa-supplicant.sh
@@ -0,0 +1,85 @@
1#!/bin/sh
2
3
4WPA_SUP_BIN="/usr/sbin/wpa_supplicant"
5WPA_SUP_PNAME="wpa_supplicant"
6WPA_SUP_PIDFILE="/var/run/wpa_supplicant.$IFACE.pid"
7WPA_SUP_OPTIONS="-B -P $WPA_SUP_PIDFILE -i $IFACE"
8
9VERBOSITY=0
10
11
12if [ -s "$IF_WPA_CONF" ]; then
13 WPA_SUP_CONF="-c $IF_WPA_CONF"
14else
15 exit 0
16fi
17
18if [ ! -x "$WPA_SUP_BIN" ]; then
19
20 if [ "$VERBOSITY" = "1" ]; then
21 echo "$WPA_SUP_PNAME: binaries not executable or missing from $WPA_SUP_BIN"
22 fi
23
24 exit 1
25fi
26
27if [ "$MODE" = "start" ] ; then
28 # driver type of interface, defaults to wext when undefined
29 if [ -s "/etc/wpa_supplicant/driver.$IFACE" ]; then
30 IF_WPA_DRIVER=$(cat "/etc/wpa_supplicant/driver.$IFACE")
31 elif [ -z "$IF_WPA_DRIVER" ]; then
32
33 if [ "$VERBOSITY" = "1" ]; then
34 echo "$WPA_SUP_PNAME: wpa-driver not provided, using \"wext\""
35 fi
36
37 IF_WPA_DRIVER="wext"
38 fi
39
40 # if we have passed the criteria, start wpa_supplicant
41 if [ -n "$WPA_SUP_CONF" ]; then
42
43 if [ "$VERBOSITY" = "1" ]; then
44 echo "$WPA_SUP_PNAME: $WPA_SUP_BIN $WPA_SUP_OPTIONS $WPA_SUP_CONF -D $IF_WPA_DRIVER"
45 fi
46
47 start-stop-daemon --start --quiet \
48 --name $WPA_SUP_PNAME --startas $WPA_SUP_BIN --pidfile $WPA_SUP_PIDFILE \
49 -- $WPA_SUP_OPTIONS $WPA_SUP_CONF -D $IF_WPA_DRIVER
50 fi
51
52 # if the interface socket exists, then wpa_supplicant was invoked successfully
53 if [ -S "$WPA_COMMON_CTRL_IFACE/$IFACE" ]; then
54
55 if [ "$VERBOSITY" = "1" ]; then
56 echo "$WPA_SUP_PNAME: ctrl_interface socket located at $WPA_COMMON_CTRL_IFACE/$IFACE"
57 fi
58
59 exit 0
60
61 fi
62
63elif [ "$MODE" = "stop" ]; then
64
65 if [ -f "$WPA_SUP_PIDFILE" ]; then
66
67 if [ "$VERBOSITY" = "1" ]; then
68 echo "$WPA_SUP_PNAME: terminating $WPA_SUP_PNAME daemon"
69 fi
70
71 start-stop-daemon --stop --quiet \
72 --name $WPA_SUP_PNAME --pidfile $WPA_SUP_PIDFILE
73
74 if [ -S "$WPA_COMMON_CTRL_IFACE/$IFACE" ]; then
75 rm -f $WPA_COMMON_CTRL_IFACE/$IFACE
76 fi
77
78 if [ -f "$WPA_SUP_PIDFILE" ]; then
79 rm -f $WPA_SUP_PIDFILE
80 fi
81 fi
82
83fi
84
85exit 0