]>
Commit | Line | Data |
---|---|---|
2c1b94f0 AF |
1 | #!/bin/sh |
2 | # Begin $rc_base/init.d/bluetooth | |
3 | ||
4 | # Based on sysklogd script from LFS-3.1 and earlier. | |
5 | # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org | |
6 | ||
7 | . /etc/sysconfig/rc | |
8 | . $rc_functions | |
9 | ||
a312b3ad AF |
10 | eval $(/usr/local/bin/readhash /var/ipfire/bluetooth/settings) |
11 | ||
2c1b94f0 AF |
12 | case "$1" in |
13 | start) | |
14 | boot_mesg "Starting Bluetooth daemon..." | |
15 | loadproc /usr/sbin/hcid | |
16 | sleep 1 | |
a312b3ad AF |
17 | |
18 | if [ "$PASSKEY_AGENT" == "on" ]; then | |
19 | boot_mesg "Starting Bluetooth passkey-agent..." | |
20 | loadproc /usr/bin/passkey-agent --default $PWD & | |
21 | fi | |
22 | ||
23 | if [ "$RFCOMM0_BIND" == "on" ]; then | |
24 | boot_mesg "Bind rfcomm0 to cellphone/modem ${RFCOMM0_DEVICE//-/:}/$RFCOMM0_CHANNEL ..." | |
25 | rfcomm bind /dev/rfcomm0 ${RFCOMM0_DEVICE//-/:} $RFCOMM0_CHANNEL | |
26 | evaluate_retval | |
27 | fi | |
28 | if [ "$RFCOMM1_BIND" == "on" ]; then | |
29 | boot_mesg "Bind rfcomm1 to cellphone/modem ${RFCOMM1_DEVICE//-/:}/${RFCOMM1_CHANNEL} ..." | |
30 | rfcomm bind /dev/rfcomm1 ${RFCOMM1_DEVICE//-/:} $RFCOMM1_CHANNEL | |
31 | evaluate_retval | |
32 | fi | |
33 | exit 0; | |
2c1b94f0 | 34 | |
2c1b94f0 AF |
35 | ;; |
36 | ||
37 | stop) | |
a312b3ad AF |
38 | if [ -e /dev/rfcomm0 ]; then |
39 | boot_mesg "Release rfcomm0..." | |
40 | rfcomm release rfcomm0 | |
41 | fi | |
42 | if [ -e /dev/rfcomm1 ]; then | |
43 | boot_mesg "Release rfcomm1..." | |
44 | rfcomm release rfcomm1 | |
45 | fi | |
2c1b94f0 AF |
46 | boot_mesg "Stopping Bluetooth daemon..." |
47 | killproc /usr/sbin/hcid | |
a312b3ad | 48 | exit 0; |
2c1b94f0 AF |
49 | ;; |
50 | ||
51 | restart) | |
52 | $0 stop | |
53 | sleep 1 | |
54 | $0 start | |
55 | ;; | |
56 | ||
57 | status) | |
58 | statusproc /usr/sbin/hcid | |
59 | statusproc /usr/bin/passkey-agent | |
a312b3ad | 60 | ;; |
2c1b94f0 AF |
61 | |
62 | *) | |
63 | echo "Usage: $0 {start|stop|restart|status}" | |
64 | exit 1 | |
65 | ;; | |
66 | esac | |
67 | ||
68 | # End $rc_base/init.d/bluetooth |