summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Mayo <aklhfex@gmail.com>2017-09-26 19:36:12 +0100
committerTakashi Iwai <tiwai@suse.de>2017-10-06 14:32:16 +0200
commitf72a296d23dd49e239ae8268498351953ef7bd94 (patch)
treecf1a07bbca2e824457639bbd92e27b0903bb66c2
parentdbd4fc84f82bd28ec54cb1c494570dbc6e04302a (diff)
downloadalsa-utils-f72a296d23dd49e239ae8268498351953ef7bd94.tar.gz
alsactl: Move systemd unit start-up from basic.target to sound.target
Ensures soundcard is ready before restoring state. sound.target added to systemd in v18: https://cgit.freedesktop.org/systemd/systemd/commit/?id=88dfa2938af Simplify dependencies: - After=alsa-state.service is not needed because both units test for @daemonswitch@ with opposite outcomes. - After=sysinit.target is automatically added by systemd. First proposed by Tom Yan. Signed-off-by: Chris Mayo <aklhfex@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--INSTALL3
-rw-r--r--alsactl/Makefile.am4
-rw-r--r--alsactl/alsa-restore.service.in1
-rw-r--r--alsactl/alsa-state.service.in1
-rw-r--r--configure.ac6
5 files changed, 10 insertions, 5 deletions
diff --git a/INSTALL b/INSTALL
index d95bb97..5f20814 100644
--- a/INSTALL
+++ b/INSTALL
@@ -10,6 +10,9 @@ the develop package additionally to link with this library.
alsaconf requires dialog or whiptail program to run properly.
+If systemd (minimum version 18) is installed it will be used to run
+alsactl to store and restore settings.
+
Installation
------------
diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am
index cac8094..90fab9d 100644
--- a/alsactl/Makefile.am
+++ b/alsactl/Makefile.am
@@ -29,8 +29,8 @@ systemdsystemunit_DATA = \
install-data-hook:
$(MKDIR_P) -m 0755 \
- $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants
- ( cd $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants && \
+ $(DESTDIR)$(systemdsystemunitdir)/sound.target.wants
+ ( cd $(DESTDIR)$(systemdsystemunitdir)/sound.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)
diff --git a/alsactl/alsa-restore.service.in b/alsactl/alsa-restore.service.in
index 2583d4c..80fd5fd 100644
--- a/alsactl/alsa-restore.service.in
+++ b/alsactl/alsa-restore.service.in
@@ -7,7 +7,6 @@
Description=Save/Restore Sound Card State
ConditionPathExists=!@daemonswitch@
ConditionPathExistsGlob=/dev/snd/control*
-After=alsa-state.service
[Service]
Type=oneshot
diff --git a/alsactl/alsa-state.service.in b/alsactl/alsa-state.service.in
index f1321d6..5a8fe5e 100644
--- a/alsactl/alsa-state.service.in
+++ b/alsactl/alsa-state.service.in
@@ -6,7 +6,6 @@
[Unit]
Description=Manage Sound Card State (restore and store)
ConditionPathExists=@daemonswitch@
-After=sysinit.target
[Service]
Type=simple
diff --git a/configure.ac b/configure.ac
index 0ff4fad..a755e47 100644
--- a/configure.ac
+++ b/configure.ac
@@ -383,13 +383,17 @@ SAVE_UTIL_VERSION
AC_SUBST(LIBRT)
dnl Check for systemd
+PKG_CHECK_MODULES(SYSTEMD, [systemd >= 18],
+ [have_min_systemd="yes"],
+ [have_min_systemd="no"])
AC_ARG_WITH([systemdsystemunitdir],
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
[], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
if test "x$with_systemdsystemunitdir" != xno; then
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
fi
-AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
+AM_CONDITIONAL(HAVE_SYSTEMD, [test "$have_min_systemd" = "yes" \
+ -a -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
AC_ARG_WITH([asound-state-dir],
AS_HELP_STRING([--with-asound-state-dir=DIR], [Directory to place asound.state file in]),