summaryrefslogtreecommitdiff
path: root/package/pulseaudio/files
diff options
context:
space:
mode:
Diffstat (limited to 'package/pulseaudio/files')
-rw-r--r--package/pulseaudio/files/pulseaudio.init32
-rw-r--r--package/pulseaudio/files/pulseaudio.postinst7
2 files changed, 39 insertions, 0 deletions
diff --git a/package/pulseaudio/files/pulseaudio.init b/package/pulseaudio/files/pulseaudio.init
new file mode 100644
index 000000000..029174628
--- /dev/null
+++ b/package/pulseaudio/files/pulseaudio.init
@@ -0,0 +1,32 @@
+#!/bin/sh
+#PKG pulseaudio
+#INIT 60
+. /etc/rc.conf
+
+case $1 in
+autostop) ;;
+autostart)
+ test x"${pulseaudio:-NO}" = x"NO" && exit 0
+ exec sh $0 start
+ ;;
+start)
+ if [ ! -d /var/run/pulse ]; then
+ mkdir -p /var/run/pulse && chown pulse.pulse /var/run/pulse && chmod 750 /var/run/pulse
+ fi
+ if [ ! -d /var/lib/pulse ]; then
+ mkdir -p /var/lib/pulse && chown pulse.pulse /var/lib/pulse && chmod 750 /var/lib/pulse
+ fi
+ /usr/bin/pulseaudio $pulseaudio_flags
+ ;;
+stop)
+ kill $(pgrep -f /usr/bin/pulseaudio)
+ ;;
+restart)
+ sh $0 stop
+ sh $0 start
+ ;;
+*)
+ echo "usage: $0 {start | stop | restart}"
+ exit 1
+esac
+exit $?
diff --git a/package/pulseaudio/files/pulseaudio.postinst b/package/pulseaudio/files/pulseaudio.postinst
new file mode 100644
index 000000000..3e5b348a9
--- /dev/null
+++ b/package/pulseaudio/files/pulseaudio.postinst
@@ -0,0 +1,7 @@
+#!/bin/sh
+. $IPKG_INSTROOT/etc/functions.sh
+add_rcconf pulseaudio pulseaudio NO
+gid=$(get_next_gid)
+add_user pulse $(get_next_uid) $gid /var/run/pulse
+add_group pulse $gid
+add_rcconf pulseaudio_flags pulseaudio_flags "--system --disallow-exit --disallow-module-loading --disable-shm --exit-idle-time=-1 --realtime=false"