Skip to contentSkip to conversation

alsactl: Check for state file existence in systemd unit

PATCH In review Paul Menzel 2 participants 2 messages Dec 27, 2016 – Dec 28, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alsactl: Check for state file existence in systemd unit

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.

---
Please apply with git am saved-messages.mbox.

 alsactl/Makefile.am             | 1 +
 alsactl/alsa-restore.service.in | 1 +
 2 files changed, 2 insertions(+)
alsactl/Makefile.am +1 -0
index cac8094..b691dfa 100644
@@ -40,6 +40,7 @@ endif
 edit = \
 	$(SED) -r -e 's,@sbindir\@,$(sbindir),g' \
 		  -e 's,@mydatadir\@,$(mydatadir),g' \
+			-e 's,@asoundstatedir\@,$(ASOUND_STATE_DIR),g' \
 		  -e 's,@daemonswitch\@,$(ALSACTL_DAEMONSWITCH),g' \
 							< $< > $@ || rm $@
 
alsactl/alsa-restore.service.in +1 -0
index 2884098..f3cd86b 100644
@@ -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]
Signature · 1 line
2.11.0
#1 lore raw
Quoted 7 lines · Paul Menzel

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.

Quoted 5 lines

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

Well, but then this service won't be triggered for saving the state at shutdown if the state file isn't present beforehand, no?

Takashi

Quoted 33 lines

---
Please apply with git am saved-messages.mbox.

 alsactl/Makefile.am             | 1 +
 alsactl/alsa-restore.service.in | 1 +
 2 files changed, 2 insertions(+)
alsactl/Makefile.am +1 -0
index cac8094..b691dfa 100644
@@ -40,6 +40,7 @@ endif
 edit = \
 	$(SED) -r -e 's,@sbindir\@,$(sbindir),g' \
 		  -e 's,@mydatadir\@,$(mydatadir),g' \
+			-e 's,@asoundstatedir\@,$(ASOUND_STATE_DIR),g' \
 		  -e 's,@daemonswitch\@,$(ALSACTL_DAEMONSWITCH),g' \
 							< $< > $@ || rm $@
 
alsactl/alsa-restore.service.in +1 -0
index 2884098..f3cd86b 100644
@@ -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]
Signature · 1 line
2.11.0