]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsactl: Move systemd unit start-up from basic.target to sound.target
authorChris Mayo <aklhfex@gmail.com>
Tue, 26 Sep 2017 18:36:12 +0000 (19:36 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 6 Oct 2017 12:32:16 +0000 (14:32 +0200)
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>
INSTALL
alsactl/Makefile.am
alsactl/alsa-restore.service.in
alsactl/alsa-state.service.in
configure.ac

diff --git a/INSTALL b/INSTALL
index d95bb97b2bc382705bebd4c8f93b67008297bf43..5f20814c155e977d603cb51bac4b2a8c2832d4bf 100644 (file)
--- 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
 ------------
 
index cac8094687de3b71292c2d234c5a47698b806f93..90fab9d13ccc8d2ae37aaf74a7db5b340487e038 100644 (file)
@@ -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)
index 2583d4c0006d4991b51bae9f89473ca1a69f7c3e..80fd5fd482037dcea7f31e3cc2fe7cab91dca898 100644 (file)
@@ -7,7 +7,6 @@
 Description=Save/Restore Sound Card State
 ConditionPathExists=!@daemonswitch@
 ConditionPathExistsGlob=/dev/snd/control*
-After=alsa-state.service
 
 [Service]
 Type=oneshot
index f1321d63a0ca4bb93e481e90135ee1ead1df44c7..5a8fe5eeed7efce650d5ab21b4aa1d15fb5575c3 100644 (file)
@@ -6,7 +6,6 @@
 [Unit]
 Description=Manage Sound Card State (restore and store)
 ConditionPathExists=@daemonswitch@
-After=sysinit.target
 
 [Service]
 Type=simple
index 0ff4fad187b2bf825b0cc0d184e7c55806859d52..a755e473c62821d3b1d2e58dacfd5b09af3dc663 100644 (file)
@@ -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]),