e39ff264656b25a84cd9f55a2bfafa8223c990de
[platform/core/connectivity/bluetooth-tools.git] / scripts / mobile / 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 is failed."
12         exit 1
13 fi
14
15 # We have to handle both systemd and sysvinit cases differently
16 if [ -d /sys/fs/cgroup/systemd ]; then
17    # bt-service changes USER to 'app' via libprivilege-control, so it needs
18    # to know where the session bus is located under systemd
19    export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/app/dbus/user_bus_socket
20 fi
21
22 # Execute BlueZ BT stack
23 echo "Run bluetoothd"
24 /usr/libexec/bluetooth/bluetoothd -d -C &
25
26 echo "Run bluetooth-share by systemd"
27 systemctl start --no-block bluetooth-share.service
28
29 exit 0