SOURCES: pulseaudio.sysconfig (NEW), pulseaudio.init (NEW) - TODO ...

twittner twittner at pld-linux.org
Mon Mar 31 17:52:09 CEST 2008


Author: twittner                     Date: Mon Mar 31 15:52:09 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- TODO killed, which means:
  - initscript & sysconfig (copied verbatim from Debian's /etc/default/pulseaudio)
  - pass to configure appropiate user and group names (modeled after Debian's package)
- rel 1.1 because of not tested pulsaudio in system-wide configuration
- consider suid pulseaudio binary, adding `pulse' user to `audio' group 

---- Files affected:
SOURCES:
   pulseaudio.sysconfig (NONE -> 1.1)  (NEW), pulseaudio.init (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/pulseaudio.sysconfig
diff -u /dev/null SOURCES/pulseaudio.sysconfig:1.1
--- /dev/null	Mon Mar 31 17:52:09 2008
+++ SOURCES/pulseaudio.sysconfig	Mon Mar 31 17:52:04 2008
@@ -0,0 +1,19 @@
+# Start the PulseAudio sound server in system mode.
+# (enables the pulseaudio init script)
+# System mode is not the recommended way to run PulseAudio as it has some
+# limitations (such as no shared memory access) and could potentially allow
+# users to disconnect or redirect each others audio streams. The
+# recommend way to run PulseAudio is as a per-session daemon. For GNOME
+# sessions you can install pulseaudio-esound-compat and GNOME will
+# automatically start PulseAudio on login (if ESD is enabled in
+# System->Preferences->Sound). For other sessions, you can simply start
+# PulseAudio with "pulseaudio --daemonize".
+# 0 = don't start, 1 = start
+PULSEAUDIO_SYSTEM_START=0
+
+# Prevent users from dynamically loading modules into the PulseAudio sound
+# server. Dynamic module loading enhances the flexibilty of the PulseAudio
+# system, but may pose a security risk.
+# 0 = no, 1 = yes
+DISALLOW_MODULE_LOADING=1
+

================================================================
Index: SOURCES/pulseaudio.init
diff -u /dev/null SOURCES/pulseaudio.init:1.1
--- /dev/null	Mon Mar 31 17:52:10 2008
+++ SOURCES/pulseaudio.init	Mon Mar 31 17:52:04 2008
@@ -0,0 +1,109 @@
+#!/bin/sh
+#
+# pulseaudio	PulseAudio system-wide sound server	
+#
+# chkconfig:	345 86 13
+#
+# description:	System mode startup script for the PulseAudio sound server.
+#
+# processname:	pulseaudio
+# config:	/etc/sysconfig/pulseaudio
+# pidfile:	/var/run/pulse/pid
+#
+# $Id$
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Set defaults
+PULSEAUDIO_SYSTEM_START=0
+DISALLOW_MODULE_LOADING=1
+
+# Get service config - may override defaults
+[ -f /etc/sysconfig/pulseaudio ] && . /etc/sysconfig/pulseaudio
+[ "$PULSEAUDIO_SYSTEM_START" != "1" ] && exit 0
+
+start() {
+	# Check if the service is already running?
+	if [ ! -f /var/lock/subsys/pulseaudio ]; then
+		msg_starting pulseaudio
+		daemon /usr/bin/pulseaudio --system --daemonize --high-priority --log-target=syslog --disallow-module-loading=$DISALLOW_MODULE_LOADING
+		RETVAL=$?
+		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/pulseaudio
+	else
+		msg_already_running pulseaudio
+	fi
+}
+
+stop() {
+	if [ -f /var/lock/subsys/pulseaudio ]; then
+		# Stop daemons.
+		msg_stopping pulseaudio
+		killproc pulseaudio
+		killproc --pidfile /var/run/pulse/pid pulseaudio -TERM
+		rm -f /var/lock/subsys/pulseaudio
+	else
+		msg_not_running pulseaudio
+	fi
+}
+
+reload() {
+	if [ -f /var/lock/subsys/pulseaudio ]; then
+		msg_reloading pulseaudio
+		killproc pulseaudio -HUP
+		killproc --pidfile /var/run/pulse/pid pulseaudio -HUP
+		RETVAL=$?
+	else
+		msg_not_running pulseaudio
+		RETVAL=7
+	fi
+}
+
+condrestart() {
+	if [ -f /var/lock/subsys/pulseaudio ]; then
+		stop
+		start
+	else
+		msg_not_running pulseaudio
+		RETVAL=$1
+	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+  	start
+	;;
+  stop)
+  	stop
+	;;
+  restart)
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+# include force-reload here if program allows reloading without restart
+# otherwise remove reload action and support force-reload as restart if running
+  reload|force-reload)
+  	reload
+	;;
+# use this one if program doesn't support reloading without restart
+  force-reload)
+	condrestart 7
+	;;
+  status)
+	status pulseaudio
+	RETVAL=$?
+	;;
+  *)
+	msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
+	exit 3
+esac
+
+exit $RETVAL
================================================================


More information about the pld-cvs-commit mailing list