]> git.pld-linux.org Git - packages/pulseaudio.git/commitdiff
- TODO killed, which means:
authortwittner <twittner@pld-linux.org>
Mon, 31 Mar 2008 15:52:04 +0000 (15:52 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
  - 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

Changed files:
    pulseaudio.init -> 1.1
    pulseaudio.spec -> 1.41
    pulseaudio.sysconfig -> 1.1

pulseaudio.init [new file with mode: 0644]
pulseaudio.spec
pulseaudio.sysconfig [new file with mode: 0644]

diff --git a/pulseaudio.init b/pulseaudio.init
new file mode 100644 (file)
index 0000000..56cbbda
--- /dev/null
@@ -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
index 4691adaf9de0a446f9c4a64bc2a60d5d6a6f0989..f6f99c7d0e3b955310c7f46edf7325ebb69f1c27 100644 (file)
@@ -1,9 +1,3 @@
-# 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
@@ -12,11 +6,13 @@ Summary:     Modular sound server
 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
@@ -44,12 +40,24 @@ BuildRequires:      libtool
 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
@@ -240,12 +248,17 @@ Moduł LIRC dla PulseAudio.
 %{__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 
@@ -258,6 +271,9 @@ ln -sf %{_bindir}/esdcompat $RPM_BUILD_ROOT%{_bindir}/esd
 # 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
 
@@ -280,11 +296,37 @@ if [ -f %{_sysconfdir}/polypaudio/client.conf.rpmsave ]; then
        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
diff --git a/pulseaudio.sysconfig b/pulseaudio.sysconfig
new file mode 100644 (file)
index 0000000..ba63687
--- /dev/null
@@ -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
+
This page took 0.050246 seconds and 4 git commands to generate.