#!/bin/bash -e #©keithhedger Mon 16 Jun 18:04:36 BST 2014 kdhedger68713@gmail.com # #Based on scripts and hints by #stoat http://www.linuxquestions.org/questions/user/stoat-343150/ #ReaperX7 http://www.linuxquestions.org/questions/user/reaperx7-603839/ #Here: http://www.linuxquestions.org/questions/linux-from-scratch-13/lfs-with-runit-without-sysv-4175503653/ # if [ "X${1}" = "Xuninstall" ];then rm -rf /etc/sv/bluetooth /etc/runit/runsvdir/default/bluetooth exit 0 fi mkdir -vp /etc/sv/bluetooth/log cat > /etc/sv/bluetooth/run << "EOF" #!/bin/sh exec 2>&1 #Begin bluetooth service run file HIDD_ENABLE="false" PAND_ENABLE="false" DUND_ENABLE="false" RFCOMM_ENABLE="false" HIDD_OPTIONS="" PAND_OPTIONS="" DUND_OPTIONS="" if [ -f "/etc/sysconfig/bluetooth" ]; then . /etc/sysconfig/bluetooth fi if [ "$HIDD_ENABLE" = "true" ]; then /usr/sbin/hidd "$HIDD_OPTIONS" 2>&1 fi if [ "$RFCOMM_ENABLE" = "true" ]; then /usr/bin/rfcomm -f /etc/bluetooth/rfcomm.conf bind all || true fi if [ "$PAND_ENABLE" = "true" ]; then /usr/bin/pand "$PAND_OPTIONS" 2>&1 fi if [ "$DUND_ENABLE" = "true" ]; then /usr/bin/dund "$DUND_OPTIONS" 2>&1 fi exec /usr/sbin/bluetoothd -n -d 2>&1 #End of bluetooth service run file EOF cat > /etc/sv/bluetooth/finish << "EOF" #!/bin/sh #Begin bluetooth service finish file #End bluetooth service finish file EOF cat > /etc/sv/bluetooth/log/run << "EOF" #!/bin/sh #Begin bluetooth log service file exec /usr/sbin/svlogd -tt /var/log/bluetooth #End of bluetooth log service run file EOF chmod +x /etc/sv/bluetooth/{run,finish,log/run} mkdir -pv /var/log/bluetooth cd /etc/runit/runsvdir/default ln -sv /etc/sv/bluetooth bluetooth