nrelease - fix/improve livecd
[dragonfly.git] / etc / rc.d / btconfig
1 #!/bin/sh
2 #
3 # $NetBSD: btconfig,v 1.1 2006/06/19 15:44:36 gdamore Exp $
4 #
5
6 # PROVIDE: bluetooth
7 # REQUIRE: DAEMON
8 # BEFORE:  LOGIN
9
10 . /etc/rc.subr
11
12 name="btconfig"
13 rcvar=${name}
14 command="/usr/sbin/${name}"
15 start_cmd="btconfig_start"
16 stop_cmd="btconfig_stop"
17 status_cmd="btconfig_status"
18
19 btconfig_start()
20 {
21         echo -n 'Configuring Bluetooth controllers:'
22
23         #
24         # Configure Bluetooth controllers.
25         #
26         # If ${btconfig_devices} is set, it should be a list of devices to
27         # configure. Otherwise, all available devices will be configured.
28         #
29         # If ${btconfig_<dev>} is set, it will be used as the parameter
30         # list for btconfig. Otherwise ${btconfig_args} will be used or
31         # if that is not set, the default string "enable" will be used.
32         #
33
34         devs="${btconfig_devices:-$(${command} -l)}"
35         for dev in ${devs}; do
36                 eval args="\$btconfig_${dev}"
37                 if [ -z "${args}" ]; then
38                         args="${btconfig_args:-enable}"
39                 fi
40
41                 echo -n " ${dev}"
42                 ${command} ${dev} ${args}
43         done
44
45         echo '.'
46 }
47
48 btconfig_stop()
49 {
50         echo -n 'Disabling Bluetooth controllers:'
51
52         devs="${btconfig_devices:-$(${command} -l)}"
53         for dev in ${devs}; do
54                 echo -n " ${dev}"
55                 ${command} ${dev} disable
56         done
57
58         echo '.'
59 }
60
61 btconfig_status()
62 {
63         ${command}
64 }
65
66 load_rc_config ${name}
67 run_rc_command "$1"