[alsa-devel] [PATCH] alsactl: Check for state file existence in systemd unit

Paul Menzel paulepanter at users.sourceforge.net
Tue Dec 27 17:41:46 CET 2016


Date: Sat, 19 Oct 2013 10:12:19 +0000

Check for the existence of the state file, by default
`/var/lib/alsa/asound.state`, before doing anything in the systemd
service unit `alsa-restore.service`.

If the state file is not present, `alsactl` will fail with exit code
99.

Signed-off-by: Paul Menzel <paulepanter at users.sourceforge.net>
CC: Jordi Mallach <jordi at debian.org>
---
Please apply with `git am saved-messages.mbox`.

 alsactl/Makefile.am             | 1 +
 alsactl/alsa-restore.service.in | 1 +
 2 files changed, 2 insertions(+)

diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am
index cac8094..b691dfa 100644
--- a/alsactl/Makefile.am
+++ b/alsactl/Makefile.am
@@ -40,6 +40,7 @@ endif
 edit = \
 	$(SED) -r -e 's, at sbindir\@,$(sbindir),g' \
 		  -e 's, at mydatadir\@,$(mydatadir),g' \
+			-e 's, at asoundstatedir\@,$(ASOUND_STATE_DIR),g' \
 		  -e 's, at daemonswitch\@,$(ALSACTL_DAEMONSWITCH),g' \
 							< $< > $@ || rm $@
 
diff --git a/alsactl/alsa-restore.service.in b/alsactl/alsa-restore.service.in
index 2884098..f3cd86b 100644
--- a/alsactl/alsa-restore.service.in
+++ b/alsactl/alsa-restore.service.in
@@ -7,6 +7,7 @@
 Description=Save/Restore Sound Card State
 ConditionPathExists=!@daemonswitch@
 ConditionPathExistsGlob=/dev/snd/control*
+ConditionPathExists=@asoundstatedir@/asound.state
 After=alsa-state.service
 
 [Service]
-- 
2.11.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20161227/2b8a003b/attachment.sig>


More information about the Alsa-devel mailing list