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 # Exclude test-runner.py from the rpmbuild shebang check to allow it to run
57 # under Python 2 and 3.
58 %global __brp_mangle_shebangs_exclude_from
test-runner.py
60 # Generic enable switch for systemd
65 # RHEL >= 7 comes with systemd
70 # Fedora >= 15 comes with systemd, but only >= 18 has
76 # opensuse >= 12.1 comes with systemd, but only >= 13.1
77 # has the proper macros
78 %if 0%{?suse_version} >= 1310
82 # When not specified default to distribution provided version. This
83 # is normally Python 3, but for RHEL <= 7 only Python 2 is provided.
84 %if %{undefined __use_python}
85 %if 0%{?rhel} && 0%{?rhel} <= 7
86 %define __python
/usr
/bin
/python2
87 %define __python_pkg_version
2
88 %define __python_cffi_pkg python
-cffi
89 %define __python_setuptools_pkg python
-setuptools
91 %define __python
/usr
/bin
/python3
92 %define __python_pkg_version
3
93 %define __python_cffi_pkg python3
-cffi
94 %define __python_setuptools_pkg python3
-setuptools
97 %define __python
%{__use_python}
98 %define __python_pkg_version
%{__use_python_pkg_version}
99 %define __python_cffi_pkg python
%{__python_pkg_version}-cffi
100 %define __python_setuptools_pkg python
%{__python_pkg_version}-setuptools
102 %define __python_sitelib %
(%{__python} -Esc "from distutils.sysconfig import get_python_lib
; print
(get_python_lib
())"
)
104 # By default python-pyzfs is enabled, with the exception of
105 # RHEL 6 which by default uses Python 2.6 which is too old.
114 Release: @RELEASE@
%{?dist}
115 Summary: Commands to control the kernel modules and libraries
117 Group: System Environment
/Kernel
118 License: @ZFS_META_LICENSE@
119 URL: http
://zfsonlinux.org
/
120 Source0: %{name}-%{version}.tar.gz
121 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n
)
122 Requires: libzpool2
= %{version}
123 Requires: libnvpair1
= %{version}
124 Requires: libuutil1
= %{version}
125 Requires: libzfs2
= %{version}
126 Requires: %{name}-kmod = %{version}
127 Provides: %{name}-kmod-common = %{version}
130 # zfs-fuse provides the same commands and man pages that ZoL does. Renaming
131 # those on either side would conflict with all available documentation.
134 %if 0%{?rhel}%{?fedora}%{?suse_version}
135 BuildRequires
: gcc
, make
136 BuildRequires
: zlib
-devel
137 BuildRequires
: libuuid
-devel
138 BuildRequires
: libblkid
-devel
139 BuildRequires
: libudev
-devel
140 BuildRequires
: libattr
-devel
141 BuildRequires
: openssl
-devel
142 %if 0%{?fedora} >= 28
143 BuildRequires
: libtirpc
-devel
147 BuildRequires
: systemd
152 Requires(post
): systemd
153 Requires(preun
): systemd
154 Requires(postun
): systemd
157 # The zpool iostat/status -c scripts call some utilities like lsblk and iostat
162 This package contains the core ZFS
command line utilities.
164 %package -n libzpool2
165 Summary: Native ZFS pool library
for Linux
166 Group: System Environment
/Kernel
168 %description -n libzpool2
169 This package contains the zpool library
, which provides support
172 %post -n libzpool2
-p
/sbin
/ldconfig
173 %postun -n libzpool2
-p
/sbin
/ldconfig
175 %package -n libnvpair1
176 Summary: Solaris name
-value library
for Linux
177 Group: System Environment
/Kernel
179 %description -n libnvpair1
180 This package contains routines
for packing and unpacking name
-value
181 pairs. This functionality is used to portably transport data across
182 process boundaries
, between kernel and user space
, and can be used
183 to write self describing data structures on disk.
185 %post -n libnvpair1
-p
/sbin
/ldconfig
186 %postun -n libnvpair1
-p
/sbin
/ldconfig
188 %package -n libuutil1
189 Summary: Solaris userland utility library
for Linux
190 Group: System Environment
/Kernel
192 %description -n libuutil1
193 This library provides a variety of compatibility functions
for ZFS on Linux
:
194 * libspl
: The Solaris Porting Layer userland library
, which provides APIs
195 that
make it possible to run Solaris user code
in a Linux environment
196 with relatively minimal modification.
197 * libavl
: The Adelson
-Velskii Landis balanced binary tree manipulation
199 * libefi
: The Extensible Firmware Interface library
for GUID disk
201 * libshare
: NFS
, SMB
, and iSCSI service integration
for ZFS.
203 %post -n libuutil1
-p
/sbin
/ldconfig
204 %postun -n libuutil1
-p
/sbin
/ldconfig
207 Summary: Native ZFS filesystem library
for Linux
208 Group: System Environment
/Kernel
210 %description -n libzfs2
211 This package provides support
for managing ZFS filesystems
213 %post -n libzfs2
-p
/sbin
/ldconfig
214 %postun -n libzfs2
-p
/sbin
/ldconfig
216 %package -n libzfs2
-devel
217 Summary: Development headers
218 Group: System Environment
/Kernel
219 Requires: libzfs2
= %{version}
220 Requires: libzpool2
= %{version}
221 Requires: libnvpair1
= %{version}
222 Requires: libuutil1
= %{version}
223 Provides: libzpool2
-devel
224 Provides: libnvpair1
-devel
225 Provides: libuutil1
-devel
228 %description -n libzfs2
-devel
229 This package contains the header files needed
for building additional
230 applications against the ZFS libraries.
233 Summary: Test infrastructure
234 Group: System Environment
/Kernel
235 Requires: %{name}%{?_isa} = %{version}-%{release}
246 Requires: python
%{__python_pkg_version}
247 %if 0%{?rhel}%{?fedora}%{?suse_version}
248 BuildRequires
: libaio
-devel
253 This package contains
test infrastructure and support scripts
for
254 validating the file system.
257 Summary: Dracut module
258 Group: System Environment
/Kernel
260 Requires: %{name} >= %{version}
262 Requires: /usr
/bin
/awk
266 This package contains a dracut module used to construct an initramfs
267 image which is ZFS aware.
270 %package -n python
%{__python_pkg_version}-pyzfs
271 Summary: Python
%{python_version} wrapper
for libzfs_core
272 Group: Development
/Languages
/Python
275 Requires: libzfs2
= %{version}
276 Requires: libnvpair1
= %{version}
278 Requires: python
%{__python_pkg_version}
279 Requires: %{__python_cffi_pkg}
280 %if 0%{?rhel}%{?fedora}%{?suse_version}
281 BuildRequires
: python
%{__python_pkg_version}-devel
282 BuildRequires
: %{__python_cffi_pkg}
283 BuildRequires
: %{__python_setuptools_pkg}
284 BuildRequires
: libffi
-devel
287 %description -n python
%{__python_pkg_version}-pyzfs
288 This package provides a python wrapper
for the libzfs_core C library.
293 Summary: Initramfs module
294 Group: System Environment
/Kernel
295 Requires: %{name}%{?_isa} = %{version}-%{release}
296 Requires: %{name} = %{version}-%{release}
297 Requires: initramfs
-tools
299 %description initramfs
300 This package contains a initramfs module used to construct an initramfs
301 image which is ZFS aware.
306 %define debug
--enable-debug
308 %define debug
--disable
-debug
311 %if %{with debuginfo}
312 %define debuginfo
--enable-debuginfo
314 %define debuginfo
--disable
-debuginfo
318 %define asan
--enable-asan
320 %define asan
--disable
-asan
324 %define systemd
--enable-systemd
--with
-systemdunitdir
=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --with-systemdmodulesloaddir=%{_modulesloaddir} --with-systemdgeneratordir=%{_systemdgeneratordir} --disable
-sysvinit
325 %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
327 %define systemd
--enable-sysvinit
--disable
-systemd
331 %define pyzfs
--enable-pyzfs
333 %define pyzfs
--disable
-pyzfs
341 --with
-udevdir
=%{_udevdir} \
342 --with
-udevruledir
=%{_udevruledir} \
343 --with
-dracutdir
=%{_dracutdir} \
344 --with
-python
=%{__python} \
354 %{__rm} -rf $RPM_BUILD_ROOT
355 make install DESTDIR
=%{?buildroot}
356 find
%{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \
;
360 %if 0%{?systemd_post:1}
361 %systemd_post %{systemd_svcs}
363 if [ "$
1"
= "
1"
-o "$
1"
= "
install"
] ; then
364 # Initial installation
365 systemctl preset
%{systemd_svcs} >/dev
/null || true
369 if [ -x
/sbin
/chkconfig
]; then
370 /sbin
/chkconfig
--add zfs
-import
371 /sbin
/chkconfig
--add zfs
-mount
372 /sbin
/chkconfig
--add zfs
-share
373 /sbin
/chkconfig
--add zfs
-zed
378 # On RHEL/CentOS 7 the static nodes aren't refreshed by default after
379 # installing a package. This is the default behavior for Fedora.
381 %if 0%{?rhel} == 7 || 0%{?centos} == 7
382 systemctl restart kmod
-static
-nodes
383 systemctl restart systemd
-tmpfiles
-setup
-dev
389 %if 0%{?systemd_preun:1}
390 %systemd_preun %{systemd_svcs}
392 if [ "$
1"
= "
0"
-o "$
1"
= "remove"
] ; then
393 # Package removal, not upgrade
394 systemctl
--no
-reload disable
%{systemd_svcs} >/dev
/null || true
395 systemctl stop
%{systemd_svcs} >/dev
/null || true
399 if [ "$
1"
= "
0"
-o "$
1"
= "remove"
] && [ -x
/sbin
/chkconfig
]; then
400 /sbin
/chkconfig
--del zfs
-import
401 /sbin
/chkconfig
--del zfs
-mount
402 /sbin
/chkconfig
--del zfs
-share
403 /sbin
/chkconfig
--del zfs
-zed
410 %if 0%{?systemd_postun:1}
411 %systemd_postun %{systemd_svcs}
413 systemctl
--system daemon
-reload
>/dev
/null || true
420 %{_bindir}/raidz_test
421 %{_bindir}/zgenhostid
423 # Optional Python 2/3 scripts
424 %{_bindir}/arc_summary
431 # Configuration files and scripts
432 %{_libexecdir}/%{name}
435 %{_udevdir}/rules.d
/*
436 %if ! 0%{?_systemd} || 0%{?_initramfs}
437 # Files needed for sysvinit and initramfs-tools
438 %{_sysconfdir}/%{name}/zfs
-functions
439 %config(noreplace
) %{_initconfdir}/zfs
441 %exclude %{_sysconfdir}/%{name}/zfs
-functions
442 %exclude %{_initconfdir}/zfs
448 %{_systemdgeneratordir}/*
450 %config(noreplace
) %{_sysconfdir}/init.d
/*
452 %config(noreplace
) %{_sysconfdir}/%{name}/zed.d
/*
453 %config(noreplace
) %{_sysconfdir}/%{name}/zpool.d
/*
454 %config(noreplace
) %{_sysconfdir}/%{name}/vdev_id.conf.
*.example
455 %attr(440, root
, root
) %config(noreplace
) %{_sysconfdir}/sudoers.d
/*
458 %{_libdir}/libzpool.so.
*
461 %{_libdir}/libnvpair.so.
*
464 %{_libdir}/libuutil.so.
*
467 %{_libdir}/libzfs
*.so.
*
469 %files -n libzfs2
-devel
470 %{_datarootdir}/pkgconfig
/libzfs.pc
471 %{_datarootdir}/pkgconfig
/libzfs_core.pc
474 %doc AUTHORS COPYRIGHT LICENSE NOTICE README.md
480 %doc contrib
/dracut
/README.dracut.markdown
481 %{_dracutdir}/modules.d
/*
484 %files -n python
%{__python_pkg_version}-pyzfs
485 %doc contrib
/pyzfs
/README
486 %doc contrib
/pyzfs
/LICENSE
487 %defattr(-,root
,root
,-)
488 %{__python_sitelib}/libzfs_core
/*
489 %{__python_sitelib}/pyzfs
*
494 %doc contrib
/initramfs
/README.initramfs.markdown
495 /usr
/share
/initramfs
-tools
/*
497 # Since we're not building the initramfs package,
498 # ignore those files.
499 %exclude /usr
/share
/initramfs
-tools