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 <ngompa@datto.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #7567
Closes #8119
This commit is contained in:
Brian Behlendorf 2018-11-11 18:06:36 -08:00 committed by GitHub
parent 0500bfd0b9
commit ecd3728b26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 5 deletions

View File

@ -18,7 +18,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_SYSTEMD], [
AC_ARG_WITH(systemdmodulesloaddir, AC_ARG_WITH(systemdmodulesloaddir,
AC_HELP_STRING([--with-systemdmodulesloaddir=DIR], AC_HELP_STRING([--with-systemdmodulesloaddir=DIR],
[install systemd module load files into dir [[/usr/lib/modules-load.d]]]), [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_ARG_WITH(systemdgeneratordir,
AC_HELP_STRING([--with-systemdgeneratordir=DIR], AC_HELP_STRING([--with-systemdgeneratordir=DIR],

View File

@ -4,6 +4,9 @@
%define not_rpm 1 %define not_rpm 1
%endif %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 module @PACKAGE@
%define mkconf scripts/dkms.mkconf %define mkconf scripts/dkms.mkconf

View File

@ -1,5 +1,8 @@
%define module @PACKAGE@ %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 !%{defined ksrc}
%if 0%{?rhel}%{?fedora} %if 0%{?rhel}%{?fedora}
%define ksrc ${kernel_version##*___} %define ksrc ${kernel_version##*___}

View File

@ -28,11 +28,26 @@
%endif %endif
%endif %endif
# Set the default _initconfdir when undefined.
%if %{undefined _initconfdir} %if %{undefined _initconfdir}
%global _initconfdir /etc/sysconfig %global _initconfdir /etc/sysconfig
%endif %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 debug
%bcond_with debuginfo %bcond_with debuginfo
%bcond_with asan %bcond_with asan
@ -278,7 +293,7 @@ image which is ZFS aware.
%endif %endif
%if 0%{?_systemd} %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 %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 %else
%define systemd --enable-sysvinit --disable-systemd %define systemd --enable-sysvinit --disable-systemd
@ -374,10 +389,10 @@ systemctl --system daemon-reload >/dev/null || true
%{_udevdir}/zvol_id %{_udevdir}/zvol_id
%{_udevdir}/rules.d/* %{_udevdir}/rules.d/*
%if 0%{?_systemd} %if 0%{?_systemd}
/usr/lib/modules-load.d/*
%{_unitdir}/* %{_unitdir}/*
%{_presetdir}/* %{_presetdir}/*
%{_generatordir}/* %{_modulesloaddir}/*
%{_systemdgeneratordir}/*
%else %else
%config(noreplace) %{_sysconfdir}/init.d/* %config(noreplace) %{_sysconfdir}/init.d/*
%config(noreplace) %{_initconfdir}/zfs %config(noreplace) %{_initconfdir}/zfs

View File

@ -1,6 +1,9 @@
%bcond_with debug %bcond_with debug
%bcond_with debuginfo %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 Name: @PACKAGE@-kmod
Version: @VERSION@ Version: @VERSION@
Release: @RELEASE@%{?dist} Release: @RELEASE@%{?dist}