2 %global _libdir
/%{_lib}
4 # Set the default udev directory based on distribution.
5 %if %{undefined _udevdir}
6 %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7
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} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7
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} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7
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
61 # Generic enable switch for systemd
66 # RHEL >= 7 comes with systemd
71 # Fedora >= 15 comes with systemd, but only >= 18 has
77 # opensuse >= 12.1 comes with systemd, but only >= 13.1
78 # has the proper macros
79 %if 0%{?suse_version} >= 1310
83 # When not specified default to distribution provided version. This
84 # is normally Python 3, but for RHEL <= 7 only Python 2 is provided.
85 %if %{undefined __use_python}
86 %if 0%{?rhel} && 0%{?rhel} <= 7
87 %define __python
/usr
/bin
/python2
88 %define __python_pkg_version
2
89 %define __python_cffi_pkg python
-cffi
90 %define __python_setuptools_pkg python
-setuptools
92 %define __python
/usr
/bin
/python3
93 %define __python_pkg_version
3
94 %define __python_cffi_pkg python3
-cffi
95 %define __python_setuptools_pkg python3
-setuptools
98 %define __python
%{__use_python}
99 %define __python_pkg_version
%{__use_python_pkg_version}
100 %define __python_cffi_pkg python
%{__python_pkg_version}-cffi
101 %define __python_setuptools_pkg python
%{__python_pkg_version}-setuptools
103 %define __python_sitelib %
(%{__python} -Esc "from distutils.sysconfig import get_python_lib
; print
(get_python_lib
())"
)
105 # By default python-pyzfs is enabled, with the exception of
106 # RHEL 6 which by default uses Python 2.6 which is too old.
115 Release: @RELEASE@
%{?dist}
116 Summary: Commands to control the kernel modules and libraries
118 Group: System Environment
/Kernel
119 License: @ZFS_META_LICENSE@
120 URL: https
://github.com
/openzfs
/zfs
121 Source0: %{name}-%{version}.tar.gz
122 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n
)
123 Requires: libzpool4
= %{version}
124 Requires: libnvpair3
= %{version}
125 Requires: libuutil3
= %{version}
126 Requires: libzfs4
= %{version}
127 Requires: %{name}-kmod = %{version}
128 Provides: %{name}-kmod-common = %{version}
131 # zfs-fuse provides the same commands and man pages that ZoL does. Renaming
132 # those on either side would conflict with all available documentation.
135 %if 0%{?rhel}%{?fedora}%{?suse_version}
136 BuildRequires
: gcc
, make
137 BuildRequires
: zlib
-devel
138 BuildRequires
: libuuid
-devel
139 BuildRequires
: libblkid
-devel
140 BuildRequires
: libudev
-devel
141 BuildRequires
: libattr
-devel
142 BuildRequires
: openssl
-devel
143 %if 0%{?fedora} >= 28 || 0%{?rhel} >= 8 || 0%{?centos} >= 8
144 BuildRequires
: libtirpc
-devel
148 BuildRequires
: systemd
153 Requires(post
): systemd
154 Requires(preun
): systemd
155 Requires(postun
): systemd
158 # The zpool iostat/status -c scripts call some utilities like lsblk and iostat
163 This package contains the core ZFS
command line utilities.
165 %package -n libzpool4
166 Summary: Native ZFS pool library
for Linux
167 Group: System Environment
/Kernel
170 %description -n libzpool4
171 This package contains the zpool library
, which provides support
174 %post -n libzpool4
-p
/sbin
/ldconfig
175 %postun -n libzpool4
-p
/sbin
/ldconfig
177 %package -n libnvpair3
178 Summary: Solaris name
-value library
for Linux
179 Group: System Environment
/Kernel
180 Obsoletes
: libnvpair1
182 %description -n libnvpair3
183 This package contains routines
for packing and unpacking name
-value
184 pairs. This functionality is used to portably transport data across
185 process boundaries
, between kernel and user space
, and can be used
186 to write self describing data structures on disk.
188 %post -n libnvpair3
-p
/sbin
/ldconfig
189 %postun -n libnvpair3
-p
/sbin
/ldconfig
191 %package -n libuutil3
192 Summary: Solaris userland utility library
for Linux
193 Group: System Environment
/Kernel
196 %description -n libuutil3
197 This library provides a variety of compatibility functions
for OpenZFS
:
198 * libspl
: The Solaris Porting Layer userland library
, which provides APIs
199 that
make it possible to run Solaris user code
in a Linux environment
200 with relatively minimal modification.
201 * libavl
: The Adelson
-Velskii Landis balanced binary tree manipulation
203 * libefi
: The Extensible Firmware Interface library
for GUID disk
205 * libshare
: NFS
, SMB
, and iSCSI service integration
for ZFS.
207 %post -n libuutil3
-p
/sbin
/ldconfig
208 %postun -n libuutil3
-p
/sbin
/ldconfig
211 Summary: Native ZFS filesystem library
for Linux
212 Group: System Environment
/Kernel
215 %description -n libzfs4
216 This package provides support
for managing ZFS filesystems
218 %post -n libzfs4
-p
/sbin
/ldconfig
219 %postun -n libzfs4
-p
/sbin
/ldconfig
221 %package -n libzfs4
-devel
222 Summary: Development headers
223 Group: System Environment
/Kernel
224 Requires: libzfs4
= %{version}
225 Requires: libzpool4
= %{version}
226 Requires: libnvpair3
= %{version}
227 Requires: libuutil3
= %{version}
228 Provides: libzpool4
-devel
229 Provides: libnvpair3
-devel
230 Provides: libuutil3
-devel
232 Obsoletes
: libzfs2
-devel
234 %description -n libzfs4
-devel
235 This package contains the header files needed
for building additional
236 applications against the ZFS libraries.
239 Summary: Test infrastructure
240 Group: System Environment
/Kernel
241 Requires: %{name}%{?_isa} = %{version}-%{release}
252 Requires: python
%{__python_pkg_version}
253 %if 0%{?rhel}%{?fedora}%{?suse_version}
254 BuildRequires
: libaio
-devel
259 This package contains
test infrastructure and support scripts
for
260 validating the file system.
263 Summary: Dracut module
264 Group: System Environment
/Kernel
266 Requires: %{name} >= %{version}
268 Requires: /usr
/bin
/awk
272 This package contains a dracut module used to construct an initramfs
273 image which is ZFS aware.
276 %package -n python
%{__python_pkg_version}-pyzfs
277 Summary: Python
%{python_version} wrapper
for libzfs_core
278 Group: Development
/Languages
/Python
281 Requires: libzfs4
= %{version}
282 Requires: libnvpair3
= %{version}
284 Requires: python
%{__python_pkg_version}
285 Requires: %{__python_cffi_pkg}
286 %if 0%{?rhel}%{?fedora}%{?suse_version}
287 BuildRequires
: python
%{__python_pkg_version}-devel
288 BuildRequires
: %{__python_cffi_pkg}
289 BuildRequires
: %{__python_setuptools_pkg}
290 BuildRequires
: libffi
-devel
293 %description -n python
%{__python_pkg_version}-pyzfs
294 This package provides a python wrapper
for the libzfs_core C library.
299 Summary: Initramfs module
300 Group: System Environment
/Kernel
301 Requires: %{name}%{?_isa} = %{version}-%{release}
302 Requires: %{name} = %{version}-%{release}
303 Requires: initramfs
-tools
305 %description initramfs
306 This package contains a initramfs module used to construct an initramfs
307 image which is ZFS aware.
312 %define debug
--enable-debug
314 %define debug
--disable
-debug
317 %if %{with debuginfo}
318 %define debuginfo
--enable-debuginfo
320 %define debuginfo
--disable
-debuginfo
324 %define asan
--enable-asan
326 %define asan
--disable
-asan
330 %define systemd
--enable-systemd
--with
-systemdunitdir
=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --with-systemdmodulesloaddir=%{_modulesloaddir} --with-systemdgeneratordir=%{_systemdgeneratordir} --disable
-sysvinit
331 %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
333 %define systemd
--enable-sysvinit
--disable
-systemd
337 %define pyzfs
--enable-pyzfs
339 %define pyzfs
--disable
-pyzfs
343 %define pam
--enable-pam
345 %define pam
--disable
-pam
353 --with
-udevdir
=%{_udevdir} \
354 --with
-udevruledir
=%{_udevruledir} \
355 --with
-dracutdir
=%{_dracutdir} \
356 --with
-pamconfigsdir
=%{_datadir}/pam
-configs \
357 --with
-pammoduledir
=%{_libdir}/security \
358 --with
-python
=%{__python} \
359 --with
-pkgconfigdir
=%{_pkgconfigdir} \
370 %{__rm} -rf $RPM_BUILD_ROOT
371 make install DESTDIR
=%{?buildroot}
372 find
%{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \
;
373 %if 0%{!?__brp_mangle_shebangs:1}
374 find
%{?buildroot}%{_bindir} \
375 \
( -name arc_summary
-or
-name arcstat
-or
-name dbufstat \
) \
376 -exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \
;
377 find
%{?buildroot}%{_datadir} \
378 \
( -name
test-runner.py
-or
-name zts
-report.py \
) \
379 -exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \
;
384 %if 0%{?systemd_post:1}
385 %systemd_post %{systemd_svcs}
387 if [ "$
1"
= "
1"
-o "$
1"
= "
install"
] ; then
388 # Initial installation
389 systemctl preset
%{systemd_svcs} >/dev
/null || true
393 if [ -x
/sbin
/chkconfig
]; then
394 /sbin
/chkconfig
--add zfs
-import
395 /sbin
/chkconfig
--add zfs
-mount
396 /sbin
/chkconfig
--add zfs
-share
397 /sbin
/chkconfig
--add zfs
-zed
402 # On RHEL/CentOS 7 the static nodes aren't refreshed by default after
403 # installing a package. This is the default behavior for Fedora.
405 %if 0%{?rhel} == 7 || 0%{?centos} == 7
406 systemctl restart kmod
-static
-nodes
407 systemctl restart systemd
-tmpfiles
-setup
-dev
413 %if 0%{?systemd_preun:1}
414 %systemd_preun %{systemd_svcs}
416 if [ "$
1"
= "
0"
-o "$
1"
= "remove"
] ; then
417 # Package removal, not upgrade
418 systemctl
--no
-reload disable
%{systemd_svcs} >/dev
/null || true
419 systemctl stop
%{systemd_svcs} >/dev
/null || true
423 if [ "$
1"
= "
0"
-o "$
1"
= "remove"
] && [ -x
/sbin
/chkconfig
]; then
424 /sbin
/chkconfig
--del zfs
-import
425 /sbin
/chkconfig
--del zfs
-mount
426 /sbin
/chkconfig
--del zfs
-share
427 /sbin
/chkconfig
--del zfs
-zed
434 %if 0%{?systemd_postun:1}
435 %systemd_postun %{systemd_svcs}
437 systemctl
--system daemon
-reload
>/dev
/null || true
444 %{_bindir}/raidz_test
445 %{_bindir}/zgenhostid
447 %{_bindir}/zpool_influxdb
448 # Optional Python 2/3 scripts
449 %{_bindir}/arc_summary
456 # Configuration files and scripts
457 %{_libexecdir}/%{name}
460 %{_udevdir}/rules.d
/*
461 %if ! 0%{?_systemd} || 0%{?_initramfs}
462 # Files needed for sysvinit and initramfs-tools
463 %{_sysconfdir}/%{name}/zfs
-functions
464 %config(noreplace
) %{_initconfdir}/zfs
466 %exclude %{_sysconfdir}/%{name}/zfs
-functions
467 %exclude %{_initconfdir}/zfs
473 %{_systemdgeneratordir}/*
475 %config(noreplace
) %{_sysconfdir}/init.d
/*
477 %config(noreplace
) %{_sysconfdir}/%{name}/zed.d
/*
478 %config(noreplace
) %{_sysconfdir}/%{name}/zpool.d
/*
479 %config(noreplace
) %{_sysconfdir}/%{name}/vdev_id.conf.
*.example
480 %attr(440, root
, root
) %config(noreplace
) %{_sysconfdir}/sudoers.d
/*
482 %{_libdir}/security
/*
483 %{_datadir}/pam
-configs
/*
487 %{_libdir}/libzpool.so.
*
490 %{_libdir}/libnvpair.so.
*
493 %{_libdir}/libuutil.so.
*
496 %{_libdir}/libzfs
*.so.
*
498 %files -n libzfs4
-devel
499 %{_pkgconfigdir}/libzfs.pc
500 %{_pkgconfigdir}/libzfsbootenv.pc
501 %{_pkgconfigdir}/libzfs_core.pc
504 %doc AUTHORS COPYRIGHT LICENSE NOTICE README.md
510 %doc contrib
/dracut
/README.dracut.markdown
511 %{_dracutdir}/modules.d
/*
514 %files -n python
%{__python_pkg_version}-pyzfs
515 %doc contrib
/pyzfs
/README
516 %doc contrib
/pyzfs
/LICENSE
517 %defattr(-,root
,root
,-)
518 %{__python_sitelib}/libzfs_core
/*
519 %{__python_sitelib}/pyzfs
*
524 %doc contrib
/initramfs
/README.initramfs.markdown
525 /usr
/share
/initramfs
-tools
/*
527 # Since we're not building the initramfs package,
528 # ignore those files.
529 %exclude /usr
/share
/initramfs
-tools