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: libzpool6
%{?_isa} = %{version}-%{release}
103 Requires: libnvpair3
%{?_isa} = %{version}-%{release}
104 Requires: libuutil3
%{?_isa} = %{version}-%{release}
105 Requires: libzfs6
%{?_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 libzpool6
154 Summary: Native ZFS pool library
for Linux
155 Group: System Environment
/Kernel
156 Obsoletes
: libzpool2
<= %{version}
157 Obsoletes
: libzpool4
<= %{version}
158 Obsoletes
: libzpool5
<= %{version}
160 %description -n libzpool6
161 This package contains the zpool library
, which provides support
164 %if %{defined ldconfig_scriptlets}
165 %ldconfig_scriptlets -n libzpool6
167 %post -n libzpool6
-p
/sbin
/ldconfig
168 %postun -n libzpool6
-p
/sbin
/ldconfig
171 %package -n libnvpair3
172 Summary: Solaris name
-value library
for Linux
173 Group: System Environment
/Kernel
174 Obsoletes
: libnvpair1
<= %{version}
176 %description -n libnvpair3
177 This package contains routines
for packing and unpacking name
-value
178 pairs. This functionality is used to portably transport data across
179 process boundaries
, between kernel and user space
, and can be used
180 to write self describing data structures on disk.
182 %if %{defined ldconfig_scriptlets}
183 %ldconfig_scriptlets -n libnvpair3
185 %post -n libnvpair3
-p
/sbin
/ldconfig
186 %postun -n libnvpair3
-p
/sbin
/ldconfig
189 %package -n libuutil3
190 Summary: Solaris userland utility library
for Linux
191 Group: System Environment
/Kernel
192 Obsoletes
: libuutil1
<= %{version}
194 %description -n libuutil3
195 This library provides a variety of compatibility functions
for OpenZFS
:
196 * libspl
: The Solaris Porting Layer userland library
, which provides APIs
197 that
make it possible to run Solaris user code
in a Linux environment
198 with relatively minimal modification.
199 * libavl
: The Adelson
-Velskii Landis balanced binary tree manipulation
201 * libefi
: The Extensible Firmware Interface library
for GUID disk
203 * libshare
: NFS
, SMB
, and iSCSI service integration
for ZFS.
205 %if %{defined ldconfig_scriptlets}
206 %ldconfig_scriptlets -n libuutil3
208 %post -n libuutil3
-p
/sbin
/ldconfig
209 %postun -n libuutil3
-p
/sbin
/ldconfig
212 # The library version is encoded in the package name. When updating the
213 # version information it is important to add an obsoletes line below for
214 # the previous version of the package.
216 Summary: Native ZFS filesystem library
for Linux
217 Group: System Environment
/Kernel
218 Obsoletes
: libzfs2
<= %{version}
219 Obsoletes
: libzfs4
<= %{version}
220 Obsoletes
: libzfs5
<= %{version}
222 %description -n libzfs6
223 This package provides support
for managing ZFS filesystems
225 %if %{defined ldconfig_scriptlets}
226 %ldconfig_scriptlets -n libzfs6
228 %post -n libzfs6
-p
/sbin
/ldconfig
229 %postun -n libzfs6
-p
/sbin
/ldconfig
232 %package -n libzfs6
-devel
233 Summary: Development headers
234 Group: System Environment
/Kernel
235 Requires: libzfs6
%{?_isa} = %{version}-%{release}
236 Requires: libzpool6
%{?_isa} = %{version}-%{release}
237 Requires: libnvpair3
%{?_isa} = %{version}-%{release}
238 Requires: libuutil3
%{?_isa} = %{version}-%{release}
239 Provides: libzpool6
-devel
= %{version}-%{release}
240 Provides: libnvpair3
-devel
= %{version}-%{release}
241 Provides: libuutil3
-devel
= %{version}-%{release}
242 Obsoletes
: zfs
-devel
<= %{version}
243 Obsoletes
: libzfs2
-devel
<= %{version}
244 Obsoletes
: libzfs4
-devel
<= %{version}
245 Obsoletes
: libzfs5
-devel
<= %{version}
247 %description -n libzfs6
-devel
248 This package contains the header files needed
for building additional
249 applications against the ZFS libraries.
252 Summary: Test infrastructure
253 Group: System Environment
/Kernel
254 Requires: %{name}%{?_isa} = %{version}-%{release}
265 Requires: python
%{__python_pkg_version}
266 %if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}%{?openEuler}
267 BuildRequires
: libaio
-devel
272 This package contains
test infrastructure and support scripts
for
273 validating the file system.
276 Summary: Dracut module
277 Group: System Environment
/Kernel
279 Requires: %{name} >= %{version}
281 Requires: /usr
/bin
/awk
285 This package contains a dracut module used to construct an initramfs
286 image which is ZFS aware.
289 # Enforce `python36-` package prefix for CentOS 7
290 # since dependencies come from EPEL and are named this way
291 %package -n python
%{__python_pkg_version}-pyzfs
292 Summary: Python
%{python_version} wrapper
for libzfs_core
293 Group: Development
/Languages
/Python
296 Requires: libzfs6
= %{version}-%{release}
297 Requires: libnvpair3
= %{version}-%{release}
299 Requires: python
%{__python_pkg_version}
302 Requires: python36
-cffi
304 Requires: python
%{__python_pkg_version}-cffi
307 %if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}%{?openEuler}
309 BuildRequires
: python36
-packaging
310 BuildRequires
: python36
-devel
311 BuildRequires
: python36
-cffi
312 BuildRequires
: python36
-setuptools
314 BuildRequires
: python
%{__python_pkg_version}-packaging
315 BuildRequires
: python
%{__python_pkg_version}-devel
316 BuildRequires
: python
%{__python_pkg_version}-cffi
317 BuildRequires
: python
%{__python_pkg_version}-setuptools
320 BuildRequires
: libffi
-devel
323 %description -n python
%{__python_pkg_version}-pyzfs
324 This package provides a python wrapper
for the libzfs_core C library.
329 Summary: Initramfs module
330 Group: System Environment
/Kernel
331 Requires: %{name}%{?_isa} = %{version}-%{release}
332 Requires: initramfs
-tools
334 %description initramfs
335 This package contains a initramfs module used to construct an initramfs
336 image which is ZFS aware.
340 %package -n pam_zfs_key
341 Summary: PAM module
for encrypted ZFS datasets
343 %if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}%{?openEuler}
344 BuildRequires
: pam
-devel
347 %description -n pam_zfs_key
348 This package contains the pam_zfs_key PAM module
, which provides
349 support
for unlocking datasets on user login.
354 %define debug
--enable-debug
356 %define debug
--disable
-debug
359 %if %{with debuginfo}
360 %define debuginfo
--enable-debuginfo
362 %define debuginfo
--disable
-debuginfo
366 %define asan
--enable-asan
368 %define asan
--disable
-asan
372 %define ubsan
--enable-ubsan
374 %define ubsan
--disable
-ubsan
378 %define systemd
--enable-systemd
--with
-systemdunitdir
=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --with-systemdmodulesloaddir=%{_modulesloaddir} --with-systemdgeneratordir=%{_systemdgeneratordir} --disable
-sysvinit
379 %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
381 %define systemd
--enable-sysvinit
--disable
-systemd
385 %define pyzfs
--enable-pyzfs
387 %define pyzfs
--disable
-pyzfs
391 %define pam
--enable-pam
393 %define pam
--disable
-pam
401 --with
-udevdir
=%{_udevdir} \
402 --with
-udevruledir
=%{_udevruledir} \
403 --with
-dracutdir
=%{_dracutdir} \
404 --with
-pamconfigsdir
=%{_datadir}/pam
-configs \
405 --with
-pammoduledir
=%{_libdir}/security \
406 --with
-python
=%{__python} \
407 --with
-pkgconfigdir
=%{_pkgconfigdir} \
419 %{__rm} -rf $RPM_BUILD_ROOT
420 make install DESTDIR
=%{?buildroot}
421 find
%{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \
;
422 %if 0%{!?__brp_mangle_shebangs:1}
423 find
%{?buildroot}%{_bindir} \
424 \
( -name arc_summary
-or
-name arcstat
-or
-name dbufstat \
425 -or
-name zilstat \
) \
426 -exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \
;
427 find
%{?buildroot}%{_datadir} \
428 \
( -name
test-runner.py
-or
-name zts
-report.py \
) \
429 -exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \
;
434 %if 0%{?systemd_post:1}
435 %systemd_post %{systemd_svcs}
437 if [ "$
1"
= "
1"
-o "$
1"
= "
install"
] ; then
438 # Initial installation
439 systemctl preset
%{systemd_svcs} >/dev
/null || true
443 if [ -x
/sbin
/chkconfig
]; then
444 /sbin
/chkconfig
--add zfs
-import
445 /sbin
/chkconfig
--add zfs
-load
-key
446 /sbin
/chkconfig
--add zfs
-mount
447 /sbin
/chkconfig
--add zfs
-share
448 /sbin
/chkconfig
--add zfs
-zed
453 # On RHEL/CentOS 7 the static nodes aren't refreshed by default after
454 # installing a package. This is the default behavior for Fedora.
456 %if 0%{?rhel} == 7 || 0%{?centos} == 7
457 systemctl restart kmod
-static
-nodes
458 systemctl restart systemd
-tmpfiles
-setup
-dev
464 %if 0%{?systemd_preun:1}
465 %systemd_preun %{systemd_svcs}
467 if [ "$
1"
= "
0"
-o "$
1"
= "remove"
] ; then
468 # Package removal, not upgrade
469 systemctl
--no
-reload disable
%{systemd_svcs} >/dev
/null || true
470 systemctl stop
%{systemd_svcs} >/dev
/null || true
474 if [ "$
1"
= "
0"
-o "$
1"
= "remove"
] && [ -x
/sbin
/chkconfig
]; then
475 /sbin
/chkconfig
--del zfs
-import
476 /sbin
/chkconfig
--del zfs
-load
-key
477 /sbin
/chkconfig
--del zfs
-mount
478 /sbin
/chkconfig
--del zfs
-share
479 /sbin
/chkconfig
--del zfs
-zed
486 %if 0%{?systemd_postun:1}
487 %systemd_postun %{systemd_svcs}
489 systemctl
--system daemon
-reload
>/dev
/null || true
496 %{_bindir}/raidz_test
497 %{_sbindir}/zgenhostid
499 # Optional Python 3 scripts
500 %{_bindir}/arc_summary
510 # Configuration files and scripts
511 %{_libexecdir}/%{name}
514 %{_udevdir}/rules.d
/*
515 %{_datadir}/%{name}/compatibility.d
516 %if ! 0%{?_systemd} || 0%{?_initramfs}
517 # Files needed for sysvinit and initramfs-tools
518 %{_sysconfdir}/%{name}/zfs
-functions
519 %config(noreplace
) %{_initconfdir}/zfs
521 %exclude %{_sysconfdir}/%{name}/zfs
-functions
522 %exclude %{_initconfdir}/zfs
528 %{_systemdgeneratordir}/*
530 %config(noreplace
) %{_sysconfdir}/init.d
/*
532 %config(noreplace
) %{_sysconfdir}/%{name}/zed.d
/*
533 %config(noreplace
) %{_sysconfdir}/%{name}/zpool.d
/*
534 %config(noreplace
) %{_sysconfdir}/%{name}/vdev_id.conf.
*.example
535 %attr(440, root
, root
) %config(noreplace
) %{_sysconfdir}/sudoers.d
/*
537 %config(noreplace
) %{_bashcompletiondir}/zfs
538 %config(noreplace
) %{_bashcompletiondir}/zpool
541 %{_libdir}/libzpool.so.
*
544 %{_libdir}/libnvpair.so.
*
547 %{_libdir}/libuutil.so.
*
550 %{_libdir}/libzfs
*.so.
*
552 %files -n libzfs6
-devel
553 %{_pkgconfigdir}/libzfs.pc
554 %{_pkgconfigdir}/libzfsbootenv.pc
555 %{_pkgconfigdir}/libzfs_core.pc
558 %doc AUTHORS COPYRIGHT LICENSE NOTICE README.md
561 %{_datadir}/%{name}/zfs
-tests
562 %{_datadir}/%{name}/test-runner
563 %{_datadir}/%{name}/runfiles
564 %{_datadir}/%{name}/*.sh
567 %doc contrib
/dracut
/README.md
568 %{_dracutdir}/modules.d
/*
571 %files -n python
%{__python_pkg_version}-pyzfs
572 %doc contrib
/pyzfs
/README
573 %doc contrib
/pyzfs
/LICENSE
574 %defattr(-,root
,root
,-)
575 %{__python_sitelib}/libzfs_core
/*
576 %{__python_sitelib}/pyzfs
*
581 %doc contrib
/initramfs
/README.md
582 /usr
/share
/initramfs
-tools
/*
584 # Since we're not building the initramfs package,
585 # ignore those files.
586 %exclude /usr
/share
/initramfs
-tools
590 %files -n pam_zfs_key
591 %{_libdir}/security
/*
592 %{_datadir}/pam
-configs
/*