diff --git a/pulseaudio/files/pulseaudio.init b/pulseaudio/files/pulseaudio.init new file mode 100755 index 0000000..2648279 --- /dev/null +++ b/pulseaudio/files/pulseaudio.init @@ -0,0 +1,73 @@ +#!/bin/bash +# +# pulseaudio: Starts the pulseaudio system wide daemon. +# +# chkconfig: - 95 05 +# description: This is a daemon which handles passwd and group lookups \ +# for running programs and cache the results for the next \ +# query. You should start this daemon if you use \ +# slow naming services like NIS, NIS+, LDAP, or hesiod. +# processname: /usr/bin/pulseaudio +# + +# Source function library. +. /etc/init.d/functions + +if [ -f /etc/sysconfig/pulseaudio ] ; then + . /etc/sysconfig/pulseaudio +fi + +RETVAL=0 +prog=pulseaudio + +start() { + echo -n $"Starting $prog: " + daemon pulseaudio --system --use-pid-file -n -F /etc/pulse/system.pa -D ${PULSEAUDIO_OPTIONS} + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pulseaudio + return $RETVAL +} + +stop() { + echo -n $"Stopping $prog: " + killproc pulseaudio + RETVAL=$? + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/pulseaudio + echo + return $RETVAL +} + +restart() { + stop + start +} + +# See how we were called. +case "$1" in + start) + start + RETVAL=$? + ;; + stop) + stop + RETVAL=$? + ;; + status) + status pulseaudio + RETVAL=$? + ;; + restart) + restart + RETVAL=$? + ;; + try-restart | condrestart) + [ -e /var/lock/subsys/pulseaudio ] && restart + RETVAL=$? + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart}" + RETVAL=1 + ;; +esac +exit $RETVAL diff --git a/pulseaudio/files/pulseaudio.sysconfig.CentOS b/pulseaudio/files/pulseaudio.sysconfig.CentOS new file mode 100644 index 0000000..deea200 --- /dev/null +++ b/pulseaudio/files/pulseaudio.sysconfig.CentOS @@ -0,0 +1 @@ +PULSEAUDIO_OPTIONS="--disable-shm" diff --git a/pulseaudio/files/pulseaudio.sysconfig.Fedora b/pulseaudio/files/pulseaudio.sysconfig.Fedora new file mode 100644 index 0000000..96e8cc6 --- /dev/null +++ b/pulseaudio/files/pulseaudio.sysconfig.Fedora @@ -0,0 +1 @@ +PULSEAUDIO_OPTIONS="--disable-shm --disallow-module-loading --disallow-exit --exit-idle-time=-1" diff --git a/pulseaudio/files/system.pa b/pulseaudio/files/system.pa new file mode 100644 index 0000000..e316c14 --- /dev/null +++ b/pulseaudio/files/system.pa @@ -0,0 +1,7 @@ + +.include /etc/pulse/default.pa + +load-module module-native-protocol-tcp +load-module module-zeroconf-publish + +load-module module-cli diff --git a/pulseaudio/manifests/init.pp b/pulseaudio/manifests/init.pp new file mode 100644 index 0000000..99e1de8 --- /dev/null +++ b/pulseaudio/manifests/init.pp @@ -0,0 +1,63 @@ + +# Install common pulseaudio components +# +class pulseaudio::common { + + package { [ "pulseaudio", "pulseaudio-module-zeroconf" ]: + ensure => installed, + } + +} + + +# Install system wide pulseaudio daemon. +# +# Before using, please see some warnings in: +# +# http://pulseaudio.org/wiki/WhatIsWrongWithSystemMode +# +class pulseaudio::server inherits pulseaudio::common { + + file { "/etc/init.d/pulseaudio": + ensure => present, + source => "puppet:///pulseaudio/pulseaudio.init", + mode => 0755, + owner => root, + group => root, + } + file { "/etc/sysconfig/pulseaudio": + ensure => present, + source => "puppet:///pulseaudio/pulseaudio.sysconfig.${operatingsystem}", + mode => 0644, + owner => root, + group => root, + before => File["/etc/init.d/pulseaudio"], + notify => Service["pulseaudio"], + } + + file { "/etc/pulse/system.pa": + ensure => present, + source => [ "puppet:///files/pulseaudio/system.pa.${fqdn}", + "puppet:///files/pulseaudio/system.pa", ], + mode => 0644, + owner => root, + group => root, + require => Package["pulseaudio"], + notify => Service["pulseaudio"], + } + + service { "pulseaudio": + ensure => running, + enable => true, + require => [ Package["pulseaudio"], + File["/etc/init.d/pulseaudio"], ], + } + + user { "pulse": + groups => [ "audio", ], + home => "/var/run/pulse", + require => Package["pulseaudio"], + before => Service["pulseaudio"], + } + +}