Skip to content

Instantly share code, notes, and snippets.

@hsiehjack
Created July 18, 2016 00:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save hsiehjack/06129701f78f3c8a9cd23c197a35130f to your computer and use it in GitHub Desktop.
Save hsiehjack/06129701f78f3c8a9cd23c197a35130f to your computer and use it in GitHub Desktop.
Install bluez 5.40 for ubuntu
#!/bin/bash
if [ `bluetoothd -v` == 5.40 ]
then
echo "This script installs bluez version 5.40 and you already have it installed"
exit 0
fi
sudo apt-get update
sudo apt-get -y install libglib2.0-dev libdbus-glib-1-dev libudev-dev libical-dev libreadline-dev
if [ ! -f bluez-5.40.tar.xz ]
then
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.40.tar.xz
fi
if [ ! -d bluez-5.40 ]
then
tar xf bluez-5.40.tar.xz
fi
cd bluez-5.40
./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var --enable-library --disable-systemd --disable-android --enable-experimental
make
sudo systemctl stop bluetooth
sudo make install
sudo cp -f attrib/gatttool /usr/bin/gatttool
if [ ! -f /usr/bin/bluetoothd ]
then
sudo ln -s /usr/libexec/bluetooth/bluetoothd /usr/bin/bluetoothd
fi
sudo rm /usr/sbin/bluetoothd
sudo ln -s /usr/libexec/bluetooth/bluetoothd /usr/sbin/bluetoothd
sudo sed -i 's/^\(ExecStart=\).*$/\1\/usr\/libexec\/bluetooth\/bluetoothd -E/' /lib/systemd/system/bluetooth.service
sudo systemctl daemon-reload
sudo systemctl restart bluetooth
sudo hciconfig hci0 up
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment