]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsactl: Manage both save and restore in a single unit
authorTakashi Iwai <tiwai@suse.de>
Tue, 29 Sep 2015 15:26:34 +0000 (17:26 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 29 Sep 2015 15:54:17 +0000 (17:54 +0200)
With RemainAfterExit=true, we can manage both save and restore of the
card state in a single unit file.  This will fix also the case where
systemd reloads the service; with two individual units, it will
restore the previous state before saving, and may lead to inconsistent
state suddenly.

Also fix alsa-state.service as well to make both start and stop
working in a simpler way.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=929619
Signed-off-by: Takashi Iwai <tiwai@suse.de>
alsactl/Makefile.am
alsactl/alsa-restore.service.in
alsactl/alsa-state.service.in
alsactl/alsa-store.service.in [deleted file]

index 47f06e906ced88d1460614722353bdf8806d4f70..cac8094687de3b71292c2d234c5a47698b806f93 100644 (file)
@@ -25,20 +25,15 @@ if HAVE_SYSTEMD
 
 systemdsystemunit_DATA = \
        alsa-state.service \
-       alsa-restore.service \
-       alsa-store.service
+       alsa-restore.service
 
 install-data-hook:
        $(MKDIR_P) -m 0755 \
-               $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants \
-               $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants
+               $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants
        ( cd $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants && \
                rm -f alsa-state.service alsa-restore.service && \
                $(LN_S) ../alsa-state.service alsa-state.service && \
                $(LN_S) ../alsa-restore.service alsa-restore.service)
-       ( cd $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants && \
-               rm -f alsa-store.service && \
-               $(LN_S) ../alsa-store.service alsa-store.service )
 
 endif
 
@@ -54,22 +49,17 @@ alsa-state.service: alsa-state.service.in
 alsa-restore.service: alsa-restore.service.in
        $(edit)
 
-alsa-store.service: alsa-store.service.in
-       $(edit)
-
 90-alsa-restore.rules: 90-alsa-restore.rules.in
        $(edit)
 
 EXTRA_DIST += \
        alsa-state.service.in \
        alsa-restore.service.in \
-       alsa-store.service.in \
        90-alsa-restore.rules.in
 
 CLEANFILES = \
        alsa-state.service \
        alsa-restore.service \
-       alsa-store.service \
        90-alsa-restore.rules
 
 %.7: %.xml
index d1a74d637457597a032978a800220e467f52da38..2884098c26f0a8c4d2f4bfee48faa88e43a9d3cb 100644 (file)
@@ -4,15 +4,14 @@
 #
 
 [Unit]
-Description=Restore Sound Card State
+Description=Save/Restore Sound Card State
 ConditionPathExists=!@daemonswitch@
 ConditionPathExistsGlob=/dev/snd/control*
-DefaultDependencies=no
 After=alsa-state.service
-Before=shutdown.target
-Conflicts=shutdown.target
 
 [Service]
 Type=oneshot
+RemainAfterExit=true
 ExecStart=-@sbindir@/alsactl restore
+ExecStop=-@sbindir@/alsactl store
 StandardOutput=syslog
index 56c12c1045651b149c6ae4081d484d047a8e595c..f1321d63a0ca4bb93e481e90135ee1ead1df44c7 100644 (file)
@@ -6,10 +6,7 @@
 [Unit]
 Description=Manage Sound Card State (restore and store)
 ConditionPathExists=@daemonswitch@
-DefaultDependencies=no
 After=sysinit.target
-Before=shutdown.target
-Conflicts=shutdown.target
 
 [Service]
 Type=simple
diff --git a/alsactl/alsa-store.service.in b/alsactl/alsa-store.service.in
deleted file mode 100644 (file)
index c89cfff..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Note that two different ALSA card state management schemes exist and they
-# can be switched using a file exist check - /etc/alsa/state-daemon.conf .
-#
-
-[Unit]
-Description=Store Sound Card State
-ConditionPathExists=!@daemonswitch@
-ConditionPathExistsGlob=/dev/snd/control*
-DefaultDependencies=no
-Before=shutdown.target
-
-[Service]
-Type=oneshot
-ExecStart=@sbindir@/alsactl store
-StandardOutput=syslog