summaryrefslogtreecommitdiff
blob: 0367c9736866d5d7616b246b0f99e42effbad86f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-wireless/wpa_supplicant/files/wpa_supplicant-0.2.7-init.d,v 1.1 2005/02/14 14:20:15 brix Exp $

depend() {
	before net
}

start() {
	ebegin "Starting wpa_supplicant"

	if [ ! -f /etc/wpa_supplicant.conf ]; then
		eerror "Configuration file /etc/wpa_supplicant.conf not found"
		return 1
	fi

	if [ -z "$INTERFACES" ]; then
		eerror "No interfaces specified in /etc/conf.d/wpa_supplicant"
		return 1
	fi

	for IFACE in $INTERFACES; do
		ebegin "  ${IFACE}"

		eval ARGS_IFACE=\"\$\{ARGS_$IFACE\}\"

		/sbin/ifconfig ${IFACE} up

		start-stop-daemon --start --quiet --exec /usr/sbin/wpa_supplicant \
			 -- -B -i${IFACE} -c/etc/wpa_supplicant.conf ${ARGS} ${ARGS_IFACE}
		eend $?
	done
}

stop() {
	ebegin "Stopping wpa_supplicant"

	start-stop-daemon --stop --quiet --exec /usr/sbin/wpa_supplicant
	eend ${?}
}