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..f928e3fe6
--- /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 -R pulse.pulse /var/run/pulse && chmod 750 /var/run/pulse
+ fi
+ if [ ! -d /var/lib/pulse ]; then
+ mkdir -p /var/lib/pulse/.pulse-cookie && chown -R 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..b339de93f
--- /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 "-D --system --disallow-exit --disallow-module-loading --disable-shm --exit-idle-time=-1 --realtime=false"