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
This commit is contained in:
Sjoerd Simons 2013-08-12 19:27:27 +02:00 committed by Colin Walters
parent a04bda126c
commit a00eb681a0
3 changed files with 19 additions and 9 deletions

View File

@ -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

View File

@ -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 ""

View File

@ -31,3 +31,6 @@ ExecStart=/usr/sbin/ostree-remount
StandardInput=null
StandardOutput=syslog
StandardError=syslog+console
[Install]
WantedBy=local-fs.target