--- /dev/null
+#!/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
-# TODO:
-# system-wide pulse daemon stuff:
-# - pulse:pulse uid/gid for system-wide daemon
-# - "pulse-rt" and "pulse-access" groups for users
-# - then init script
-#
# Conditional build:
%bcond_without lirc # without lirc module
%bcond_without static_libs # don't build static libraries
Summary(pl.UTF-8): Modularny serwer dźwięku
Name: pulseaudio
Version: 0.9.9
-Release: 1
+Release: 1.1
License: GPL v2+ (server and libpulsecore), LGPL v2+ (libpulse)
Group: Libraries
Source0: http://0pointer.de/lennart/projects/pulseaudio/%{name}-%{version}.tar.gz
# Source0-md5: 8fa6f7a9611bb194d94311764022b197
+Source1: %{name}.init
+Source2: %{name}.sysconfig
Patch0: %{name}-suid.patch
Patch1: %{name}-path.patch
Patch2: %{name}-link.patch
BuildRequires: libwrap-devel
%{?with_lirc:BuildRequires: lirc-devel}
BuildRequires: lynx
-BuildRequires: m4
BuildRequires: pkgconfig
+BuildRequires: rpmbuild(macros) >= 1.228
BuildRequires: xorg-lib-libX11-devel
BuildRequires: xorg-lib-libSM-devel
Requires: %{name}-libs = %{version}-%{release}
+Requires(post,preun): /sbin/chkconfig
+Requires(postun): /usr/sbin/groupdel
+Requires(postun): /usr/sbin/userdel
+Requires(pre): /bin/id
+Requires(pre): /usr/bin/getgid
+Requires(pre): /usr/sbin/groupadd
+Requires(pre): /usr/sbin/useradd
+Requires(pre): fileutils
Obsoletes: polypaudio
+Provides: user(pulse)
+Provides: group(pulse)
+Provides: group(pulse-rt)
+Provides: group(pulse-access)
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
%{__autoheader}
%{__automake}
%configure \
+ --with-system-user=pulse \
+ --with-system-group=pulse \
+ --with-realtime-group=pulse-rt \
+ --with-access-group=pulse-access \
%{!?with_lirc:--disable-lirc} \
%{!?with_static_libs:--disable-static}
%{__make}
%install
rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT/var/run/pulse
# libsocket-util.so and libipacl.so are relinked before libpulsecore.so
# so __make -jN install leads to "File not found by glob" (or they links
# not needed (lt_dlopenext() is used)
rm -f $RPM_BUILD_ROOT%{_libdir}/pulse-*/modules/*.la
+install -D %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+install -D %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
+
%clean
rm -rf $RPM_BUILD_ROOT
mv -f %{_sysconfdir}/polypaudio/client.conf.rpmsave %{_sysconfdir}/pulse/client.conf
fi
+%pre
+%groupadd -g 226 pulse
+%groupadd -g 227 pulse-rt
+%groupadd -g 228 pulse-access
+%useradd -u 226 -g 226 -d /var/run/pulse -s /bin/false -c "Pulseaudio user" pulse
+
+%post
+/sbin/chkconfig --add %{name}
+%service %{name} restart
+
+%preun
+if [ "$1" = "0" ]; then
+ %service -q %{name} stop
+ /sbin/chkconfig --del %{name}
+fi
+%postun
+if [ "$1" = "0" ]; then
+ %userremove pulse
+ %groupremove pulse-access
+ %groupremove pulse-rt
+ %groupremove pulse
+fi
+
%files
%defattr(644,root,root,755)
%doc README
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pulse/daemon.conf
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pulse/default.pa
+%attr(754,root,root) /etc/rc.d/init.d/%{name}
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
+%dir %attr(750,pulse,pulse-access) /var/run/pulse
%{_sysconfdir}/xdg/autostart/pulseaudio-module-xsmp.desktop
%attr(755,root,root) %{_bindir}/pabrowse
%attr(755,root,root) %{_bindir}/pacat
--- /dev/null
+# 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
+