description "libesd0"
author "Graham Cobb <g+770@cobb.uk.net>"

start on started pulseaudio

console none

script
  # wait for authorisation cookie to appear
  count=0
  while [ ! -f /var/run/pulse/.esd_auth ]
  do
    count=$((count+1))
    if [ $count -gt 30 ]
    then exit 1
    fi
    sleep 1
  done
  #echo waited $count seconds >/tmp/libesd0.log

  # user must be able to access authorisation cookie
  ln -sf /var/run/pulse/.esd_auth /home/user/       
  chmod +r /var/run/pulse/.esd_auth          

  # libesd requires a softlink in /tmp/ to work
  ln -sf /tmp/.esd /tmp/.esd-29999
end script
