pulseaudio.init 695 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. #PKG pulseaudio
  3. #INIT 60
  4. . /etc/rc.conf
  5. case $1 in
  6. autostop) ;;
  7. autostart)
  8. test x"${pulseaudio:-NO}" = x"NO" && exit 0
  9. exec sh $0 start
  10. ;;
  11. start)
  12. # check group membership
  13. id pulse | grep audio >/dev/null 2>&1
  14. if [ $? -ne 0 ];then
  15. echo "pulse user must be in group audio."
  16. exit 1
  17. fi
  18. if [ ! -d /var/run/pulse ]; then
  19. mkdir -p /var/run/pulse/ && chown -R pulse.pulse /var/run/pulse && chmod 750 /var/run/pulse
  20. fi
  21. chown pulse /etc/pulse
  22. env PULSE_STATE_PATH=/etc/pulse/state /usr/bin/pulseaudio $pulseaudio_flags
  23. ;;
  24. stop)
  25. kill $(pgrep -f /usr/bin/pulseaudio)
  26. ;;
  27. restart)
  28. sh $0 stop
  29. sh $0 start
  30. ;;
  31. *)
  32. echo "usage: $0 {start | stop | restart}"
  33. exit 1
  34. esac
  35. exit $?