From ecd3728b264b94de239932555b7046f1ddb936b2 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Sun, 11 Nov 2018 18:06:36 -0800 Subject: [PATCH] Fix systemd spec file macros Ensure that the _unitdir, _presetdir, _modulesloaddir, and _systemdgeneratordir macros are always defined. If not set them to the expected default values. Pass all of these options to ./configure and package the resulting files in those locations. Additionally, set __brp_mangle_shebangs_exclude_from until the conversion to Python 3 is complete so they may be built cleanly under mock. Reviewed-by: Neal Gompa Reviewed-by: Tony Hutter Signed-off-by: Brian Behlendorf Closes #7567 Closes #8119 --- config/user-systemd.m4 | 2 +- rpm/generic/zfs-dkms.spec.in | 3 +++ rpm/generic/zfs-kmod.spec.in | 3 +++ rpm/generic/zfs.spec.in | 23 +++++++++++++++++++---- rpm/redhat/zfs-kmod.spec.in | 3 +++ 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/config/user-systemd.m4 b/config/user-systemd.m4 index 5d1f5618a948..3e6a4a281f3c 100644 --- a/config/user-systemd.m4 +++ b/config/user-systemd.m4 @@ -18,7 +18,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_SYSTEMD], [ AC_ARG_WITH(systemdmodulesloaddir, AC_HELP_STRING([--with-systemdmodulesloaddir=DIR], [install systemd module load files into dir [[/usr/lib/modules-load.d]]]), - systemdmoduleloaddir=$withval,systemdmodulesloaddir=/usr/lib/modules-load.d) + systemdmodulesloaddir=$withval,systemdmodulesloaddir=/usr/lib/modules-load.d) AC_ARG_WITH(systemdgeneratordir, AC_HELP_STRING([--with-systemdgeneratordir=DIR], diff --git a/rpm/generic/zfs-dkms.spec.in b/rpm/generic/zfs-dkms.spec.in index c332d8d5366d..7b6612b89c0c 100644 --- a/rpm/generic/zfs-dkms.spec.in +++ b/rpm/generic/zfs-dkms.spec.in @@ -4,6 +4,9 @@ %define not_rpm 1 %endif +# See comment in zfs.spec.in. +%global __brp_mangle_shebangs_exclude_from arc_summary.py|arcstat.py|dbufstat.py|test-runner.py|zts-report.py + %define module @PACKAGE@ %define mkconf scripts/dkms.mkconf diff --git a/rpm/generic/zfs-kmod.spec.in b/rpm/generic/zfs-kmod.spec.in index da2798c3d8d2..4a8f662316cc 100644 --- a/rpm/generic/zfs-kmod.spec.in +++ b/rpm/generic/zfs-kmod.spec.in @@ -1,5 +1,8 @@ %define module @PACKAGE@ +# See comment in zfs.spec.in. +%global __brp_mangle_shebangs_exclude_from arc_summary.py|arcstat.py|dbufstat.py|test-runner.py|zts-report.py + %if !%{defined ksrc} %if 0%{?rhel}%{?fedora} %define ksrc ${kernel_version##*___} diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in index 7c96caacfa17..55edbc83fa80 100644 --- a/rpm/generic/zfs.spec.in +++ b/rpm/generic/zfs.spec.in @@ -28,11 +28,26 @@ %endif %endif -# Set the default _initconfdir when undefined. %if %{undefined _initconfdir} %global _initconfdir /etc/sysconfig %endif +%if %{undefined _unitdir} +%global _unitdir %{_prefix}/lib/systemd/system +%endif + +%if %{undefined _presetdir} +%global _presetdir %{_prefix}/lib/systemd/system-preset +%endif + +%if %{undefined _modulesloaddir} +%global _modulesloaddir %{_prefix}/lib/modules-load.d +%endif + +%if %{undefined _systemdgeneratordir} +%global _systemdgeneratordir %{_prefix}/lib/systemd/system-generators +%endif + %bcond_with debug %bcond_with debuginfo %bcond_with asan @@ -278,7 +293,7 @@ image which is ZFS aware. %endif %if 0%{?_systemd} - %define systemd --enable-systemd --with-systemdunitdir=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --disable-sysvinit + %define systemd --enable-systemd --with-systemdunitdir=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --with-systemdmodulesloaddir=%{_modulesloaddir} --with-systemdgeneratordir=%{_systemdgeneratordir} --disable-sysvinit %define systemd_svcs zfs-import-cache.service zfs-import-scan.service zfs-mount.service zfs-share.service zfs-zed.service zfs.target zfs-import.target %else %define systemd --enable-sysvinit --disable-systemd @@ -374,10 +389,10 @@ systemctl --system daemon-reload >/dev/null || true %{_udevdir}/zvol_id %{_udevdir}/rules.d/* %if 0%{?_systemd} -/usr/lib/modules-load.d/* %{_unitdir}/* %{_presetdir}/* -%{_generatordir}/* +%{_modulesloaddir}/* +%{_systemdgeneratordir}/* %else %config(noreplace) %{_sysconfdir}/init.d/* %config(noreplace) %{_initconfdir}/zfs diff --git a/rpm/redhat/zfs-kmod.spec.in b/rpm/redhat/zfs-kmod.spec.in index 28a64841800d..473f2d032509 100644 --- a/rpm/redhat/zfs-kmod.spec.in +++ b/rpm/redhat/zfs-kmod.spec.in @@ -1,6 +1,9 @@ %bcond_with debug %bcond_with debuginfo +# See comment in zfs.spec.in. +%global __brp_mangle_shebangs_exclude_from arc_summary.py|arcstat.py|dbufstat.py|test-runner.py|zts-report.py + Name: @PACKAGE@-kmod Version: @VERSION@ Release: @RELEASE@%{?dist}