From 10015c812db5822d1d226a6cdbed9c8a49dc7c63a45bbeaa35686d746565c302 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 28 May 2019 18:57:39 +0000 Subject: [PATCH] Accepting request 706125 from home:tiwai:branches:multimedia:libs - Add systemd service to load OSS and sequencer modules (bsc#1136562) OBS-URL: https://build.opensuse.org/request/show/706125 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=157 --- alsa-utils.changes | 6 ++++++ alsa-utils.spec | 22 +++++++++++++++++++++- load-sound-modules.sh | 29 +++++++++++++++++++++++++++++ sound-extra.service | 8 ++++++++ 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 load-sound-modules.sh create mode 100644 sound-extra.service diff --git a/alsa-utils.changes b/alsa-utils.changes index 44f3db4..d3b50a1 100644 --- a/alsa-utils.changes +++ b/alsa-utils.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue May 28 14:04:52 CEST 2019 - tiwai@suse.de + +- Add systemd service to load OSS and sequencer modules + (bsc#1136562) + ------------------------------------------------------------------- Fri May 10 11:56:14 CEST 2019 - tiwai@suse.de diff --git a/alsa-utils.spec b/alsa-utils.spec index 0d83464..e287c96 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -26,6 +26,8 @@ Group: Productivity/Multimedia/Sound/Players URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 Source1: 01beep.conf +Source2: sound-extra.service +Source5: load-sound-modules.sh Patch101: alsa-utils-configure-version-revert.patch BuildRequires: alsa-devel BuildRequires: automake @@ -90,6 +92,23 @@ rm -f %{buildroot}%{_mandir}/man*/alsaconf.* %find_lang %{name} --all-name ln -s alsa-restore.service %{buildroot}%{_unitdir}/alsasound.service mkdir -p %{buildroot}%{_localstatedir}/lib/alsa +# systemd unit files +install -c -m 0644 %{SOURCE2} %{buildroot}%{_unitdir} +ln -s ../sound-extra.service %{buildroot}%{_unitdir}/sound.target.wants +mkdir -p %{buildroot}%{_libexecdir}/systemd/scripts +install -c -m 0755 %{SOURCE5} %{buildroot}%{_libexecdir}/systemd/scripts + +%pre +%service_add_pre sound-extra.service + +%post +%service_add_post sound-extra.service + +%preun +%service_del_preun sound-extra.service + +%postun +%service_del_postun sound-extra.service %files -f %{name}.lang %license COPYING @@ -108,6 +127,7 @@ mkdir -p %{buildroot}%{_localstatedir}/lib/alsa %{_udevdir} %{_unitdir}/*.service %{_unitdir}/sound.target.wants +%{_libexecdir}/systemd/scripts %{_localstatedir}/lib/alsa %files -n alsabat diff --git a/load-sound-modules.sh b/load-sound-modules.sh new file mode 100644 index 0000000..282a580 --- /dev/null +++ b/load-sound-modules.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +test -r /etc/sysconfig/sound && . /etc/sysconfig/sound + +if [ "$LOAD_OSS_EMUL_MODULES" = "yes" ]; then + /sbin/modprobe -q snd-mixer-oss + /sbin/modprobe -q snd-pcm-oss +fi + +if [ "$LOAD_SEQUENCER" = "yes" ]; then + /sbin/modprobe -q snd-seq +fi + +if [ -r /proc/asound/seq/drivers ]; then + OLDIFS="$IFS" + IFS="," + while read t x c; do + /sbin/modprobe -q $t + done < /proc/asound/seq/drivers + IFS="$OLDIFS" +fi + +if [ -d /proc/asound/seq ]; then + if [ "$LOAD_OSS_SEQ_MODULE" = "yes" ]; then + /sbin/modprobe -q snd-seq-oss + fi +fi + +exit 0 diff --git a/sound-extra.service b/sound-extra.service new file mode 100644 index 0000000..89c1744 --- /dev/null +++ b/sound-extra.service @@ -0,0 +1,8 @@ +[Unit] +Description=Load extra kernel modules for sound stuff +After=alsasound.service +ConditionPathExists=/proc/asound + +[Service] +Type=oneshot +ExecStart=/usr/lib/systemd/scripts/load-sound-modules.sh