summaryrefslogtreecommitdiff
path: root/alsactl
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2013-04-10 10:23:16 +0200
committerJaroslav Kysela <perex@perex.cz>2013-04-10 10:29:19 +0200
commit8b34bf25c02693899b03768b0eef628eb1d7bb6e (patch)
tree69e4a60eb54b033f17029dc5aa6d39d4a825ec59 /alsactl
parent611249ae26f435429dbe1894e210704a723ee277 (diff)
alsactl: revert back old systemd static units with the /etc/alsa/state-daemon.conf switch
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'alsactl')
-rw-r--r--alsactl/90-alsa-restore.rules.in10
-rw-r--r--alsactl/Makefile.am19
-rw-r--r--alsactl/alsa-restore.service.in17
-rw-r--r--alsactl/alsa-state.service.in6
-rw-r--r--alsactl/alsa-store.service.in15
5 files changed, 62 insertions, 5 deletions
diff --git a/alsactl/90-alsa-restore.rules.in b/alsactl/90-alsa-restore.rules.in
index fe0e1ed..3ce9a65 100644
--- a/alsactl/90-alsa-restore.rules.in
+++ b/alsactl/90-alsa-restore.rules.in
@@ -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"
diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am
index 0659b28..dbc00f1 100644
--- a/alsactl/Makefile.am
+++ b/alsactl/Makefile.am
@@ -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
index 0000000..a0d752c
--- /dev/null
+++ b/alsactl/alsa-restore.service.in
@@ -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
diff --git a/alsactl/alsa-state.service.in b/alsactl/alsa-state.service.in
index fc9914b..94d138b 100644
--- a/alsactl/alsa-state.service.in
+++ b/alsactl/alsa-state.service.in
@@ -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
index 0000000..b2e0ac9
--- /dev/null
+++ b/alsactl/alsa-store.service.in
@@ -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