#!/bin/sh

which pulseaudio >/dev/null
[ $? -ne 0 ] && exit

#run start-pulseaudio-x11 in blueman_tray...
[ -x /root/Startup/blueman_tray ] && exit

#wait for bluetoothd...
if [ -x /etc/init.d/bluetooth ];then
 for CNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14
 do
  [ $CNT -eq 14 ] && exit
  echo "/root/Startup/pulseaudio: wait seconds: ${CNT}"
  pidof bluetoothd >/dev/null
  [ $? -eq 0 ] && break
  sleep 1
 done
fi

echo "/root/Startup/pulseaudio: executing start-pulseaudio-x11"
exec start-pulseaudio-x11
