2 %global _libdir
/%{_lib}
4 # Set the default udev directory based on distribution.
5 %if %{undefined _udevdir}
6 %if 0%{?fedora}%{?rhel}%{?centos}
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%{?fedora}%{?rhel}%{?centos}
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%{?fedora}%{?rhel}%{?centos}
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
62 # Generic enable switch for systemd
67 # Distros below support systemd
68 %if 0%{?rhel}%{?fedora}%{?centos}%{?suse_version}
72 # When not specified default to distribution provided version.
73 %if %{undefined __use_python}
74 %define __python
/usr
/bin
/python3
75 %define __python_pkg_version
3
77 %define __python
%{__use_python}
78 %define __python_pkg_version
%{__use_python_pkg_version}
80 %define __python_sitelib %
(%{__python} -Esc "from distutils.sysconfig import get_python_lib
; print
(get_python_lib
())"
)
84 Release: @RELEASE@
%{?dist}
85 Summary: Commands to control the kernel modules and libraries
87 Group: System Environment
/Kernel
88 License: @ZFS_META_LICENSE@
89 URL: https
://github.com
/openzfs
/zfs
90 Source0: %{name}-%{version}.tar.gz
91 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n
)
92 Requires: libzpool5
= %{version}
93 Requires: libnvpair3
= %{version}
94 Requires: libuutil3
= %{version}
95 Requires: libzfs5
= %{version}
96 Requires: %{name}-kmod = %{version}
97 Provides: %{name}-kmod-common = %{version}
100 # zfs-fuse provides the same commands and man pages that OpenZFS does.
101 # Renaming those on either side would conflict with all available documentation.
104 %if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}
105 BuildRequires
: gcc
, make
106 BuildRequires
: zlib
-devel
107 BuildRequires
: libuuid
-devel
108 BuildRequires
: libblkid
-devel
109 BuildRequires
: libudev
-devel
110 BuildRequires
: libattr
-devel
111 BuildRequires
: openssl
-devel
112 # We don't directly use it, but if this isn't installed, rpmbuild as root can
113 # crash+corrupt rpmdb
115 BuildRequires
: ncompress
116 %if 0%{?fedora} || 0%{?rhel} >= 8 || 0%{?centos} >= 8
117 BuildRequires
: libtirpc
-devel
122 BuildRequires
: systemd
127 Requires(post
): systemd
128 Requires(preun
): systemd
129 Requires(postun
): systemd
132 # The zpool iostat/status -c scripts call some utilities like lsblk and iostat
137 This package contains the core ZFS
command line utilities.
139 %package -n libzpool5
140 Summary: Native ZFS pool library
for Linux
141 Group: System Environment
/Kernel
145 %description -n libzpool5
146 This package contains the zpool library
, which provides support
149 %if %{defined ldconfig_scriptlets}
150 %ldconfig_scriptlets -n libzpool5
152 %post -n libzpool5
-p
/sbin
/ldconfig
153 %postun -n libzpool5
-p
/sbin
/ldconfig
156 %package -n libnvpair3
157 Summary: Solaris name
-value library
for Linux
158 Group: System Environment
/Kernel
159 Obsoletes
: libnvpair1
161 %description -n libnvpair3
162 This package contains routines
for packing and unpacking name
-value
163 pairs. This functionality is used to portably transport data across
164 process boundaries
, between kernel and user space
, and can be used
165 to write self describing data structures on disk.
167 %if %{defined ldconfig_scriptlets}
168 %ldconfig_scriptlets -n libnvpair3
170 %post -n libnvpair3
-p
/sbin
/ldconfig
171 %postun -n libnvpair3
-p
/sbin
/ldconfig
174 %package -n libuutil3
175 Summary: Solaris userland utility library
for Linux
176 Group: System Environment
/Kernel
179 %description -n libuutil3
180 This library provides a variety of compatibility functions
for OpenZFS
:
181 * libspl
: The Solaris Porting Layer userland library
, which provides APIs
182 that
make it possible to run Solaris user code
in a Linux environment
183 with relatively minimal modification.
184 * libavl
: The Adelson
-Velskii Landis balanced binary tree manipulation
186 * libefi
: The Extensible Firmware Interface library
for GUID disk
188 * libshare
: NFS
, SMB
, and iSCSI service integration
for ZFS.
190 %if %{defined ldconfig_scriptlets}
191 %ldconfig_scriptlets -n libuutil3
193 %post -n libuutil3
-p
/sbin
/ldconfig
194 %postun -n libuutil3
-p
/sbin
/ldconfig
197 # The library version is encoded in the package name. When updating the
198 # version information it is important to add an obsoletes line below for
199 # the previous version of the package.
201 Summary: Native ZFS filesystem library
for Linux
202 Group: System Environment
/Kernel
206 %description -n libzfs5
207 This package provides support
for managing ZFS filesystems
209 %if %{defined ldconfig_scriptlets}
210 %ldconfig_scriptlets -n libzfs5
212 %post -n libzfs5
-p
/sbin
/ldconfig
213 %postun -n libzfs5
-p
/sbin
/ldconfig
216 %package -n libzfs5
-devel
217 Summary: Development headers
218 Group: System Environment
/Kernel
219 Requires: libzfs5
= %{version}
220 Requires: libzpool5
= %{version}
221 Requires: libnvpair3
= %{version}
222 Requires: libuutil3
= %{version}
223 Provides: libzpool5
-devel
224 Provides: libnvpair3
-devel
225 Provides: libuutil3
-devel
227 Obsoletes
: libzfs2
-devel
228 Obsoletes
: libzfs4
-devel
230 %description -n libzfs5
-devel
231 This package contains the header files needed
for building additional
232 applications against the ZFS libraries.
235 Summary: Test infrastructure
236 Group: System Environment
/Kernel
237 Requires: %{name}%{?_isa} = %{version}-%{release}
248 Requires: python
%{__python_pkg_version}
249 %if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}
250 BuildRequires
: libaio
-devel
255 This package contains
test infrastructure and support scripts
for
256 validating the file system.
259 Summary: Dracut module
260 Group: System Environment
/Kernel
262 Requires: %{name} >= %{version}
264 Requires: /usr
/bin
/awk
268 This package contains a dracut module used to construct an initramfs
269 image which is ZFS aware.
272 # Enforce `python36-` package prefix for CentOS 7
273 # since dependencies come from EPEL and are named this way
274 %package -n python
%{__python_pkg_version}-pyzfs
275 Summary: Python
%{python_version} wrapper
for libzfs_core
276 Group: Development
/Languages
/Python
279 Requires: libzfs5
= %{version}
280 Requires: libnvpair3
= %{version}
282 Requires: python
%{__python_pkg_version}
285 Requires: python36
-cffi
287 Requires: python
%{__python_pkg_version}-cffi
290 %if 0%{?rhel}%{?centos}%{?fedora}%{?suse_version}
292 BuildRequires
: python36
-packaging
293 BuildRequires
: python36
-devel
294 BuildRequires
: python36
-cffi
295 BuildRequires
: python36
-setuptools
297 BuildRequires
: python
%{__python_pkg_version}-packaging
298 BuildRequires
: python
%{__python_pkg_version}-devel
299 BuildRequires
: python
%{__python_pkg_version}-cffi
300 BuildRequires
: python
%{__python_pkg_version}-setuptools
303 BuildRequires
: libffi
-devel
306 %description -n python
%{__python_pkg_version}-pyzfs
307 This package provides a python wrapper
for the libzfs_core C library.
312 Summary: Initramfs module
313 Group: System Environment
/Kernel
314 Requires: %{name}%{?_isa} = %{version}-%{release}
315 Requires: %{name} = %{version}-%{release}
316 Requires: initramfs
-tools
318 %description initramfs
319 This package contains a initramfs module used to construct an initramfs
320 image which is ZFS aware.
325 %define debug
--enable-debug
327 %define debug
--disable
-debug
330 %if %{with debuginfo}
331 %define debuginfo
--enable-debuginfo
333 %define debuginfo
--disable
-debuginfo
337 %define asan
--enable-asan
339 %define asan
--disable
-asan
343 %define systemd
--enable-systemd
--with
-systemdunitdir
=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --with-systemdmodulesloaddir=%{_modulesloaddir} --with-systemdgeneratordir=%{_systemdgeneratordir} --disable
-sysvinit
344 %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
346 %define systemd
--enable-sysvinit
--disable
-systemd
350 %define pyzfs
--enable-pyzfs
352 %define pyzfs
--disable
-pyzfs
356 %define pam
--enable-pam
358 %define pam
--disable
-pam
366 --with
-udevdir
=%{_udevdir} \
367 --with
-udevruledir
=%{_udevruledir} \
368 --with
-dracutdir
=%{_dracutdir} \
369 --with
-pamconfigsdir
=%{_datadir}/pam
-configs \
370 --with
-pammoduledir
=%{_libdir}/security \
371 --with
-python
=%{__python} \
372 --with
-pkgconfigdir
=%{_pkgconfigdir} \
383 %{__rm} -rf $RPM_BUILD_ROOT
384 make install DESTDIR
=%{?buildroot}
385 find
%{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \
;
386 %if 0%{!?__brp_mangle_shebangs:1}
387 find
%{?buildroot}%{_bindir} \
388 \
( -name arc_summary
-or
-name arcstat
-or
-name dbufstat \
) \
389 -exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \
;
390 find
%{?buildroot}%{_datadir} \
391 \
( -name
test-runner.py
-or
-name zts
-report.py \
) \
392 -exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \
;
397 %if 0%{?systemd_post:1}
398 %systemd_post %{systemd_svcs}
400 if [ "$
1"
= "
1"
-o "$
1"
= "
install"
] ; then
401 # Initial installation
402 systemctl preset
%{systemd_svcs} >/dev
/null || true
406 if [ -x
/sbin
/chkconfig
]; then
407 /sbin
/chkconfig
--add zfs
-import
408 /sbin
/chkconfig
--add zfs
-load
-key
409 /sbin
/chkconfig
--add zfs
-mount
410 /sbin
/chkconfig
--add zfs
-share
411 /sbin
/chkconfig
--add zfs
-zed
416 # On RHEL/CentOS 7 the static nodes aren't refreshed by default after
417 # installing a package. This is the default behavior for Fedora.
419 %if 0%{?rhel} == 7 || 0%{?centos} == 7
420 systemctl restart kmod
-static
-nodes
421 systemctl restart systemd
-tmpfiles
-setup
-dev
427 %if 0%{?systemd_preun:1}
428 %systemd_preun %{systemd_svcs}
430 if [ "$
1"
= "
0"
-o "$
1"
= "remove"
] ; then
431 # Package removal, not upgrade
432 systemctl
--no
-reload disable
%{systemd_svcs} >/dev
/null || true
433 systemctl stop
%{systemd_svcs} >/dev
/null || true
437 if [ "$
1"
= "
0"
-o "$
1"
= "remove"
] && [ -x
/sbin
/chkconfig
]; then
438 /sbin
/chkconfig
--del zfs
-import
439 /sbin
/chkconfig
--del zfs
-load
-key
440 /sbin
/chkconfig
--del zfs
-mount
441 /sbin
/chkconfig
--del zfs
-share
442 /sbin
/chkconfig
--del zfs
-zed
449 %if 0%{?systemd_postun:1}
450 %systemd_postun %{systemd_svcs}
452 systemctl
--system daemon
-reload
>/dev
/null || true
459 %{_bindir}/raidz_test
460 %{_sbindir}/zgenhostid
462 # Optional Python 3 scripts
463 %{_bindir}/arc_summary
472 # Configuration files and scripts
473 %{_libexecdir}/%{name}
476 %{_udevdir}/rules.d
/*
477 %{_datadir}/%{name}/compatibility.d
478 %if ! 0%{?_systemd} || 0%{?_initramfs}
479 # Files needed for sysvinit and initramfs-tools
480 %{_sysconfdir}/%{name}/zfs
-functions
481 %config(noreplace
) %{_initconfdir}/zfs
483 %exclude %{_sysconfdir}/%{name}/zfs
-functions
484 %exclude %{_initconfdir}/zfs
490 %{_systemdgeneratordir}/*
492 %config(noreplace
) %{_sysconfdir}/init.d
/*
494 %config(noreplace
) %{_sysconfdir}/%{name}/zed.d
/*
495 %config(noreplace
) %{_sysconfdir}/%{name}/zpool.d
/*
496 %config(noreplace
) %{_sysconfdir}/%{name}/vdev_id.conf.
*.example
497 %attr(440, root
, root
) %config(noreplace
) %{_sysconfdir}/sudoers.d
/*
499 %{_libdir}/security
/*
500 %{_datadir}/pam
-configs
/*
504 %{_libdir}/libzpool.so.
*
507 %{_libdir}/libnvpair.so.
*
510 %{_libdir}/libuutil.so.
*
513 %{_libdir}/libzfs
*.so.
*
515 %files -n libzfs5
-devel
516 %{_pkgconfigdir}/libzfs.pc
517 %{_pkgconfigdir}/libzfsbootenv.pc
518 %{_pkgconfigdir}/libzfs_core.pc
521 %doc AUTHORS COPYRIGHT LICENSE NOTICE README.md
524 %{_datadir}/%{name}/zfs
-tests
525 %{_datadir}/%{name}/test-runner
526 %{_datadir}/%{name}/runfiles
527 %{_datadir}/%{name}/*.sh
530 %doc contrib
/dracut
/README.dracut.markdown
531 %{_dracutdir}/modules.d
/*
534 %files -n python
%{__python_pkg_version}-pyzfs
535 %doc contrib
/pyzfs
/README
536 %doc contrib
/pyzfs
/LICENSE
537 %defattr(-,root
,root
,-)
538 %{__python_sitelib}/libzfs_core
/*
539 %{__python_sitelib}/pyzfs
*
544 %doc contrib
/initramfs
/README.initramfs.markdown
545 /usr
/share
/initramfs
-tools
/*
547 # Since we're not building the initramfs package,
548 # ignore those files.
549 %exclude /usr
/share
/initramfs
-tools