Skip to content

Commit

Permalink
Merge branch 'jb45842' into 'master'
Browse files Browse the repository at this point in the history
System-wide mode Pulseaudio

See merge request mer-core/pulseaudio!28
  • Loading branch information
Tomin1 committed Jun 3, 2019
2 parents a42b8ab + 33d9ede commit 2ba872e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 5 deletions.
17 changes: 17 additions & 0 deletions rpm/pulseaudio-system.service
@@ -0,0 +1,17 @@
# System-wide mode to use before user session

[Unit]
Description=PulseAudio (system-wide mode)
DefaultDependencies=no
Requires=dbus.socket
RefuseManualStart=yes
Before=multi-user.target systemd-user-sessions.service
PartOf=emergency-call.target

[Service]
Type=forking
PIDFile=%t/pulse/pid
EnvironmentFile=-/etc/sysconfig/pulseaudio
ExecStart=/usr/bin/pulseaudio --daemonize --system --disallow-module-loading $CONFIG
Restart=always
RestartSec=1
32 changes: 27 additions & 5 deletions rpm/pulseaudio.spec
Expand Up @@ -16,10 +16,16 @@ Source1: 90-pulse.conf
Source2: pulseaudio.service
Source3: 50-sfos.daemon.conf
Source4: 50-sfos.client.conf
Source5: pulseaudio-system.service
Requires: udev
Requires: libsbc >= 1.0
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
# system-wide mode %pre
Requires(pre): /usr/bin/getent
Requires(pre): /usr/sbin/groupadd
Requires(pre): /usr/sbin/useradd

BuildRequires: pkgconfig(alsa) >= 1.0.24
BuildRequires: pkgconfig(dbus-1) >= 1.4.12
BuildRequires: pkgconfig(glib-2.0) >= 2.4.0
Expand Down Expand Up @@ -69,15 +75,15 @@ Requires: %{name} = %{version}-%{release}
Requires: /bin/sed

%description module-x11
Description: %{summary}
%{summary}.

%package devel
Summary: PulseAudio Development headers and libraries
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
Description: %{summary}
%{summary}.

%package doc
Summary: Documentation for %{name}
Expand Down Expand Up @@ -113,8 +119,7 @@ export CXXFLAGS="$CXXFLAGS -mfpu=neon"
--disable-esound \
--with-database=simple

make %{?jobs:-j%jobs}

make %{?_smp_mflags}

%install
rm -rf %{buildroot}
Expand All @@ -131,6 +136,10 @@ install -m 644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/pulse/daemon.conf.d
install -d %{buildroot}/%{_sysconfdir}/pulse/client.conf.d
install -m 644 %{SOURCE4} %{buildroot}/%{_sysconfdir}/pulse/client.conf.d

# system-wide mode configuration
install -d %{buildroot}/usr/lib/systemd/system
install -m 644 %{SOURCE5} %{buildroot}/usr/lib/systemd/system/pulseaudio.service

mkdir -p %{buildroot}%{_docdir}/%{name}-%{version}
install -m0644 README %{buildroot}%{_docdir}/%{name}-%{version}

Expand All @@ -139,6 +148,17 @@ install -m0644 README %{buildroot}%{_docdir}/%{name}-%{version}
%fdupes %{buildroot}/%{_datadir}
%fdupes %{buildroot}/%{_includedir}

%pre
# system-wide mode needs an user and two groups
if ! getent passwd pulse > /dev/null ; then
useradd -rUG audio,bluetooth -d /run/pulse -s /sbin/nologin pulse || :
fi
if ! getent group pulse-access > /dev/null ; then
groupadd -rf pulse-access || :
usermod -G pulse-access -a root || :
usermod -G pulse-access -a nemo || :
fi

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig
Expand All @@ -148,7 +168,6 @@ install -m0644 README %{buildroot}%{_docdir}/%{name}-%{version}
%license GPL LGPL LICENSE
%if ! %{with X11}
%endif
%exclude %{_sysconfdir}/dbus-1/system.d/pulseaudio-system.conf
%config(noreplace) %{_sysconfdir}/pulse/*.conf
%config(noreplace) %{_sysconfdir}/pulse/*.pa
%config(noreplace) %{_sysconfdir}/security/limits.d/90-pulse.conf
Expand Down Expand Up @@ -271,6 +290,9 @@ install -m0644 README %{buildroot}%{_docdir}/%{name}-%{version}
%{_libexecdir}/pulse/gsettings-helper
%{_datadir}/GConf/gsettings/pulseaudio.convert
%{_datadir}/glib-2.0/schemas/org.freedesktop.pulseaudio.gschema.xml
# system-wide mode
%{_libdir}/systemd/system/pulseaudio.service
%config %{_sysconfdir}/dbus-1/system.d/pulseaudio-system.conf

%if %{with X11}
%files module-x11
Expand Down

0 comments on commit 2ba872e

Please sign in to comment.