From a00eb681a01476534d59e3de715ad9e864be8028 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Mon, 12 Aug 2013 19:27:27 +0200 Subject: [PATCH] Install systemd units in the right location Debian uses /lib/systemd/system for system unit files, while i'm putting ostree under the /usr prefix which means the hardcoded path fails. Leave it to configure to work out the right location for systemd units (method copied from pollkit). Furthermore instead of installing the unit in local-fs.target.wants by hand add a [Install] section so systemctl enable does the right thing https://bugzilla.gnome.org/show_bug.cgi?id=705864 --- Makefile-dracut.am | 8 +------- configure.ac | 17 +++++++++++++++-- src/dracut/ostree-remount.service | 3 +++ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Makefile-dracut.am b/Makefile-dracut.am index 2837e985..d9e0dd4b 100644 --- a/Makefile-dracut.am +++ b/Makefile-dracut.am @@ -23,13 +23,7 @@ dracutmoddir = $(prefix)/lib/dracut/modules.d/98ostree dracutmod_SCRIPTS = src/dracut/module-setup.sh dracutmod_DATA = src/dracut/ostree-prepare-root.service -systemdunitdir = $(prefix)/lib/systemd/system -systemdunit_DATA = src/dracut/ostree-remount.service - -INSTALL_DATA_HOOKS += install-remount-service-data-hook -install-remount-service-data-hook: - mkdir -p $(DESTDIR)$(systemdunitdir)/local-fs.target.wants/ - ln -s ../ostree-remount.service $(DESTDIR)$(systemdunitdir)/local-fs.target.wants/ostree-remount.service +systemdsystemunit_DATA = src/dracut/ostree-remount.service dracutconfdir = $(sysconfdir)/dracut.conf.d dracutconf_DATA = src/dracut/ostree.conf diff --git a/configure.ac b/configure.ac index 675f76ec..cf504870 100644 --- a/configure.ac +++ b/configure.ac @@ -123,6 +123,16 @@ AC_ARG_WITH(dracut, [with_dracut=no]) AM_CONDITIONAL(BUILDOPT_DRACUT, test x$with_dracut = xyes) +AS_IF([test "x$with_dracut" = "xyes"], [ + AC_ARG_WITH([systemdsystemunitdir], + AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), + [], + [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) + AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [ + AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) + ]) +]) + AC_CONFIG_FILES([ Makefile embedded-dependencies/Makefile @@ -140,5 +150,8 @@ echo " libsoup (retrieve remote HTTP repositories): $with_soup libarchive (parse tar files directly): $with_libarchive documentation: $enable_documentation - dracut: $with_dracut -" + dracut: $with_dracut" +if test "x$with_dracut" = "xyes" ; then + echo " systemd unit dir: $with_systemdsystemunitdir" +fi +echo "" diff --git a/src/dracut/ostree-remount.service b/src/dracut/ostree-remount.service index 0c813ccb..26b7d390 100644 --- a/src/dracut/ostree-remount.service +++ b/src/dracut/ostree-remount.service @@ -31,3 +31,6 @@ ExecStart=/usr/sbin/ostree-remount StandardInput=null StandardOutput=syslog StandardError=syslog+console + +[Install] +WantedBy=local-fs.target