]> git.proxmox.com Git - mirror_zfs.git/blob - rpm/generic/zfs.spec.in
Move properties, parameters, events, and concepts around manual sections
[mirror_zfs.git] / rpm / generic / zfs.spec.in
1 %global _sbindir /sbin
2 %global _libdir /%{_lib}
3
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
8 %else
9 %global _udevdir /lib/udev
10 %endif
11 %endif
12
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
17 %else
18 %global _udevruledir /lib/udev/rules.d
19 %endif
20 %endif
21
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
26 %else
27 %global _dracutdir %{_prefix}/share/dracut
28 %endif
29 %endif
30
31 %if %{undefined _initconfdir}
32 %global _initconfdir /etc/sysconfig
33 %endif
34
35 %if %{undefined _unitdir}
36 %global _unitdir %{_prefix}/lib/systemd/system
37 %endif
38
39 %if %{undefined _presetdir}
40 %global _presetdir %{_prefix}/lib/systemd/system-preset
41 %endif
42
43 %if %{undefined _modulesloaddir}
44 %global _modulesloaddir %{_prefix}/lib/modules-load.d
45 %endif
46
47 %if %{undefined _systemdgeneratordir}
48 %global _systemdgeneratordir %{_prefix}/lib/systemd/system-generators
49 %endif
50
51 %if %{undefined _pkgconfigdir}
52 %global _pkgconfigdir %{_prefix}/%{_lib}/pkgconfig
53 %endif
54
55 %bcond_with debug
56 %bcond_with debuginfo
57 %bcond_with asan
58 %bcond_with systemd
59 %bcond_with pam
60
61 # Generic enable switch for systemd
62 %if %{with systemd}
63 %define _systemd 1
64 %endif
65
66 # RHEL >= 7 comes with systemd
67 %if 0%{?rhel} >= 7
68 %define _systemd 1
69 %endif
70
71 # Fedora >= 15 comes with systemd, but only >= 18 has
72 # the proper macros
73 %if 0%{?fedora} >= 18
74 %define _systemd 1
75 %endif
76
77 # opensuse >= 12.1 comes with systemd, but only >= 13.1
78 # has the proper macros
79 %if 0%{?suse_version} >= 1310
80 %define _systemd 1
81 %endif
82
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
91 %else
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
96 %endif
97 %else
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
102 %endif
103 %define __python_sitelib %(%{__python} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
104
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.
107 %if 0%{?rhel} == 6
108 %bcond_with pyzfs
109 %else
110 %bcond_without pyzfs
111 %endif
112
113 Name: @PACKAGE@
114 Version: @VERSION@
115 Release: @RELEASE@%{?dist}
116 Summary: Commands to control the kernel modules and libraries
117
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: libzpool5 = %{version}
124 Requires: libnvpair3 = %{version}
125 Requires: libuutil3 = %{version}
126 Requires: libzfs5 = %{version}
127 Requires: %{name}-kmod = %{version}
128 Provides: %{name}-kmod-common = %{version}
129 Obsoletes: spl
130
131 # zfs-fuse provides the same commands and man pages that OpenZFS does.
132 # Renaming those on either side would conflict with all available documentation.
133 Conflicts: zfs-fuse
134
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
145 %endif
146 Requires: openssl
147 %if 0%{?_systemd}
148 BuildRequires: systemd
149 %endif
150 %endif
151
152 %if 0%{?_systemd}
153 Requires(post): systemd
154 Requires(preun): systemd
155 Requires(postun): systemd
156 %endif
157
158 # The zpool iostat/status -c scripts call some utilities like lsblk and iostat
159 Requires: util-linux
160 Requires: sysstat
161
162 %description
163 This package contains the core ZFS command line utilities.
164
165 %package -n libzpool5
166 Summary: Native ZFS pool library for Linux
167 Group: System Environment/Kernel
168 Obsoletes: libzpool2
169 Obsoletes: libzpool4
170
171 %description -n libzpool5
172 This package contains the zpool library, which provides support
173 for managing zpools
174
175 %if %{defined ldconfig_scriptlets}
176 %ldconfig_scriptlets -n libzpool5
177 %else
178 %post -n libzpool5 -p /sbin/ldconfig
179 %postun -n libzpool5 -p /sbin/ldconfig
180 %endif
181
182 %package -n libnvpair3
183 Summary: Solaris name-value library for Linux
184 Group: System Environment/Kernel
185 Obsoletes: libnvpair1
186
187 %description -n libnvpair3
188 This package contains routines for packing and unpacking name-value
189 pairs. This functionality is used to portably transport data across
190 process boundaries, between kernel and user space, and can be used
191 to write self describing data structures on disk.
192
193 %if %{defined ldconfig_scriptlets}
194 %ldconfig_scriptlets -n libnvpair3
195 %else
196 %post -n libnvpair3 -p /sbin/ldconfig
197 %postun -n libnvpair3 -p /sbin/ldconfig
198 %endif
199
200 %package -n libuutil3
201 Summary: Solaris userland utility library for Linux
202 Group: System Environment/Kernel
203 Obsoletes: libuutil1
204
205 %description -n libuutil3
206 This library provides a variety of compatibility functions for OpenZFS:
207 * libspl: The Solaris Porting Layer userland library, which provides APIs
208 that make it possible to run Solaris user code in a Linux environment
209 with relatively minimal modification.
210 * libavl: The Adelson-Velskii Landis balanced binary tree manipulation
211 library.
212 * libefi: The Extensible Firmware Interface library for GUID disk
213 partitioning.
214 * libshare: NFS, SMB, and iSCSI service integration for ZFS.
215
216 %if %{defined ldconfig_scriptlets}
217 %ldconfig_scriptlets -n libuutil3
218 %else
219 %post -n libuutil3 -p /sbin/ldconfig
220 %postun -n libuutil3 -p /sbin/ldconfig
221 %endif
222
223 # The library version is encoded in the package name. When updating the
224 # version information it is important to add an obsoletes line below for
225 # the previous version of the package.
226 %package -n libzfs5
227 Summary: Native ZFS filesystem library for Linux
228 Group: System Environment/Kernel
229 Obsoletes: libzfs2
230 Obsoletes: libzfs4
231
232 %description -n libzfs5
233 This package provides support for managing ZFS filesystems
234
235 %if %{defined ldconfig_scriptlets}
236 %ldconfig_scriptlets -n libzfs5
237 %else
238 %post -n libzfs5 -p /sbin/ldconfig
239 %postun -n libzfs5 -p /sbin/ldconfig
240 %endif
241
242 %package -n libzfs5-devel
243 Summary: Development headers
244 Group: System Environment/Kernel
245 Requires: libzfs5 = %{version}
246 Requires: libzpool5 = %{version}
247 Requires: libnvpair3 = %{version}
248 Requires: libuutil3 = %{version}
249 Provides: libzpool5-devel
250 Provides: libnvpair3-devel
251 Provides: libuutil3-devel
252 Obsoletes: zfs-devel
253 Obsoletes: libzfs2-devel
254 Obsoletes: libzfs4-devel
255
256 %description -n libzfs5-devel
257 This package contains the header files needed for building additional
258 applications against the ZFS libraries.
259
260 %package test
261 Summary: Test infrastructure
262 Group: System Environment/Kernel
263 Requires: %{name}%{?_isa} = %{version}-%{release}
264 Requires: parted
265 Requires: lsscsi
266 Requires: mdadm
267 Requires: bc
268 Requires: ksh
269 Requires: fio
270 Requires: acl
271 Requires: sudo
272 Requires: sysstat
273 Requires: libaio
274 Requires: python%{__python_pkg_version}
275 %if 0%{?rhel}%{?fedora}%{?suse_version}
276 BuildRequires: libaio-devel
277 %endif
278 AutoReqProv: no
279
280 %description test
281 This package contains test infrastructure and support scripts for
282 validating the file system.
283
284 %package dracut
285 Summary: Dracut module
286 Group: System Environment/Kernel
287 BuildArch: noarch
288 Requires: %{name} >= %{version}
289 Requires: dracut
290 Requires: /usr/bin/awk
291 Requires: grep
292
293 %description dracut
294 This package contains a dracut module used to construct an initramfs
295 image which is ZFS aware.
296
297 %if %{with pyzfs}
298 %package -n python%{__python_pkg_version}-pyzfs
299 Summary: Python %{python_version} wrapper for libzfs_core
300 Group: Development/Languages/Python
301 License: Apache-2.0
302 BuildArch: noarch
303 Requires: libzfs5 = %{version}
304 Requires: libnvpair3 = %{version}
305 Requires: libffi
306 Requires: python%{__python_pkg_version}
307 Requires: %{__python_cffi_pkg}
308 %if 0%{?rhel}%{?fedora}%{?suse_version}
309 %if 0%{?rhel} >= 8 || 0%{?centos} >= 8 || 0%{?fedora} >= 28
310 BuildRequires: python3-packaging
311 %else
312 BuildRequires: python-packaging
313 %endif
314 BuildRequires: python%{__python_pkg_version}-devel
315 BuildRequires: %{__python_cffi_pkg}
316 BuildRequires: %{__python_setuptools_pkg}
317 BuildRequires: libffi-devel
318 %endif
319
320 %description -n python%{__python_pkg_version}-pyzfs
321 This package provides a python wrapper for the libzfs_core C library.
322 %endif
323
324 %if 0%{?_initramfs}
325 %package initramfs
326 Summary: Initramfs module
327 Group: System Environment/Kernel
328 Requires: %{name}%{?_isa} = %{version}-%{release}
329 Requires: %{name} = %{version}-%{release}
330 Requires: initramfs-tools
331
332 %description initramfs
333 This package contains a initramfs module used to construct an initramfs
334 image which is ZFS aware.
335 %endif
336
337 %prep
338 %if %{with debug}
339 %define debug --enable-debug
340 %else
341 %define debug --disable-debug
342 %endif
343
344 %if %{with debuginfo}
345 %define debuginfo --enable-debuginfo
346 %else
347 %define debuginfo --disable-debuginfo
348 %endif
349
350 %if %{with asan}
351 %define asan --enable-asan
352 %else
353 %define asan --disable-asan
354 %endif
355
356 %if 0%{?_systemd}
357 %define systemd --enable-systemd --with-systemdunitdir=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --with-systemdmodulesloaddir=%{_modulesloaddir} --with-systemdgeneratordir=%{_systemdgeneratordir} --disable-sysvinit
358 %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
359 %else
360 %define systemd --enable-sysvinit --disable-systemd
361 %endif
362
363 %if %{with pyzfs}
364 %define pyzfs --enable-pyzfs
365 %else
366 %define pyzfs --disable-pyzfs
367 %endif
368
369 %if %{with pam}
370 %define pam --enable-pam
371 %else
372 %define pam --disable-pam
373 %endif
374
375 %setup -q
376
377 %build
378 %configure \
379 --with-config=user \
380 --with-udevdir=%{_udevdir} \
381 --with-udevruledir=%{_udevruledir} \
382 --with-dracutdir=%{_dracutdir} \
383 --with-pamconfigsdir=%{_datadir}/pam-configs \
384 --with-pammoduledir=%{_libdir}/security \
385 --with-python=%{__python} \
386 --with-pkgconfigdir=%{_pkgconfigdir} \
387 --disable-static \
388 %{debug} \
389 %{debuginfo} \
390 %{asan} \
391 %{systemd} \
392 %{pam} \
393 %{pyzfs}
394 make %{?_smp_mflags}
395
396 %install
397 %{__rm} -rf $RPM_BUILD_ROOT
398 make install DESTDIR=%{?buildroot}
399 find %{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \;
400 %if 0%{!?__brp_mangle_shebangs:1}
401 find %{?buildroot}%{_bindir} \
402 \( -name arc_summary -or -name arcstat -or -name dbufstat \) \
403 -exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \;
404 find %{?buildroot}%{_datadir} \
405 \( -name test-runner.py -or -name zts-report.py \) \
406 -exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \;
407 %endif
408
409 %post
410 %if 0%{?_systemd}
411 %if 0%{?systemd_post:1}
412 %systemd_post %{systemd_svcs}
413 %else
414 if [ "$1" = "1" -o "$1" = "install" ] ; then
415 # Initial installation
416 systemctl preset %{systemd_svcs} >/dev/null || true
417 fi
418 %endif
419 %else
420 if [ -x /sbin/chkconfig ]; then
421 /sbin/chkconfig --add zfs-import
422 /sbin/chkconfig --add zfs-mount
423 /sbin/chkconfig --add zfs-share
424 /sbin/chkconfig --add zfs-zed
425 fi
426 %endif
427 exit 0
428
429 # On RHEL/CentOS 7 the static nodes aren't refreshed by default after
430 # installing a package. This is the default behavior for Fedora.
431 %posttrans
432 %if 0%{?rhel} == 7 || 0%{?centos} == 7
433 systemctl restart kmod-static-nodes
434 systemctl restart systemd-tmpfiles-setup-dev
435 udevadm trigger
436 %endif
437
438 %preun
439 %if 0%{?_systemd}
440 %if 0%{?systemd_preun:1}
441 %systemd_preun %{systemd_svcs}
442 %else
443 if [ "$1" = "0" -o "$1" = "remove" ] ; then
444 # Package removal, not upgrade
445 systemctl --no-reload disable %{systemd_svcs} >/dev/null || true
446 systemctl stop %{systemd_svcs} >/dev/null || true
447 fi
448 %endif
449 %else
450 if [ "$1" = "0" -o "$1" = "remove" ] && [ -x /sbin/chkconfig ]; then
451 /sbin/chkconfig --del zfs-import
452 /sbin/chkconfig --del zfs-mount
453 /sbin/chkconfig --del zfs-share
454 /sbin/chkconfig --del zfs-zed
455 fi
456 %endif
457 exit 0
458
459 %postun
460 %if 0%{?_systemd}
461 %if 0%{?systemd_postun:1}
462 %systemd_postun %{systemd_svcs}
463 %else
464 systemctl --system daemon-reload >/dev/null || true
465 %endif
466 %endif
467
468 %files
469 # Core utilities
470 %{_sbindir}/*
471 %{_bindir}/raidz_test
472 %{_sbindir}/zgenhostid
473 %{_bindir}/zvol_wait
474 # Optional Python 2/3 scripts
475 %{_bindir}/arc_summary
476 %{_bindir}/arcstat
477 %{_bindir}/dbufstat
478 # Man pages
479 %{_mandir}/man1/*
480 %{_mandir}/man4/*
481 %{_mandir}/man5/*
482 %{_mandir}/man7/*
483 %{_mandir}/man8/*
484 # Configuration files and scripts
485 %{_libexecdir}/%{name}
486 %{_udevdir}/vdev_id
487 %{_udevdir}/zvol_id
488 %{_udevdir}/rules.d/*
489 %{_datadir}/%{name}/compatibility.d
490 %if ! 0%{?_systemd} || 0%{?_initramfs}
491 # Files needed for sysvinit and initramfs-tools
492 %{_sysconfdir}/%{name}/zfs-functions
493 %config(noreplace) %{_initconfdir}/zfs
494 %else
495 %exclude %{_sysconfdir}/%{name}/zfs-functions
496 %exclude %{_initconfdir}/zfs
497 %endif
498 %if 0%{?_systemd}
499 %{_unitdir}/*
500 %{_presetdir}/*
501 %{_modulesloaddir}/*
502 %{_systemdgeneratordir}/*
503 %else
504 %config(noreplace) %{_sysconfdir}/init.d/*
505 %endif
506 %config(noreplace) %{_sysconfdir}/%{name}/zed.d/*
507 %config(noreplace) %{_sysconfdir}/%{name}/zpool.d/*
508 %config(noreplace) %{_sysconfdir}/%{name}/vdev_id.conf.*.example
509 %attr(440, root, root) %config(noreplace) %{_sysconfdir}/sudoers.d/*
510 %if %{with pam}
511 %{_libdir}/security/*
512 %{_datadir}/pam-configs/*
513 %endif
514
515 %files -n libzpool5
516 %{_libdir}/libzpool.so.*
517
518 %files -n libnvpair3
519 %{_libdir}/libnvpair.so.*
520
521 %files -n libuutil3
522 %{_libdir}/libuutil.so.*
523
524 %files -n libzfs5
525 %{_libdir}/libzfs*.so.*
526
527 %files -n libzfs5-devel
528 %{_pkgconfigdir}/libzfs.pc
529 %{_pkgconfigdir}/libzfsbootenv.pc
530 %{_pkgconfigdir}/libzfs_core.pc
531 %{_libdir}/*.so
532 %{_includedir}/*
533 %doc AUTHORS COPYRIGHT LICENSE NOTICE README.md
534
535 %files test
536 %{_datadir}/%{name}/zfs-tests
537 %{_datadir}/%{name}/test-runner
538 %{_datadir}/%{name}/runfiles
539 %{_datadir}/%{name}/*.sh
540
541 %files dracut
542 %doc contrib/dracut/README.dracut.markdown
543 %{_dracutdir}/modules.d/*
544
545 %if %{with pyzfs}
546 %files -n python%{__python_pkg_version}-pyzfs
547 %doc contrib/pyzfs/README
548 %doc contrib/pyzfs/LICENSE
549 %defattr(-,root,root,-)
550 %{__python_sitelib}/libzfs_core/*
551 %{__python_sitelib}/pyzfs*
552 %endif
553
554 %if 0%{?_initramfs}
555 %files initramfs
556 %doc contrib/initramfs/README.initramfs.markdown
557 /usr/share/initramfs-tools/*
558 %else
559 # Since we're not building the initramfs package,
560 # ignore those files.
561 %exclude /usr/share/initramfs-tools
562 %endif