1description     "Start the bluetooth daemon"
2author          "chromium-os-dev@chromium.org"
3
4start on started system-services
5stop on stopping system-services
6
7limit memlock unlimited unlimited
8
9env BLUETOOTH_LIBDIR=/var/lib/bluetooth
10env BLUETOOTH_RUNDIR=/var/run/bluetooth
11env BLUETOOTH_DAEMON_OPTION=""
12env BLUETOOTH_WANT_FILE=/var/lib/misc/bluetooth-daemon.current
13
14pre-start script
15  mkdir -p -m 0750 ${BLUETOOTH_LIBDIR}
16  chown -R bluetooth:bluetooth ${BLUETOOTH_LIBDIR}
17  mkdir -p -m 0750 ${BLUETOOTH_RUNDIR}
18  chown -R bluetooth:bluetooth ${BLUETOOTH_RUNDIR}
19
20  # Make sure file exists before accessing it
21  mkdir -p "$(dirname $BLUETOOTH_WANT_FILE)"
22  touch "$BLUETOOTH_WANT_FILE"
23
24  # Check if we want to start bluez. If "floss" is wanted instead, exit early
25  # without starting bluez.
26  want_daemon="$(cat $BLUETOOTH_WANT_FILE)"
27  if [ "$want_daemon" = "floss" ]; then
28    exit 1
29  fi
30end script
31
32respawn
33
34exec /usr/bin/start_bluetoothd.sh