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
56 # Generic enable switch for systemd
61 # RHEL >= 7 comes with systemd
66 # Fedora >= 15 comes with systemd, but only >= 18 has
72 # opensuse >= 12.1 comes with systemd, but only >= 13.1
73 # has the proper macros
74 %if 0%{?suse_version} >= 1310
78 # When not specified default to distribution provided version. This
79 # is normally Python 3, but for RHEL <= 7 only Python 2 is provided.
80 %if %{undefined __use_python}
81 %if 0%{?rhel} && 0%{?rhel} <= 7
82 %define __python
/usr
/bin
/python2
83 %define __python_pkg_version
2
84 %define __python_cffi_pkg python
-cffi
85 %define __python_setuptools_pkg python
-setuptools
87 %define __python
/usr
/bin
/python3
88 %define __python_pkg_version
3
89 %define __python_cffi_pkg python3
-cffi
90 %define __python_setuptools_pkg python3
-setuptools
93 %define __python
%{__use_python}
94 %define __python_pkg_version
%{__use_python_pkg_version}
95 %define __python_cffi_pkg python
%{__python_pkg_version}-cffi
96 %define __python_setuptools_pkg python
%{__python_pkg_version}-setuptools
98 %define __python_sitelib %
(%{__python} -Esc "from distutils.sysconfig import get_python_lib
; print
(get_python_lib
())"
)
100 # By default python-pyzfs is enabled, with the exception of
101 # RHEL 6 which by default uses Python 2.6 which is too old.
110 Release: @RELEASE@
%{?dist}
111 Summary: Commands to control the kernel modules and libraries
113 Group: System Environment
/Kernel
114 License: @ZFS_META_LICENSE@
115 URL: http
://zfsonlinux.org
/
116 Source0: %{name}-%{version}.tar.gz
117 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n
)
118 Requires: libzpool2
= %{version}
119 Requires: libnvpair1
= %{version}
120 Requires: libuutil1
= %{version}
121 Requires: libzfs2
= %{version}
122 Requires: %{name}-kmod = %{version}
123 Provides: %{name}-kmod-common = %{version}
126 # zfs-fuse provides the same commands and man pages that ZoL does. Renaming
127 # those on either side would conflict with all available documentation.
130 %if 0%{?rhel}%{?fedora}%{?suse_version}
131 BuildRequires
: gcc
, make
132 BuildRequires
: zlib
-devel
133 BuildRequires
: libuuid
-devel
134 BuildRequires
: libblkid
-devel
135 BuildRequires
: libudev
-devel
136 BuildRequires
: libattr
-devel
137 BuildRequires
: openssl
-devel
138 %if 0%{?fedora} >= 28 || 0%{?rhel} >= 8 || 0%{?centos} >= 8
139 BuildRequires
: libtirpc
-devel
143 BuildRequires
: systemd
148 Requires(post
): systemd
149 Requires(preun
): systemd
150 Requires(postun
): systemd
153 # The zpool iostat/status -c scripts call some utilities like lsblk and iostat
158 This package contains the core ZFS
command line utilities.
160 %package -n libzpool2
161 Summary: Native ZFS pool library
for Linux
162 Group: System Environment
/Kernel
164 %description -n libzpool2
165 This package contains the zpool library
, which provides support
168 %post -n libzpool2
-p
/sbin
/ldconfig
169 %postun -n libzpool2
-p
/sbin
/ldconfig
171 %package -n libnvpair1
172 Summary: Solaris name
-value library
for Linux
173 Group: System Environment
/Kernel
175 %description -n libnvpair1
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 %post -n libnvpair1
-p
/sbin
/ldconfig
182 %postun -n libnvpair1
-p
/sbin
/ldconfig
184 %package -n libuutil1
185 Summary: Solaris userland utility library
for Linux
186 Group: System Environment
/Kernel
188 %description -n libuutil1
189 This library provides a variety of compatibility functions
for ZFS on Linux
:
190 * libspl
: The Solaris Porting Layer userland library
, which provides APIs
191 that
make it possible to run Solaris user code
in a Linux environment
192 with relatively minimal modification.
193 * libavl
: The Adelson
-Velskii Landis balanced binary tree manipulation
195 * libefi
: The Extensible Firmware Interface library
for GUID disk
197 * libshare
: NFS
, SMB
, and iSCSI service integration
for ZFS.
199 %post -n libuutil1
-p
/sbin
/ldconfig
200 %postun -n libuutil1
-p
/sbin
/ldconfig
203 Summary: Native ZFS filesystem library
for Linux
204 Group: System Environment
/Kernel
206 %description -n libzfs2
207 This package provides support
for managing ZFS filesystems
209 %post -n libzfs2
-p
/sbin
/ldconfig
210 %postun -n libzfs2
-p
/sbin
/ldconfig
212 %package -n libzfs2
-devel
213 Summary: Development headers
214 Group: System Environment
/Kernel
215 Requires: libzfs2
= %{version}
216 Requires: libzpool2
= %{version}
217 Requires: libnvpair1
= %{version}
218 Requires: libuutil1
= %{version}
219 Provides: libzpool2
-devel
220 Provides: libnvpair1
-devel
221 Provides: libuutil1
-devel
224 %description -n libzfs2
-devel
225 This package contains the header files needed
for building additional
226 applications against the ZFS libraries.
229 Summary: Test infrastructure
230 Group: System Environment
/Kernel
231 Requires: %{name}%{?_isa} = %{version}-%{release}
242 Requires: python
%{__python_pkg_version}
243 %if 0%{?rhel}%{?fedora}%{?suse_version}
244 BuildRequires
: libaio
-devel
249 This package contains
test infrastructure and support scripts
for
250 validating the file system.
253 Summary: Dracut module
254 Group: System Environment
/Kernel
256 Requires: %{name} >= %{version}
258 Requires: /usr
/bin
/awk
262 This package contains a dracut module used to construct an initramfs
263 image which is ZFS aware.
266 %package -n python
%{__python_pkg_version}-pyzfs
267 Summary: Python
%{python_version} wrapper
for libzfs_core
268 Group: Development
/Languages
/Python
271 Requires: libzfs2
= %{version}
272 Requires: libnvpair1
= %{version}
274 Requires: python
%{__python_pkg_version}
275 Requires: %{__python_cffi_pkg}
276 %if 0%{?rhel}%{?fedora}%{?suse_version}
277 BuildRequires
: python
%{__python_pkg_version}-devel
278 BuildRequires
: %{__python_cffi_pkg}
279 BuildRequires
: %{__python_setuptools_pkg}
280 BuildRequires
: libffi
-devel
283 %description -n python
%{__python_pkg_version}-pyzfs
284 This package provides a python wrapper
for the libzfs_core C library.
289 Summary: Initramfs module
290 Group: System Environment
/Kernel
291 Requires: %{name}%{?_isa} = %{version}-%{release}
292 Requires: %{name} = %{version}-%{release}
293 Requires: initramfs
-tools
295 %description initramfs
296 This package contains a initramfs module used to construct an initramfs
297 image which is ZFS aware.
302 %define debug
--enable-debug
304 %define debug
--disable
-debug
307 %if %{with debuginfo}
308 %define debuginfo
--enable-debuginfo
310 %define debuginfo
--disable
-debuginfo
314 %define asan
--enable-asan
316 %define asan
--disable
-asan
320 %define systemd
--enable-systemd
--with
-systemdunitdir
=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --with-systemdmodulesloaddir=%{_modulesloaddir} --with-systemdgeneratordir=%{_systemdgeneratordir} --disable
-sysvinit
321 %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
323 %define systemd
--enable-sysvinit
--disable
-systemd
327 %define pyzfs
--enable-pyzfs
329 %define pyzfs
--disable
-pyzfs
337 --with
-udevdir
=%{_udevdir} \
338 --with
-udevruledir
=%{_udevruledir} \
339 --with
-dracutdir
=%{_dracutdir} \
340 --with
-python
=%{__python} \
350 %{__rm} -rf $RPM_BUILD_ROOT
351 make install DESTDIR
=%{?buildroot}
352 find
%{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \
;
353 %if 0%{!?__brp_mangle_shebangs:1}
354 find
%{?buildroot}%{_bindir} \
355 \
( -name arc_summary
-or
-name arcstat
-or
-name dbufstat \
) \
356 -exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \
;
357 find
%{?buildroot}%{_datadir} \
358 \
( -name
test-runner.py
-or
-name zts
-report.py \
) \
359 -exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \
;
364 %if 0%{?systemd_post:1}
365 %systemd_post %{systemd_svcs}
367 if [ "$
1"
= "
1"
-o "$
1"
= "
install"
] ; then
368 # Initial installation
369 systemctl preset
%{systemd_svcs} >/dev
/null || true
373 if [ -x
/sbin
/chkconfig
]; then
374 /sbin
/chkconfig
--add zfs
-import
375 /sbin
/chkconfig
--add zfs
-mount
376 /sbin
/chkconfig
--add zfs
-share
377 /sbin
/chkconfig
--add zfs
-zed
382 # On RHEL/CentOS 7 the static nodes aren't refreshed by default after
383 # installing a package. This is the default behavior for Fedora.
385 %if 0%{?rhel} == 7 || 0%{?centos} == 7
386 systemctl restart kmod
-static
-nodes
387 systemctl restart systemd
-tmpfiles
-setup
-dev
393 %if 0%{?systemd_preun:1}
394 %systemd_preun %{systemd_svcs}
396 if [ "$
1"
= "
0"
-o "$
1"
= "remove"
] ; then
397 # Package removal, not upgrade
398 systemctl
--no
-reload disable
%{systemd_svcs} >/dev
/null || true
399 systemctl stop
%{systemd_svcs} >/dev
/null || true
403 if [ "$
1"
= "
0"
-o "$
1"
= "remove"
] && [ -x
/sbin
/chkconfig
]; then
404 /sbin
/chkconfig
--del zfs
-import
405 /sbin
/chkconfig
--del zfs
-mount
406 /sbin
/chkconfig
--del zfs
-share
407 /sbin
/chkconfig
--del zfs
-zed
414 %if 0%{?systemd_postun:1}
415 %systemd_postun %{systemd_svcs}
417 systemctl
--system daemon
-reload
>/dev
/null || true
424 %{_bindir}/raidz_test
425 %{_bindir}/zgenhostid
427 # Optional Python 2/3 scripts
428 %{_bindir}/arc_summary
435 # Configuration files and scripts
436 %{_libexecdir}/%{name}
439 %{_udevdir}/rules.d
/*
440 %if ! 0%{?_systemd} || 0%{?_initramfs}
441 # Files needed for sysvinit and initramfs-tools
442 %{_sysconfdir}/%{name}/zfs
-functions
443 %config(noreplace
) %{_initconfdir}/zfs
445 %exclude %{_sysconfdir}/%{name}/zfs
-functions
446 %exclude %{_initconfdir}/zfs
452 %{_systemdgeneratordir}/*
454 %config(noreplace
) %{_sysconfdir}/init.d
/*
456 %config(noreplace
) %{_sysconfdir}/%{name}/zed.d
/*
457 %config(noreplace
) %{_sysconfdir}/%{name}/zpool.d
/*
458 %config(noreplace
) %{_sysconfdir}/%{name}/vdev_id.conf.
*.example
459 %attr(440, root
, root
) %config(noreplace
) %{_sysconfdir}/sudoers.d
/*
462 %{_libdir}/libzpool.so.
*
465 %{_libdir}/libnvpair.so.
*
468 %{_libdir}/libuutil.so.
*
471 %{_libdir}/libzfs
*.so.
*
473 %files -n libzfs2
-devel
474 %{_datarootdir}/pkgconfig
/libzfs.pc
475 %{_datarootdir}/pkgconfig
/libzfs_core.pc
478 %doc AUTHORS COPYRIGHT LICENSE NOTICE README.md
484 %doc contrib
/dracut
/README.dracut.markdown
485 %{_dracutdir}/modules.d
/*
488 %files -n python
%{__python_pkg_version}-pyzfs
489 %doc contrib
/pyzfs
/README
490 %doc contrib
/pyzfs
/LICENSE
491 %defattr(-,root
,root
,-)
492 %{__python_sitelib}/libzfs_core
/*
493 %{__python_sitelib}/pyzfs
*
498 %doc contrib
/initramfs
/README.initramfs.markdown
499 /usr
/share
/initramfs
-tools
/*
501 # Since we're not building the initramfs package,
502 # ignore those files.
503 %exclude /usr
/share
/initramfs
-tools