]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsactl: revert back old systemd static units with the /etc/alsa/state-daemon.conf...
authorJaroslav Kysela <perex@perex.cz>
Wed, 10 Apr 2013 08:23:16 +0000 (10:23 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 10 Apr 2013 08:29:19 +0000 (10:29 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
.gitignore
alsactl/90-alsa-restore.rules.in
alsactl/Makefile.am
alsactl/alsa-restore.service.in [new file with mode: 0644]
alsactl/alsa-state.service.in
alsactl/alsa-store.service.in [new file with mode: 0644]

index 096b126c41655d1d40b75c9b1e28f59384257f20..fd5a135691a1e4d407645433ee6eeabbcc27a8ac 100644 (file)
@@ -26,6 +26,8 @@ ABOUT-NLS
 alsactl/alsactl
 alsactl/alsactl_init.7
 alsactl/alsa-state.service
+alsactl/alsa-restore.service
+alsactl/alsa-store.service
 alsaconf/alsaconf
 alsamixer/alsamixer
 amidi/amidi
index fe0e1ed0ae248d810f433a2af5c72e86e17dfaf0..3ce9a6540d551cdfe1d10a43e7f767c27c551fe7 100644 (file)
@@ -1,2 +1,8 @@
-ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS=="card*", \
-        RUN+="@sbindir@/alsactl nrestore $attr{number}"
+ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", GOTO="alsa_restore_go"
+GOTO="alsa_restore_end"
+
+LABEL="alsa_restore_go"
+TEST!="/etc/alsa/state-daemon.conf", RUN+="@sbindir@/alsactl restore $attr{number}"
+TEST=="/etc/alsa/state-daemon.conf", RUN+="@sbindir@/alsactl nrestore $attr{number}"
+
+LABEL="alsa_restore_end"
index 0659b283b84faa16a2217be8683b161d8a557df1..dbc00f157c02cab8d2f240a08b0385d742b7723b 100644 (file)
@@ -17,15 +17,18 @@ dist_udevrules_DATA = \
 if HAVE_SYSTEMD
 
 systemdsystemunit_DATA = \
-       alsa-state.service
+       alsa-state.service \
+       alsa-restore.service \
+       alsa-store.service
 
 install-data-hook:
        $(MKDIR_P) -m 0755 \
                $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants \
                $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants
        ( cd $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants && \
-               rm -f alsa-restore.service && \
-               $(LN_S) ../alsa-restore.service alsa-restore.service )
+               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 )
@@ -38,15 +41,25 @@ edit = \
 alsa-state.service: alsa-state.service.in
        $(edit)
 
+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
diff --git a/alsactl/alsa-restore.service.in b/alsactl/alsa-restore.service.in
new file mode 100644 (file)
index 0000000..a0d752c
--- /dev/null
@@ -0,0 +1,17 @@
+#
+# 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=Restore Sound Card State
+ConditionPathExists=!/etc/alsa/state-daemon.conf
+DefaultDependencies=no
+After=alsa-state.service
+Before=shutdown.target
+Conflicts=shutdown.target
+
+[Service]
+Type=oneshop
+ExecStart=-@sbindir@/alsactl restore
+StandardOutput=syslog
index fc9914b4bf6bcae3cbd4d4131c766d33d0a10396..94d138be045e52a4044a3790805b875ab00ac51b 100644 (file)
@@ -1,5 +1,11 @@
+#
+# 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=Manage Sound Card State (restore and store)
+ConditionPathExists=/etc/alsa/state-daemon.conf
 DefaultDependencies=no
 After=sysinit.target
 Before=shutdown.target
diff --git a/alsactl/alsa-store.service.in b/alsactl/alsa-store.service.in
new file mode 100644 (file)
index 0000000..b2e0ac9
--- /dev/null
@@ -0,0 +1,15 @@
+#
+# 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=!/etc/alsa/state-daemon.conf
+DefaultDependencies=no
+Before=shutdown.target
+
+[Service]
+Type=oneshot
+ExecStart=@sbindir@/alsactl store
+StandardOutput=syslog