1
0

pulseaudio.init 775 B

12345678910111213141516171819202122232425262728293031323334353637
  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. test x"$pulseaudio" = x"DAEMON" && test -x /bin/mksh && exec mksh -T- $0 start
  10. exec sh $0 start
  11. ;;
  12. start)
  13. # check group membership
  14. id pulse | grep audio >/dev/null 2>&1
  15. if [ $? -ne 0 ];then
  16. echo "pulse user must be in group audio."
  17. exit 1
  18. fi
  19. if [ ! -d /var/run/pulse ]; then
  20. mkdir -p /var/run/pulse/ && chown -R pulse.pulse /var/run/pulse && chmod 750 /var/run/pulse
  21. fi
  22. chown pulse /etc/pulse
  23. env PULSE_STATE_PATH=/etc/pulse/state /usr/bin/pulseaudio $pulseaudio_flags
  24. ;;
  25. stop)
  26. kill $(pgrep -f /usr/bin/pulseaudio)
  27. ;;
  28. restart)
  29. sh $0 stop
  30. sh $0 start
  31. ;;
  32. *)
  33. echo "usage: $0 {start | stop | restart}"
  34. exit 1
  35. esac
  36. exit $?