Skip to contentSkip to conversation

alsactl: Only start restore service when asoundrc file exists

PATCH Applied Ikey Doherty 2 participants 2 messages Dec 12, 2017 – Dec 14, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alsactl: Only start restore service when asoundrc file exists

This solves the chicken and egg problem on fresh installations whereby the alsa state file does not yet exist, and alsa-restore unit attempted to launch without first having a state file.

---
 alsactl/Makefile.am             | 1 +
 alsactl/alsa-restore.service.in | 1 +
 2 files changed, 2 insertions(+)
alsactl/Makefile.am +1 -0
index 90fab9d..aaaf74e 100644
@@ -41,6 +41,7 @@ edit = \
 	$(SED) -r -e 's,@sbindir\@,$(sbindir),g' \
 		  -e 's,@mydatadir\@,$(mydatadir),g' \
 		  -e 's,@daemonswitch\@,$(ALSACTL_DAEMONSWITCH),g' \
+		  -e 's,@asoundrcfile\@,$(ASOUND_STATE_DIR)/asound.state,g' \
 							< $< > $@ || rm $@
 
 alsa-state.service: alsa-state.service.in
alsactl/alsa-restore.service.in +1 -0
index 80fd5fd..a84c2e8 100644
@@ -7,6 +7,7 @@
 Description=Save/Restore Sound Card State
 ConditionPathExists=!@daemonswitch@
 ConditionPathExistsGlob=/dev/snd/control*
+ConditionPathExists=@asoundrcfile@
 
 [Service]
 Type=oneshot
Signature · 1 line
2.15.1
Applied
#1 lore raw
Quoted 6 lines · Ikey Doherty

This solves the chicken and egg problem on fresh installations whereby the alsa state file does not yet exist, and alsa-restore unit attempted to launch without first having a state file.

Applied, thanks.

Takashi