All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] alsactl: Check for state file existence in systemd unit
@ 2016-12-27 16:41 Paul Menzel
  2016-12-28 16:08 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Menzel @ 2016-12-27 16:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: Jordi Mallach


[-- Attachment #1.1: Type: text/plain, Size: 1401 bytes --]

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@users.sourceforge.net>
CC: Jordi Mallach <jordi@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,@sbindir\@,$(sbindir),g' \
 		  -e 's,@mydatadir\@,$(mydatadir),g' \
+			-e 's,@asoundstatedir\@,$(ASOUND_STATE_DIR),g' \
 		  -e 's,@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

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] alsactl: Check for state file existence in systemd unit
  2016-12-27 16:41 [PATCH] alsactl: Check for state file existence in systemd unit Paul Menzel
@ 2016-12-28 16:08 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2016-12-28 16:08 UTC (permalink / raw)
  To: Paul Menzel; +Cc: alsa-devel, Jordi Mallach

On Tue, 27 Dec 2016 17:41:46 +0100,
Paul Menzel wrote:
> 
> 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@users.sourceforge.net>
> CC: Jordi Mallach <jordi@debian.org>

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

> ---
> 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,@sbindir\@,$(sbindir),g' \
>  		  -e 's,@mydatadir\@,$(mydatadir),g' \
> +			-e 's,@asoundstatedir\@,$(ASOUND_STATE_DIR),g' \
>  		  -e 's,@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-28 16:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-27 16:41 [PATCH] alsactl: Check for state file existence in systemd unit Paul Menzel
2016-12-28 16:08 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.