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
86 %define __python
/usr
/bin
/python3
87 %define __python_pkg_version
3
88 %define __python_cffi_pkg python3
-cffi
91 %define __python
%{__use_python}
92 %define __python_pkg_version
%{__use_python_pkg_version}
93 %define __python_cffi_pkg python
%{__python_pkg_version}-cffi
96 # By default python-pyzfs is enabled, with the exception of
97 # RHEL 6 which by default uses Python 2.6 which is too old.
106 Release: @RELEASE@
%{?dist}
107 Summary: Commands to control the kernel modules and libraries
109 Group: System Environment
/Kernel
110 License: @ZFS_META_LICENSE@
111 URL: http
://zfsonlinux.org
/
112 Source0: %{name}-%{version}.tar.gz
113 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n
)
114 Requires: libzpool2
= %{version}
115 Requires: libnvpair1
= %{version}
116 Requires: libuutil1
= %{version}
117 Requires: libzfs2
= %{version}
118 Requires: %{name}-kmod = %{version}
119 Provides: %{name}-kmod-common = %{version}
122 # zfs-fuse provides the same commands and man pages that ZoL does. Renaming
123 # those on either side would conflict with all available documentation.
126 %if 0%{?rhel}%{?fedora}%{?suse_version}
127 BuildRequires
: gcc
, make
128 BuildRequires
: zlib
-devel
129 BuildRequires
: libuuid
-devel
130 BuildRequires
: libblkid
-devel
131 BuildRequires
: libudev
-devel
132 BuildRequires
: libattr
-devel
133 BuildRequires
: openssl
-devel
134 %if 0%{?fedora} >= 28
135 BuildRequires
: libtirpc
-devel
139 BuildRequires
: systemd
144 Requires(post
): systemd
145 Requires(preun
): systemd
146 Requires(postun
): systemd
149 # The zpool iostat/status -c scripts call some utilities like lsblk and iostat
154 This package contains the core ZFS
command line utilities.
156 %package -n libzpool2
157 Summary: Native ZFS pool library
for Linux
158 Group: System Environment
/Kernel
160 %description -n libzpool2
161 This package contains the zpool library
, which provides support
164 %post -n libzpool2
-p
/sbin
/ldconfig
165 %postun -n libzpool2
-p
/sbin
/ldconfig
167 %package -n libnvpair1
168 Summary: Solaris name
-value library
for Linux
169 Group: System Environment
/Kernel
171 %description -n libnvpair1
172 This package contains routines
for packing and unpacking name
-value
173 pairs. This functionality is used to portably transport data across
174 process boundaries
, between kernel and user space
, and can be used
175 to write self describing data structures on disk.
177 %post -n libnvpair1
-p
/sbin
/ldconfig
178 %postun -n libnvpair1
-p
/sbin
/ldconfig
180 %package -n libuutil1
181 Summary: Solaris userland utility library
for Linux
182 Group: System Environment
/Kernel
184 %description -n libuutil1
185 This library provides a variety of compatibility functions
for ZFS on Linux
:
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 %post -n libuutil1
-p
/sbin
/ldconfig
196 %postun -n libuutil1
-p
/sbin
/ldconfig
199 Summary: Native ZFS filesystem library
for Linux
200 Group: System Environment
/Kernel
202 %description -n libzfs2
203 This package provides support
for managing ZFS filesystems
205 %post -n libzfs2
-p
/sbin
/ldconfig
206 %postun -n libzfs2
-p
/sbin
/ldconfig
208 %package -n libzfs2
-devel
209 Summary: Development headers
210 Group: System Environment
/Kernel
211 Requires: libzfs2
= %{version}
212 Requires: libzpool2
= %{version}
213 Requires: libnvpair1
= %{version}
214 Requires: libuutil1
= %{version}
215 Provides: libzpool2
-devel
216 Provides: libnvpair1
-devel
217 Provides: libuutil1
-devel
220 %description -n libzfs2
-devel
221 This package contains the header files needed
for building additional
222 applications against the ZFS libraries.
225 Summary: Test infrastructure
226 Group: System Environment
/Kernel
227 Requires: %{name}%{?_isa} = %{version}-%{release}
238 Requires: python
%{__python_pkg_version}
239 %if 0%{?rhel}%{?fedora}%{?suse_version}
240 BuildRequires
: libaio
-devel
245 This package contains
test infrastructure and support scripts
for
246 validating the file system.
249 Summary: Dracut module
250 Group: System Environment
/Kernel
251 Requires: %{name}%{?_isa} = %{version}-%{release}
253 Requires: /usr
/bin
/awk
257 This package contains a dracut module used to construct an initramfs
258 image which is ZFS aware.
261 %package -n python
%{__python_pkg_version}-pyzfs
262 Summary: Python
%{python_version} wrapper
for libzfs_core
263 Group: Development
/Languages
/Python
266 Requires: libzfs2
= %{version}
267 Requires: libnvpair1
= %{version}
269 Requires: python
%{__python_pkg_version}
270 Requires: %{__python_cffi_pkg}
271 %if 0%{?rhel}%{?fedora}%{?suse_version}
272 BuildRequires
: python
%{__python_pkg_version}-devel
273 BuildRequires
: libffi
-devel
276 %description -n python
%{__python_pkg_version}-pyzfs
277 This package provides a python wrapper
for the libzfs_core C library.
282 Summary: Initramfs module
283 Group: System Environment
/Kernel
284 Requires: %{name}%{?_isa} = %{version}-%{release}
285 Requires: %{name} = %{version}-%{release}
286 Requires: initramfs
-tools
288 %description initramfs
289 This package contains a initramfs module used to construct an initramfs
290 image which is ZFS aware.
295 %define debug
--enable-debug
297 %define debug
--disable
-debug
300 %if %{with debuginfo}
301 %define debuginfo
--enable-debuginfo
303 %define debuginfo
--disable
-debuginfo
307 %define asan
--enable-asan
309 %define asan
--disable
-asan
313 %define systemd
--enable-systemd
--with
-systemdunitdir
=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --with-systemdmodulesloaddir=%{_modulesloaddir} --with-systemdgeneratordir=%{_systemdgeneratordir} --disable
-sysvinit
314 %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
316 %define systemd
--enable-sysvinit
--disable
-systemd
320 %define pyzfs
--enable-pyzfs
322 %define pyzfs
--disable
-pyzfs
330 --with
-udevdir
=%{_udevdir} \
331 --with
-udevruledir
=%{_udevruledir} \
332 --with
-dracutdir
=%{_dracutdir} \
333 --with
-python
=%{__python} \
343 %{__rm} -rf $RPM_BUILD_ROOT
344 make install DESTDIR
=%{?buildroot}
345 find
%{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \
;
349 %if 0%{?systemd_post:1}
350 %systemd_post %{systemd_svcs}
352 if [ "$
1"
= "
1"
-o "$
1"
= "
install"
] ; then
353 # Initial installation
354 systemctl preset
%{systemd_svcs} >/dev
/null || true
358 if [ -x
/sbin
/chkconfig
]; then
359 /sbin
/chkconfig
--add zfs
-import
360 /sbin
/chkconfig
--add zfs
-mount
361 /sbin
/chkconfig
--add zfs
-share
362 /sbin
/chkconfig
--add zfs
-zed
367 # On RHEL/CentOS 7 the static nodes aren't refreshed by default after
368 # installing a package. This is the default behavior for Fedora.
370 %if 0%{?rhel} == 7 || 0%{?centos} == 7
371 systemctl restart kmod
-static
-nodes
372 systemctl restart systemd
-tmpfiles
-setup
-dev
378 %if 0%{?systemd_preun:1}
379 %systemd_preun %{systemd_svcs}
381 if [ "$
1"
= "
0"
-o "$
1"
= "remove"
] ; then
382 # Package removal, not upgrade
383 systemctl
--no
-reload disable
%{systemd_svcs} >/dev
/null || true
384 systemctl stop
%{systemd_svcs} >/dev
/null || true
388 if [ "$
1"
= "
0"
-o "$
1"
= "remove"
] && [ -x
/sbin
/chkconfig
]; then
389 /sbin
/chkconfig
--del zfs
-import
390 /sbin
/chkconfig
--del zfs
-mount
391 /sbin
/chkconfig
--del zfs
-share
392 /sbin
/chkconfig
--del zfs
-zed
399 %if 0%{?systemd_postun:1}
400 %systemd_postun %{systemd_svcs}
402 systemctl
--system daemon
-reload
>/dev
/null || true
409 %{_bindir}/raidz_test
410 %{_bindir}/zgenhostid
411 # Optional Python 2/3 scripts
412 %{_bindir}/arc_summary
419 # Configuration files and scripts
420 %{_libexecdir}/%{name}
423 %{_udevdir}/rules.d
/*
428 %{_systemdgeneratordir}/*
430 %config(noreplace
) %{_sysconfdir}/init.d
/*
431 %config(noreplace
) %{_initconfdir}/zfs
433 %config(noreplace
) %{_sysconfdir}/%{name}
434 %attr(440, root
, root
) %config(noreplace
) %{_sysconfdir}/sudoers.d
/*
437 %{_libdir}/libzpool.so.
*
440 %{_libdir}/libnvpair.so.
*
443 %{_libdir}/libuutil.so.
*
446 %{_libdir}/libzfs
*.so.
*
448 %files -n libzfs2
-devel
449 %{_datadir}/pkgconfig
/libzfs.pc
450 %{_datadir}/pkgconfig
/libzfs_core.pc
453 %doc AUTHORS COPYRIGHT LICENSE NOTICE README.md
459 %doc contrib
/dracut
/README.dracut.markdown
460 %{_dracutdir}/modules.d
/*
463 %files -n python
%{__python_pkg_version}-pyzfs
464 %doc contrib
/pyzfs
/README
465 %doc contrib
/pyzfs
/LICENSE
466 %defattr(-,root
,root
,-)
467 %{python_sitelib}/libzfs_core
/*
468 %{python_sitelib}/pyzfs
*
473 %doc contrib
/initramfs
/README.initramfs.markdown
474 /usr
/share
/initramfs
-tools
/*
476 # Since we're not building the initramfs package,
477 # ignore those files.
478 %exclude /usr
/share
/initramfs
-tools