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 dracut directory based on distribution.
23 %if %{undefined _dracutdir}
24 %if 0%{?rhel}%{?fedora}%{?centos}%{?suse_version}%{?openEuler}
25 %global _dracutdir
%{_prefix}/lib
/dracut
27 %global _dracutdir
%{_prefix}/share
/dracut
31 %if %{undefined _initconfdir}
32 %global _initconfdir
/etc
/sysconfig
35 %if %{undefined _unitdir}
36 %global _unitdir
%{_prefix}/lib
/systemd
/system
39 %if %{undefined _presetdir}
40 %global _presetdir
%{_prefix}/lib
/systemd
/system
-preset
43 %if %{undefined _modulesloaddir}
44 %global _modulesloaddir
%{_prefix}/lib
/modules
-load.d
47 %if %{undefined _systemdgeneratordir}
48 %global _systemdgeneratordir
%{_prefix}/lib
/systemd
/system
-generators
51 %if %{undefined _pkgconfigdir}
52 %global _pkgconfigdir
%{_prefix}/%{_lib}/pkgconfig
63 # Generic enable switch for systemd
68 # Distros below support systemd
69 %if 0%{?rhel}%{?fedora}%{?centos}%{?suse_version}%{?openEuler}
73 # When not specified default to distribution provided version.
74 %if %{undefined __use_python}
75 %define __python
/usr
/bin
/python3
76 %define __python_pkg_version
3
78 %define __python
%{__use_python}
79 %define __python_pkg_version
%{__use_python_pkg_version}
81 %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'
))"
)
85 Release: @RELEASE@
%{?dist}
86 Summary: Commands to control the kernel modules and libraries
88 Group: System Environment
/Kernel
89 License: @ZFS_META_LICENSE@
90 URL: https
://github.com
/openzfs
/zfs
91 Source0: %{name}-%{version}.tar.gz
92 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n
)
93 Requires: libzpool5
%{?_isa} = %{version}-%{release}
94 Requires: libnvpair3
%{?_isa} = %{version}-%{release}
95 Requires: libuutil3
%{?_isa} = %{version}-%{release}
96 Requires: libzfs5
%{?_isa} = %{version}-%{release}
97 Requires: %{name}-kmod = %{version}
98 Provides: %{name}-kmod-common = %{version}-%{release}
99 Obsoletes
: spl
<= %{version}
101 # zfs-fuse provides the same commands and man pages that OpenZFS does.
102 # Renaming those on either side would conflict with all available documentation.
105 %if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}%{?openEuler}
106 BuildRequires
: gcc
, make
107 BuildRequires
: zlib
-devel
108 BuildRequires
: libuuid
-devel
109 BuildRequires
: libblkid
-devel
110 BuildRequires
: libudev
-devel
111 BuildRequires
: libattr
-devel
112 BuildRequires
: openssl
-devel
113 %if 0%{?fedora}%{?suse_version}%{?openEuler} || 0%{?rhel} >= 8 || 0%{?centos} >= 8
114 BuildRequires
: libtirpc
-devel
117 %if (0%{?fedora}%{?suse_version}%{?openEuler}) || (0%{?rhel} && 0%{?rhel} < 9)
118 # We don't directly use it, but if this isn't installed, rpmbuild as root can
119 # crash+corrupt rpmdb
121 BuildRequires
: ncompress
126 BuildRequires
: systemd
132 Requires(post
): systemd
133 Requires(preun
): systemd
134 Requires(postun
): systemd
137 # The zpool iostat/status -c scripts call some utilities like lsblk and iostat
142 This package contains the core ZFS
command line utilities.
144 %package -n libzpool5
145 Summary: Native ZFS pool library
for Linux
146 Group: System Environment
/Kernel
147 Obsoletes
: libzpool2
<= %{version}
148 Obsoletes
: libzpool4
<= %{version}
150 %description -n libzpool5
151 This package contains the zpool library
, which provides support
154 %if %{defined ldconfig_scriptlets}
155 %ldconfig_scriptlets -n libzpool5
157 %post -n libzpool5
-p
/sbin
/ldconfig
158 %postun -n libzpool5
-p
/sbin
/ldconfig
161 %package -n libnvpair3
162 Summary: Solaris name
-value library
for Linux
163 Group: System Environment
/Kernel
164 Obsoletes
: libnvpair1
<= %{version}
166 %description -n libnvpair3
167 This package contains routines
for packing and unpacking name
-value
168 pairs. This functionality is used to portably transport data across
169 process boundaries
, between kernel and user space
, and can be used
170 to write self describing data structures on disk.
172 %if %{defined ldconfig_scriptlets}
173 %ldconfig_scriptlets -n libnvpair3
175 %post -n libnvpair3
-p
/sbin
/ldconfig
176 %postun -n libnvpair3
-p
/sbin
/ldconfig
179 %package -n libuutil3
180 Summary: Solaris userland utility library
for Linux
181 Group: System Environment
/Kernel
182 Obsoletes
: libuutil1
<= %{version}
184 %description -n libuutil3
185 This library provides a variety of compatibility functions
for OpenZFS
:
186 * libspl
: The Solaris Porting Layer userland library
, which provides APIs
187 that
make it possible to run Solaris user code
in a Linux environment
188 with relatively minimal modification.
189 * libavl
: The Adelson
-Velskii Landis balanced binary tree manipulation
191 * libefi
: The Extensible Firmware Interface library
for GUID disk
193 * libshare
: NFS
, SMB
, and iSCSI service integration
for ZFS.
195 %if %{defined ldconfig_scriptlets}
196 %ldconfig_scriptlets -n libuutil3
198 %post -n libuutil3
-p
/sbin
/ldconfig
199 %postun -n libuutil3
-p
/sbin
/ldconfig
202 # The library version is encoded in the package name. When updating the
203 # version information it is important to add an obsoletes line below for
204 # the previous version of the package.
206 Summary: Native ZFS filesystem library
for Linux
207 Group: System Environment
/Kernel
208 Obsoletes
: libzfs2
<= %{version}
209 Obsoletes
: libzfs4
<= %{version}
211 %description -n libzfs5
212 This package provides support
for managing ZFS filesystems
214 %if %{defined ldconfig_scriptlets}
215 %ldconfig_scriptlets -n libzfs5
217 %post -n libzfs5
-p
/sbin
/ldconfig
218 %postun -n libzfs5
-p
/sbin
/ldconfig
221 %package -n libzfs5
-devel
222 Summary: Development headers
223 Group: System Environment
/Kernel
224 Requires: libzfs5
%{?_isa} = %{version}-%{release}
225 Requires: libzpool5
%{?_isa} = %{version}-%{release}
226 Requires: libnvpair3
%{?_isa} = %{version}-%{release}
227 Requires: libuutil3
%{?_isa} = %{version}-%{release}
228 Provides: libzpool5
-devel
= %{version}-%{release}
229 Provides: libnvpair3
-devel
= %{version}-%{release}
230 Provides: libuutil3
-devel
= %{version}-%{release}
231 Obsoletes
: zfs
-devel
<= %{version}
232 Obsoletes
: libzfs2
-devel
<= %{version}
233 Obsoletes
: libzfs4
-devel
<= %{version}
235 %description -n libzfs5
-devel
236 This package contains the header files needed
for building additional
237 applications against the ZFS libraries.
240 Summary: Test infrastructure
241 Group: System Environment
/Kernel
242 Requires: %{name}%{?_isa} = %{version}-%{release}
253 Requires: python
%{__python_pkg_version}
254 %if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}%{?openEuler}
255 BuildRequires
: libaio
-devel
260 This package contains
test infrastructure and support scripts
for
261 validating the file system.
264 Summary: Dracut module
265 Group: System Environment
/Kernel
267 Requires: %{name} >= %{version}
269 Requires: /usr
/bin
/awk
273 This package contains a dracut module used to construct an initramfs
274 image which is ZFS aware.
277 # Enforce `python36-` package prefix for CentOS 7
278 # since dependencies come from EPEL and are named this way
279 %package -n python
%{__python_pkg_version}-pyzfs
280 Summary: Python
%{python_version} wrapper
for libzfs_core
281 Group: Development
/Languages
/Python
284 Requires: libzfs5
= %{version}-%{release}
285 Requires: libnvpair3
= %{version}-%{release}
287 Requires: python
%{__python_pkg_version}
290 Requires: python36
-cffi
292 Requires: python
%{__python_pkg_version}-cffi
295 %if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}%{?openEuler}
297 BuildRequires
: python36
-packaging
298 BuildRequires
: python36
-devel
299 BuildRequires
: python36
-cffi
300 BuildRequires
: python36
-setuptools
302 BuildRequires
: python
%{__python_pkg_version}-packaging
303 BuildRequires
: python
%{__python_pkg_version}-devel
304 BuildRequires
: python
%{__python_pkg_version}-cffi
305 BuildRequires
: python
%{__python_pkg_version}-setuptools
308 BuildRequires
: libffi
-devel
311 %description -n python
%{__python_pkg_version}-pyzfs
312 This package provides a python wrapper
for the libzfs_core C library.
317 Summary: Initramfs module
318 Group: System Environment
/Kernel
319 Requires: %{name}%{?_isa} = %{version}-%{release}
320 Requires: initramfs
-tools
322 %description initramfs
323 This package contains a initramfs module used to construct an initramfs
324 image which is ZFS aware.
328 %package -n pam_zfs_key
329 Summary: PAM module
for encrypted ZFS datasets
331 %if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}%{?openEuler}
332 BuildRequires
: pam
-devel
335 %description -n pam_zfs_key
336 This package contains the pam_zfs_key PAM module
, which provides
337 support
for unlocking datasets on user login.
342 %define debug
--enable-debug
344 %define debug
--disable
-debug
347 %if %{with debuginfo}
348 %define debuginfo
--enable-debuginfo
350 %define debuginfo
--disable
-debuginfo
354 %define asan
--enable-asan
356 %define asan
--disable
-asan
360 %define ubsan
--enable-ubsan
362 %define ubsan
--disable
-ubsan
366 %define systemd
--enable-systemd
--with
-systemdunitdir
=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --with-systemdmodulesloaddir=%{_modulesloaddir} --with-systemdgeneratordir=%{_systemdgeneratordir} --disable
-sysvinit
367 %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
369 %define systemd
--enable-sysvinit
--disable
-systemd
373 %define pyzfs
--enable-pyzfs
375 %define pyzfs
--disable
-pyzfs
379 %define pam
--enable-pam
381 %define pam
--disable
-pam
389 --with
-udevdir
=%{_udevdir} \
390 --with
-udevruledir
=%{_udevruledir} \
391 --with
-dracutdir
=%{_dracutdir} \
392 --with
-pamconfigsdir
=%{_datadir}/pam
-configs \
393 --with
-pammoduledir
=%{_libdir}/security \
394 --with
-python
=%{__python} \
395 --with
-pkgconfigdir
=%{_pkgconfigdir} \
407 %{__rm} -rf $RPM_BUILD_ROOT
408 make install DESTDIR
=%{?buildroot}
409 find
%{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \
;
410 %if 0%{!?__brp_mangle_shebangs:1}
411 find
%{?buildroot}%{_bindir} \
412 \
( -name arc_summary
-or
-name arcstat
-or
-name dbufstat \
413 -or
-name zilstat \
) \
414 -exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \
;
415 find
%{?buildroot}%{_datadir} \
416 \
( -name
test-runner.py
-or
-name zts
-report.py \
) \
417 -exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \
;
422 %if 0%{?systemd_post:1}
423 %systemd_post %{systemd_svcs}
425 if [ "$
1"
= "
1"
-o "$
1"
= "
install"
] ; then
426 # Initial installation
427 systemctl preset
%{systemd_svcs} >/dev
/null || true
431 if [ -x
/sbin
/chkconfig
]; then
432 /sbin
/chkconfig
--add zfs
-import
433 /sbin
/chkconfig
--add zfs
-load
-key
434 /sbin
/chkconfig
--add zfs
-mount
435 /sbin
/chkconfig
--add zfs
-share
436 /sbin
/chkconfig
--add zfs
-zed
441 # On RHEL/CentOS 7 the static nodes aren't refreshed by default after
442 # installing a package. This is the default behavior for Fedora.
444 %if 0%{?rhel} == 7 || 0%{?centos} == 7
445 systemctl restart kmod
-static
-nodes
446 systemctl restart systemd
-tmpfiles
-setup
-dev
452 %if 0%{?systemd_preun:1}
453 %systemd_preun %{systemd_svcs}
455 if [ "$
1"
= "
0"
-o "$
1"
= "remove"
] ; then
456 # Package removal, not upgrade
457 systemctl
--no
-reload disable
%{systemd_svcs} >/dev
/null || true
458 systemctl stop
%{systemd_svcs} >/dev
/null || true
462 if [ "$
1"
= "
0"
-o "$
1"
= "remove"
] && [ -x
/sbin
/chkconfig
]; then
463 /sbin
/chkconfig
--del zfs
-import
464 /sbin
/chkconfig
--del zfs
-load
-key
465 /sbin
/chkconfig
--del zfs
-mount
466 /sbin
/chkconfig
--del zfs
-share
467 /sbin
/chkconfig
--del zfs
-zed
474 %if 0%{?systemd_postun:1}
475 %systemd_postun %{systemd_svcs}
477 systemctl
--system daemon
-reload
>/dev
/null || true
484 %{_bindir}/raidz_test
485 %{_sbindir}/zgenhostid
487 # Optional Python 3 scripts
488 %{_bindir}/arc_summary
498 # Configuration files and scripts
499 %{_libexecdir}/%{name}
502 %{_udevdir}/rules.d
/*
503 %{_datadir}/%{name}/compatibility.d
504 %if ! 0%{?_systemd} || 0%{?_initramfs}
505 # Files needed for sysvinit and initramfs-tools
506 %{_sysconfdir}/%{name}/zfs
-functions
507 %config(noreplace
) %{_initconfdir}/zfs
509 %exclude %{_sysconfdir}/%{name}/zfs
-functions
510 %exclude %{_initconfdir}/zfs
516 %{_systemdgeneratordir}/*
518 %config(noreplace
) %{_sysconfdir}/init.d
/*
520 %config(noreplace
) %{_sysconfdir}/%{name}/zed.d
/*
521 %config(noreplace
) %{_sysconfdir}/%{name}/zpool.d
/*
522 %config(noreplace
) %{_sysconfdir}/%{name}/vdev_id.conf.
*.example
523 %attr(440, root
, root
) %config(noreplace
) %{_sysconfdir}/sudoers.d
/*
525 %config(noreplace
) %{_sysconfdir}/bash_completion.d
/zfs
528 %{_libdir}/libzpool.so.
*
531 %{_libdir}/libnvpair.so.
*
534 %{_libdir}/libuutil.so.
*
537 %{_libdir}/libzfs
*.so.
*
539 %files -n libzfs5
-devel
540 %{_pkgconfigdir}/libzfs.pc
541 %{_pkgconfigdir}/libzfsbootenv.pc
542 %{_pkgconfigdir}/libzfs_core.pc
545 %doc AUTHORS COPYRIGHT LICENSE NOTICE README.md
548 %{_datadir}/%{name}/zfs
-tests
549 %{_datadir}/%{name}/test-runner
550 %{_datadir}/%{name}/runfiles
551 %{_datadir}/%{name}/*.sh
554 %doc contrib
/dracut
/README.md
555 %{_dracutdir}/modules.d
/*
558 %files -n python
%{__python_pkg_version}-pyzfs
559 %doc contrib
/pyzfs
/README
560 %doc contrib
/pyzfs
/LICENSE
561 %defattr(-,root
,root
,-)
562 %{__python_sitelib}/libzfs_core
/*
563 %{__python_sitelib}/pyzfs
*
568 %doc contrib
/initramfs
/README.md
569 /usr
/share
/initramfs
-tools
/*
571 # Since we're not building the initramfs package,
572 # ignore those files.
573 %exclude /usr
/share
/initramfs
-tools
577 %files -n pam_zfs_key
578 %{_libdir}/security
/*
579 %{_datadir}/pam
-configs
/*