2 %global _libdir
/%{_lib}
4 # Set the default udev directory based on distribution.
5 %if %{undefined _udevdir}
6 %if 0%{?rhel}%{?fedora}%{?centos}%{?suse_version}%{?openEuler}
7 %global _udevdir
%{_prefix}/lib
/udev
9 %global _udevdir
/lib
/udev
13 # Set the default udevrule directory based on distribution.
14 %if %{undefined _udevruledir}
15 %if 0%{?rhel}%{?fedora}%{?centos}%{?suse_version}%{?openEuler}
16 %global _udevruledir
%{_prefix}/lib
/udev
/rules.d
18 %global _udevruledir
/lib
/udev
/rules.d
22 # Set the default _bashcompletiondir directory based on distribution.
23 %if %{undefined _bashcompletiondir}
24 %if 0%{?rhel}%{?fedora}%{?centos}%{?suse_version}%{?openEuler}
25 %global _bashcompletiondir
/etc
/bash_completion.d
27 %global _bashcompletiondir
/usr
/share
/bash
-completion
31 # Set the default dracut directory based on distribution.
32 %if %{undefined _dracutdir}
33 %if 0%{?rhel}%{?fedora}%{?centos}%{?suse_version}%{?openEuler}
34 %global _dracutdir
%{_prefix}/lib
/dracut
36 %global _dracutdir
%{_prefix}/share
/dracut
40 %if %{undefined _initconfdir}
41 %global _initconfdir
/etc
/sysconfig
44 %if %{undefined _unitdir}
45 %global _unitdir
%{_prefix}/lib
/systemd
/system
48 %if %{undefined _presetdir}
49 %global _presetdir
%{_prefix}/lib
/systemd
/system
-preset
52 %if %{undefined _modulesloaddir}
53 %global _modulesloaddir
%{_prefix}/lib
/modules
-load.d
56 %if %{undefined _systemdgeneratordir}
57 %global _systemdgeneratordir
%{_prefix}/lib
/systemd
/system
-generators
60 %if %{undefined _pkgconfigdir}
61 %global _pkgconfigdir
%{_prefix}/%{_lib}/pkgconfig
72 # Generic enable switch for systemd
77 # Distros below support systemd
78 %if 0%{?rhel}%{?fedora}%{?centos}%{?suse_version}%{?openEuler}
82 # When not specified default to distribution provided version.
83 %if %{undefined __use_python}
84 %define __python
/usr
/bin
/python3
85 %define __python_pkg_version
3
87 %define __python
%{__use_python}
88 %define __python_pkg_version
%{__use_python_pkg_version}
90 %define __python_sitelib %
(%{__python} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())" 2>/dev/null || %{__python} -Esc "import sysconfig
; print
(sysconfig.get_path
('purelib'
))"
)
94 Release: @RELEASE@
%{?dist}
95 Summary: Commands to control the kernel modules and libraries
97 Group: System Environment
/Kernel
98 License: @ZFS_META_LICENSE@
99 URL: https
://github.com
/openzfs
/zfs
100 Source0: %{name}-%{version}.tar.gz
101 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n
)
102 Requires: libzpool5
%{?_isa} = %{version}-%{release}
103 Requires: libnvpair3
%{?_isa} = %{version}-%{release}
104 Requires: libuutil3
%{?_isa} = %{version}-%{release}
105 Requires: libzfs5
%{?_isa} = %{version}-%{release}
106 Requires: %{name}-kmod = %{version}
107 Provides: %{name}-kmod-common = %{version}-%{release}
108 Obsoletes
: spl
<= %{version}
110 # zfs-fuse provides the same commands and man pages that OpenZFS does.
111 # Renaming those on either side would conflict with all available documentation.
114 %if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}%{?openEuler}
115 BuildRequires
: gcc
, make
116 BuildRequires
: zlib
-devel
117 BuildRequires
: libuuid
-devel
118 BuildRequires
: libblkid
-devel
119 BuildRequires
: libudev
-devel
120 BuildRequires
: libattr
-devel
121 BuildRequires
: openssl
-devel
122 %if 0%{?fedora}%{?suse_version}%{?openEuler} || 0%{?rhel} >= 8 || 0%{?centos} >= 8
123 BuildRequires
: libtirpc
-devel
126 %if (0%{?fedora}%{?suse_version}%{?openEuler}) || (0%{?rhel} && 0%{?rhel} < 9)
127 # We don't directly use it, but if this isn't installed, rpmbuild as root can
128 # crash+corrupt rpmdb
130 BuildRequires
: ncompress
135 BuildRequires
: systemd
141 Requires(post
): systemd
142 Requires(preun
): systemd
143 Requires(postun
): systemd
146 # The zpool iostat/status -c scripts call some utilities like lsblk and iostat
151 This package contains the core ZFS
command line utilities.
153 %package -n libzpool5
154 Summary: Native ZFS pool library
for Linux
155 Group: System Environment
/Kernel
156 Obsoletes
: libzpool2
<= %{version}
157 Obsoletes
: libzpool4
<= %{version}
159 %description -n libzpool5
160 This package contains the zpool library
, which provides support
163 %if %{defined ldconfig_scriptlets}
164 %ldconfig_scriptlets -n libzpool5
166 %post -n libzpool5
-p
/sbin
/ldconfig
167 %postun -n libzpool5
-p
/sbin
/ldconfig
170 %package -n libnvpair3
171 Summary: Solaris name
-value library
for Linux
172 Group: System Environment
/Kernel
173 Obsoletes
: libnvpair1
<= %{version}
175 %description -n libnvpair3
176 This package contains routines
for packing and unpacking name
-value
177 pairs. This functionality is used to portably transport data across
178 process boundaries
, between kernel and user space
, and can be used
179 to write self describing data structures on disk.
181 %if %{defined ldconfig_scriptlets}
182 %ldconfig_scriptlets -n libnvpair3
184 %post -n libnvpair3
-p
/sbin
/ldconfig
185 %postun -n libnvpair3
-p
/sbin
/ldconfig
188 %package -n libuutil3
189 Summary: Solaris userland utility library
for Linux
190 Group: System Environment
/Kernel
191 Obsoletes
: libuutil1
<= %{version}
193 %description -n libuutil3
194 This library provides a variety of compatibility functions
for OpenZFS
:
195 * libspl
: The Solaris Porting Layer userland library
, which provides APIs
196 that
make it possible to run Solaris user code
in a Linux environment
197 with relatively minimal modification.
198 * libavl
: The Adelson
-Velskii Landis balanced binary tree manipulation
200 * libefi
: The Extensible Firmware Interface library
for GUID disk
202 * libshare
: NFS
, SMB
, and iSCSI service integration
for ZFS.
204 %if %{defined ldconfig_scriptlets}
205 %ldconfig_scriptlets -n libuutil3
207 %post -n libuutil3
-p
/sbin
/ldconfig
208 %postun -n libuutil3
-p
/sbin
/ldconfig
211 # The library version is encoded in the package name. When updating the
212 # version information it is important to add an obsoletes line below for
213 # the previous version of the package.
215 Summary: Native ZFS filesystem library
for Linux
216 Group: System Environment
/Kernel
217 Obsoletes
: libzfs2
<= %{version}
218 Obsoletes
: libzfs4
<= %{version}
220 %description -n libzfs5
221 This package provides support
for managing ZFS filesystems
223 %if %{defined ldconfig_scriptlets}
224 %ldconfig_scriptlets -n libzfs5
226 %post -n libzfs5
-p
/sbin
/ldconfig
227 %postun -n libzfs5
-p
/sbin
/ldconfig
230 %package -n libzfs5
-devel
231 Summary: Development headers
232 Group: System Environment
/Kernel
233 Requires: libzfs5
%{?_isa} = %{version}-%{release}
234 Requires: libzpool5
%{?_isa} = %{version}-%{release}
235 Requires: libnvpair3
%{?_isa} = %{version}-%{release}
236 Requires: libuutil3
%{?_isa} = %{version}-%{release}
237 Provides: libzpool5
-devel
= %{version}-%{release}
238 Provides: libnvpair3
-devel
= %{version}-%{release}
239 Provides: libuutil3
-devel
= %{version}-%{release}
240 Obsoletes
: zfs
-devel
<= %{version}
241 Obsoletes
: libzfs2
-devel
<= %{version}
242 Obsoletes
: libzfs4
-devel
<= %{version}
244 %description -n libzfs5
-devel
245 This package contains the header files needed
for building additional
246 applications against the ZFS libraries.
249 Summary: Test infrastructure
250 Group: System Environment
/Kernel
251 Requires: %{name}%{?_isa} = %{version}-%{release}
262 Requires: python
%{__python_pkg_version}
263 %if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}%{?openEuler}
264 BuildRequires
: libaio
-devel
269 This package contains
test infrastructure and support scripts
for
270 validating the file system.
273 Summary: Dracut module
274 Group: System Environment
/Kernel
276 Requires: %{name} >= %{version}
278 Requires: /usr
/bin
/awk
282 This package contains a dracut module used to construct an initramfs
283 image which is ZFS aware.
286 # Enforce `python36-` package prefix for CentOS 7
287 # since dependencies come from EPEL and are named this way
288 %package -n python
%{__python_pkg_version}-pyzfs
289 Summary: Python
%{python_version} wrapper
for libzfs_core
290 Group: Development
/Languages
/Python
293 Requires: libzfs5
= %{version}-%{release}
294 Requires: libnvpair3
= %{version}-%{release}
296 Requires: python
%{__python_pkg_version}
299 Requires: python36
-cffi
301 Requires: python
%{__python_pkg_version}-cffi
304 %if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}%{?openEuler}
306 BuildRequires
: python36
-packaging
307 BuildRequires
: python36
-devel
308 BuildRequires
: python36
-cffi
309 BuildRequires
: python36
-setuptools
311 BuildRequires
: python
%{__python_pkg_version}-packaging
312 BuildRequires
: python
%{__python_pkg_version}-devel
313 BuildRequires
: python
%{__python_pkg_version}-cffi
314 BuildRequires
: python
%{__python_pkg_version}-setuptools
317 BuildRequires
: libffi
-devel
320 %description -n python
%{__python_pkg_version}-pyzfs
321 This package provides a python wrapper
for the libzfs_core C library.
326 Summary: Initramfs module
327 Group: System Environment
/Kernel
328 Requires: %{name}%{?_isa} = %{version}-%{release}
329 Requires: initramfs
-tools
331 %description initramfs
332 This package contains a initramfs module used to construct an initramfs
333 image which is ZFS aware.
337 %package -n pam_zfs_key
338 Summary: PAM module
for encrypted ZFS datasets
340 %if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}%{?openEuler}
341 BuildRequires
: pam
-devel
344 %description -n pam_zfs_key
345 This package contains the pam_zfs_key PAM module
, which provides
346 support
for unlocking datasets on user login.
351 %define debug
--enable-debug
353 %define debug
--disable
-debug
356 %if %{with debuginfo}
357 %define debuginfo
--enable-debuginfo
359 %define debuginfo
--disable
-debuginfo
363 %define asan
--enable-asan
365 %define asan
--disable
-asan
369 %define ubsan
--enable-ubsan
371 %define ubsan
--disable
-ubsan
375 %define systemd
--enable-systemd
--with
-systemdunitdir
=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --with-systemdmodulesloaddir=%{_modulesloaddir} --with-systemdgeneratordir=%{_systemdgeneratordir} --disable
-sysvinit
376 %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 zfs
-volume
-wait.service zfs
-volumes.target
378 %define systemd
--enable-sysvinit
--disable
-systemd
382 %define pyzfs
--enable-pyzfs
384 %define pyzfs
--disable
-pyzfs
388 %define pam
--enable-pam
390 %define pam
--disable
-pam
398 --with
-udevdir
=%{_udevdir} \
399 --with
-udevruledir
=%{_udevruledir} \
400 --with
-dracutdir
=%{_dracutdir} \
401 --with
-pamconfigsdir
=%{_datadir}/pam
-configs \
402 --with
-pammoduledir
=%{_libdir}/security \
403 --with
-python
=%{__python} \
404 --with
-pkgconfigdir
=%{_pkgconfigdir} \
416 %{__rm} -rf $RPM_BUILD_ROOT
417 make install DESTDIR
=%{?buildroot}
418 find
%{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \
;
419 %if 0%{!?__brp_mangle_shebangs:1}
420 find
%{?buildroot}%{_bindir} \
421 \
( -name arc_summary
-or
-name arcstat
-or
-name dbufstat \
422 -or
-name zilstat \
) \
423 -exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \
;
424 find
%{?buildroot}%{_datadir} \
425 \
( -name
test-runner.py
-or
-name zts
-report.py \
) \
426 -exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \
;
431 %if 0%{?systemd_post:1}
432 %systemd_post %{systemd_svcs}
434 if [ "$
1"
= "
1"
-o "$
1"
= "
install"
] ; then
435 # Initial installation
436 systemctl preset
%{systemd_svcs} >/dev
/null || true
440 if [ -x
/sbin
/chkconfig
]; then
441 /sbin
/chkconfig
--add zfs
-import
442 /sbin
/chkconfig
--add zfs
-load
-key
443 /sbin
/chkconfig
--add zfs
-mount
444 /sbin
/chkconfig
--add zfs
-share
445 /sbin
/chkconfig
--add zfs
-zed
450 # On RHEL/CentOS 7 the static nodes aren't refreshed by default after
451 # installing a package. This is the default behavior for Fedora.
453 %if 0%{?rhel} == 7 || 0%{?centos} == 7
454 systemctl restart kmod
-static
-nodes
455 systemctl restart systemd
-tmpfiles
-setup
-dev
461 %if 0%{?systemd_preun:1}
462 %systemd_preun %{systemd_svcs}
464 if [ "$
1"
= "
0"
-o "$
1"
= "remove"
] ; then
465 # Package removal, not upgrade
466 systemctl
--no
-reload disable
%{systemd_svcs} >/dev
/null || true
467 systemctl stop
%{systemd_svcs} >/dev
/null || true
471 if [ "$
1"
= "
0"
-o "$
1"
= "remove"
] && [ -x
/sbin
/chkconfig
]; then
472 /sbin
/chkconfig
--del zfs
-import
473 /sbin
/chkconfig
--del zfs
-load
-key
474 /sbin
/chkconfig
--del zfs
-mount
475 /sbin
/chkconfig
--del zfs
-share
476 /sbin
/chkconfig
--del zfs
-zed
483 %if 0%{?systemd_postun:1}
484 %systemd_postun %{systemd_svcs}
486 systemctl
--system daemon
-reload
>/dev
/null || true
493 %{_bindir}/raidz_test
494 %{_sbindir}/zgenhostid
496 # Optional Python 3 scripts
497 %{_bindir}/arc_summary
507 # Configuration files and scripts
508 %{_libexecdir}/%{name}
511 %{_udevdir}/rules.d
/*
512 %{_datadir}/%{name}/compatibility.d
513 %if ! 0%{?_systemd} || 0%{?_initramfs}
514 # Files needed for sysvinit and initramfs-tools
515 %{_sysconfdir}/%{name}/zfs
-functions
516 %config(noreplace
) %{_initconfdir}/zfs
518 %exclude %{_sysconfdir}/%{name}/zfs
-functions
519 %exclude %{_initconfdir}/zfs
525 %{_systemdgeneratordir}/*
527 %config(noreplace
) %{_sysconfdir}/init.d
/*
529 %config(noreplace
) %{_sysconfdir}/%{name}/zed.d
/*
530 %config(noreplace
) %{_sysconfdir}/%{name}/zpool.d
/*
531 %config(noreplace
) %{_sysconfdir}/%{name}/vdev_id.conf.
*.example
532 %attr(440, root
, root
) %config(noreplace
) %{_sysconfdir}/sudoers.d
/*
534 %config(noreplace
) %{_bashcompletiondir}/zfs
535 %config(noreplace
) %{_bashcompletiondir}/zpool
538 %{_libdir}/libzpool.so.
*
541 %{_libdir}/libnvpair.so.
*
544 %{_libdir}/libuutil.so.
*
547 %{_libdir}/libzfs
*.so.
*
549 %files -n libzfs5
-devel
550 %{_pkgconfigdir}/libzfs.pc
551 %{_pkgconfigdir}/libzfsbootenv.pc
552 %{_pkgconfigdir}/libzfs_core.pc
555 %doc AUTHORS COPYRIGHT LICENSE NOTICE README.md
558 %{_datadir}/%{name}/zfs
-tests
559 %{_datadir}/%{name}/test-runner
560 %{_datadir}/%{name}/runfiles
561 %{_datadir}/%{name}/*.sh
564 %doc contrib
/dracut
/README.md
565 %{_dracutdir}/modules.d
/*
568 %files -n python
%{__python_pkg_version}-pyzfs
569 %doc contrib
/pyzfs
/README
570 %doc contrib
/pyzfs
/LICENSE
571 %defattr(-,root
,root
,-)
572 %{__python_sitelib}/libzfs_core
/*
573 %{__python_sitelib}/pyzfs
*
578 %doc contrib
/initramfs
/README.md
579 /usr
/share
/initramfs
-tools
/*
581 # Since we're not building the initramfs package,
582 # ignore those files.
583 %exclude /usr
/share
/initramfs
-tools
587 %files -n pam_zfs_key
588 %{_libdir}/security
/*
589 %{_datadir}/pam
-configs
/*