b48d955b0dcec54201d1cec0c292b46c088dafe3
[platform/core/connectivity/bluetooth-tools.git] / scripts / bt-stack-up.sh
1 #!/bin/sh
2
3 #
4 # Script for executing Bluetooth stack
5 #
6
7 # Register BT Device
8 /usr/etc/bluetooth/bt-dev-start.sh
9
10 if !(/usr/bin/hciconfig | grep hci); then
11         echo "Registering BT device failed."
12         exit 1
13 fi
14
15 # Execute BlueZ BT stack
16 echo "Run bluetoothd"
17
18 # We have to handle both systemd and sysvinit cases differently
19 if [ -d /sys/fs/cgroup/systemd ]; then
20    # bt-service changes USER via libprivilege-control, so it needs
21    # to know where the session bus is located under systemd
22    export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/dbus/user_bus_socket
23 else
24    # Under systemd, bluetoothd is dbus activated. sysvinit requires it to be
25    # launched explicitly
26    /lib/bluetooth/bluetoothd -E
27 fi
28
29 /usr/bin/bt-service &
30 /usr/bin/bluetooth-share &
31
32 exit 0