Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 282840
Collapse All | Expand All

(-)a/net-wireless/wpa_supplicant-0.5.7/etc/wpa_supplicant/wpa_cli.sh (-2 / +30 lines)
Lines 5-10 Link Here
5
# Alternatively, this file may be distributed under the terms of the BSD License
5
# Alternatively, this file may be distributed under the terms of the BSD License
6
# $Header: /var/cvsroot/gentoo-x86/net-wireless/wpa_supplicant/files/wpa_cli.sh,v 1.1 2006/07/11 15:07:16 uberlord Exp $
6
# $Header: /var/cvsroot/gentoo-x86/net-wireless/wpa_supplicant/files/wpa_cli.sh,v 1.1 2006/07/11 15:07:16 uberlord Exp $
7
7
8
lockfile='/var/run/wpa_cli.sh-lock'
9
get_lock() {
10
	while true; do
11
		if ( set -o noclobber; echo "$$" > "${lockfile}") 2> /dev/null; then
12
			trap 'rm -f "${lockfile}"; exit $?' INT TERM EXIT
13
			break
14
		else
15
			logger -t wpa_cli "$$ Waiting on lock held by $(<${lockfile})"
16
		fi
17
		/bin/sleep 0.5
18
	done
19
}
20
21
release_lock() {
22
	rm -f "${lockfile}"
23
	trap - INT TERM EXIT
24
}
25
8
if [ -z "$1" -o -z "$2" ]; then
26
if [ -z "$1" -o -z "$2" ]; then
9
	logger -t wpa_cli "Insufficient parameters"
27
	logger -t wpa_cli "Insufficient parameters"
10
	exit 1
28
	exit 1
Lines 27-35 fi Link Here
27
case ${ACTION} in
45
case ${ACTION} in
28
	CONNECTED)
46
	CONNECTED)
29
		EXEC="${EXEC} start"
47
		EXEC="${EXEC} start"
48
		WAIT_FOR_DEPS=true
30
		;;
49
		;;
31
	DISCONNECTED)
50
	DISCONNECTED)
32
		EXEC="${EXEC} stop"
51
		EXEC="${EXEC} stop"
52
		WAIT_FOR_DEPS=false
33
		;;
53
		;;
34
	*)
54
	*)
35
		logger -t wpa_cli "Unknown action ${ACTION}"
55
		logger -t wpa_cli "Unknown action ${ACTION}"
Lines 41-45 esac Link Here
41
# stopping the interface and a background process - like wpa_cli - is.
61
# stopping the interface and a background process - like wpa_cli - is.
42
export IN_BACKGROUND=true
62
export IN_BACKGROUND=true
43
63
44
logger -t wpa_cli "interface ${INTERFACE} ${ACTION}"
64
logger -t wpa_cli "$$ interface ${INTERFACE} ${ACTION}"
45
${EXEC} || logger -t wpa_cli "executing '${EXEC}' failed"
65
get_lock
66
${EXEC} || logger -t wpa_cli "$$ executing '${EXEC}' failed"
67
if [ ${WAIT_FOR_DEPS} == "true" ]; then
68
	while /bin/rc-status --nocolor | grep '\[ starting  \]'>/dev/null; do
69
		/bin/sleep 0.5
70
	done
71
fi
72
release_lock
73
logger -t wpa_cli "$$ Finished processing ${INTERFACE} ${ACTION}"

Return to bug 282840