summaryrefslogtreecommitdiffstats
path: root/net/ipw-firmware/files/ipw.sh.in
blob: b20894b99a0a2d1afbed9247828cee73909d4cc9 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: %%DRIVERNAME%%
# REQUIRE: LOGIN abi
# BEFORE:  securelevel
# KEYWORD: FreeBSD shutdown

# Add the following line to /etc/rc.conf to enable `%%DRIVERNAME%%':
#
# %%DRIVERNAME%%_enable="YES"
#

. "%%RC_SUBR%%"

name="%%DRIVERNAME%%"
rcvar=`set_rcvar`

start_cmd="%%DRIVERNAME%%_start_cmd"
stop_cmd="%%DRIVERNAME%%_stop_cmd"

load_rc_config "$name"
: ${%%DRIVERNAME%%_enable="NO"}
: ${%%DRIVERNAME%%_interfaces="%%DRIVERNAME%%0"}

command="/usr/local/sbin/%%DRIVERNAME%%control"

%%DRIVERNAME%%_start_cmd()
{
	echo -n "Starting %%DRIVERNAME%%"
	for i in ${%%DRIVERNAME%%_interfaces}; do
		eval _mode=\$%%DRIVERNAME%%_mode_${i}
		case ${_mode} in
		""|bss)
			eval _%%DRIVERNAME%%_file_${i}="%%DRIVERNAME%%.fw"
			;;
		ibss)
			eval _%%DRIVERNAME%%_file_${i}="%%DRIVERNAME%%-i.fw"
			;;
		monitor)
			eval _%%DRIVERNAME%%_file_${i}="%%DRIVERNAME%%-p.fw"
			;;
		*)
			echo "${_mode} - Possible values for %%DRIVERNAME%%_mode_${i} are bss|ibss|monitor."
			exit 1
			;;
		esac

		eval _file=\$_%%DRIVERNAME%%_file_${i}
		echo -n " [${i}:${_mode:=bss}]"
		${command} -i ${i} -f %%DATADIR%%/${_file}
	done
	echo "."
}

%%DRIVERNAME%%_stop_cmd()
{
	echo "Stopping %%DRIVERNAME%%."
	for i in ${%%DRIVERNAME%%_interfaces}; do
		${command} -i ${i} -k
	done
}

run_rc_command "$1"
OpenPOWER on IntegriCloud