]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Fix --with-systemd on Debian-based distributions (#6963)
authorLOLi <loli10K@users.noreply.github.com>
Sun, 17 Dec 2017 22:08:48 +0000 (23:08 +0100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Sun, 17 Dec 2017 22:08:48 +0000 (14:08 -0800)
These changes propagate the "--with-systemd" configure option to the
RPM spec file, allowing Debian-based distributions to package
systemd-related files.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #6591
Closes #6963

config/user-systemd.m4
config/zfs-build.m4
rpm/generic/zfs.spec.in

index c2105abce0ece5bd97323e545e8b5a05ab652ce3..de2a44f10c6b3f9908d48ad4fdf4a8b2b42121b1 100644 (file)
@@ -2,7 +2,8 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_SYSTEMD], [
        AC_ARG_ENABLE(systemd,
                AC_HELP_STRING([--enable-systemd],
                [install systemd unit/preset files [[default: yes]]]),
-               [],enable_systemd=yes)
+               [enable_systemd=$enableval],
+               [enable_systemd=check])
 
        AC_ARG_WITH(systemdunitdir,
                AC_HELP_STRING([--with-systemdunitdir=DIR],
@@ -19,16 +20,27 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_SYSTEMD], [
                [install systemd module load files into dir [[/usr/lib/modules-load.d]]]),
                systemdmoduleloaddir=$withval,systemdmodulesloaddir=/usr/lib/modules-load.d)
 
+       AS_IF([test "x$enable_systemd" = xcheck], [
+               AS_IF([systemctl --version >/dev/null 2>&1],
+                       [enable_systemd=yes],
+                       [enable_systemd=no])
+       ])
 
-       AS_IF([test "x$enable_systemd" = xyes],
-               [
+       AC_MSG_CHECKING(for systemd support)
+       AC_MSG_RESULT([$enable_systemd])
+
+       AS_IF([test "x$enable_systemd" = xyes], [
                ZFS_INIT_SYSTEMD=systemd
                ZFS_MODULE_LOAD=modules-load.d
+               DEFINE_SYSTEMD='--with systemd --define "_unitdir $(systemdunitdir)" --define "_presetdir $(systemdpresetdir)"'
                modulesloaddir=$systemdmodulesloaddir
-               ])
+       ],[
+               DEFINE_SYSTEMD='--without systemd'
+       ])
 
        AC_SUBST(ZFS_INIT_SYSTEMD)
        AC_SUBST(ZFS_MODULE_LOAD)
+       AC_SUBST(DEFINE_SYSTEMD)
        AC_SUBST(systemdunitdir)
        AC_SUBST(systemdpresetdir)
        AC_SUBST(modulesloaddir)
index 17cc80462c766a8601971fee3164e76760067d48..5eaa49c8759f811c09bf9c27b263302111104f7b 100644 (file)
@@ -160,7 +160,7 @@ AC_DEFUN([ZFS_AC_RPM], [
        ])
 
        RPM_DEFINE_COMMON='--define "$(DEBUG_ZFS) 1"'
-       RPM_DEFINE_UTIL='--define "_dracutdir $(dracutdir)" --define "_udevdir $(udevdir)" --define "_udevruledir $(udevruledir)" --define "_initconfdir $(DEFAULT_INITCONF_DIR)" $(DEFINE_INITRAMFS)'
+       RPM_DEFINE_UTIL='--define "_dracutdir $(dracutdir)" --define "_udevdir $(udevdir)" --define "_udevruledir $(udevruledir)" --define "_initconfdir $(DEFAULT_INITCONF_DIR)" $(DEFINE_INITRAMFS) $(DEFINE_SYSTEMD)'
        RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)" --define "require_spldir $(SPL)" --define "require_splobj $(SPL_OBJ)" --define "ksrc $(LINUX)" --define "kobj $(LINUX_OBJ)"'
        RPM_DEFINE_DKMS=
 
index b37b348eeb57b0e5af99fc6a6488693f332b2cbd..20bb36e4eaa53caf45653acbb19e7e510f254b8e 100644 (file)
@@ -88,12 +88,15 @@ BuildRequires:  libudev-devel
 BuildRequires:  libattr-devel
 BuildRequires:  openssl-devel
 Requires:       openssl
+%if 0%{?_systemd}
+BuildRequires: systemd
+%endif
 %endif
+
 %if 0%{?_systemd}
 Requires(post): systemd
 Requires(preun): systemd
 Requires(postun): systemd
-BuildRequires: systemd
 %endif
 
 # The zpool iostat/status -c scripts call some utilities like lsblk and iostat