Skip to content

Instantly share code, notes, and snippets.

@alupuleasa
Forked from hsiehjack/bluez-5_40-install.sh
Created January 28, 2020 00:07
Show Gist options
  • Save alupuleasa/eab6c51f26a9e6efeb3580228f9440fe to your computer and use it in GitHub Desktop.
Save alupuleasa/eab6c51f26a9e6efeb3580228f9440fe 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