]> git.proxmox.com Git - mirror_zfs.git/blob - rpm/generic/zfs.spec.in
systemd mount generator and tracking ZEDLET
[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 # Set the default _initconfdir when undefined.
32 %if %{undefined _initconfdir}
33 %global _initconfdir /etc/sysconfig
34 %endif
35
36 %bcond_with debug
37 %bcond_with debuginfo
38 %bcond_with asan
39 %bcond_with systemd
40
41 # Generic enable switch for systemd
42 %if %{with systemd}
43 %define _systemd 1
44 %endif
45
46 # RHEL >= 7 comes with systemd
47 %if 0%{?rhel} >= 7
48 %define _systemd 1
49 %endif
50
51 # Fedora >= 15 comes with systemd, but only >= 18 has
52 # the proper macros
53 %if 0%{?fedora} >= 18
54 %define _systemd 1
55 %endif
56
57 # opensuse >= 12.1 comes with systemd, but only >= 13.1
58 # has the proper macros
59 %if 0%{?suse_version} >= 1310
60 %define _systemd 1
61 %endif
62
63 Name: @PACKAGE@
64 Version: @VERSION@
65 Release: @RELEASE@%{?dist}
66 Summary: Commands to control the kernel modules and libraries
67
68 Group: System Environment/Kernel
69 License: @ZFS_META_LICENSE@
70 URL: http://zfsonlinux.org/
71 Source0: %{name}-%{version}.tar.gz
72 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
73 Requires: spl = %{version}
74 Requires: libzpool2 = %{version}
75 Requires: libnvpair1 = %{version}
76 Requires: libuutil1 = %{version}
77 Requires: libzfs2 = %{version}
78 Requires: %{name}-kmod = %{version}
79 Provides: %{name}-kmod-common = %{version}
80
81 # zfs-fuse provides the same commands and man pages that ZoL does. Renaming
82 # those on either side would conflict with all available documentation.
83 Conflicts: zfs-fuse
84
85 %if 0%{?rhel}%{?fedora}%{?suse_version}
86 BuildRequires: zlib-devel
87 BuildRequires: libuuid-devel
88 BuildRequires: libblkid-devel
89 BuildRequires: libudev-devel
90 BuildRequires: libattr-devel
91 BuildRequires: openssl-devel
92 Requires: openssl
93 %if 0%{?_systemd}
94 BuildRequires: systemd
95 %endif
96 %endif
97
98 %if 0%{?_systemd}
99 Requires(post): systemd
100 Requires(preun): systemd
101 Requires(postun): systemd
102 %endif
103
104 # The zpool iostat/status -c scripts call some utilities like lsblk and iostat
105 Requires: util-linux
106 Requires: sysstat
107
108 %description
109 This package contains the ZFS command line utilities.
110
111 %package -n libzpool2
112 Summary: Native ZFS pool library for Linux
113 Group: System Environment/Kernel
114
115 %description -n libzpool2
116 This package contains the zpool library, which provides support
117 for managing zpools
118
119 %post -n libzpool2 -p /sbin/ldconfig
120 %postun -n libzpool2 -p /sbin/ldconfig
121
122 %package -n libnvpair1
123 Summary: Solaris name-value library for Linux
124 Group: System Environment/Kernel
125
126 %description -n libnvpair1
127 This package contains routines for packing and unpacking name-value
128 pairs. This functionality is used to portably transport data across
129 process boundaries, between kernel and user space, and can be used
130 to write self describing data structures on disk.
131
132 %post -n libnvpair1 -p /sbin/ldconfig
133 %postun -n libnvpair1 -p /sbin/ldconfig
134
135 %package -n libuutil1
136 Summary: Solaris userland utility library for Linux
137 Group: System Environment/Kernel
138
139 %description -n libuutil1
140 This library provides a variety of compatibility functions for ZFS on Linux:
141 * libspl: The Solaris Porting Layer userland library, which provides APIs
142 that make it possible to run Solaris user code in a Linux environment
143 with relatively minimal modification.
144 * libavl: The Adelson-Velskii Landis balanced binary tree manipulation
145 library.
146 * libefi: The Extensible Firmware Interface library for GUID disk
147 partitioning.
148 * libshare: NFS, SMB, and iSCSI service integration for ZFS.
149
150 %post -n libuutil1 -p /sbin/ldconfig
151 %postun -n libuutil1 -p /sbin/ldconfig
152
153 %package -n libzfs2
154 Summary: Native ZFS filesystem library for Linux
155 Group: System Environment/Kernel
156
157 %description -n libzfs2
158 This package provides support for managing ZFS filesystems
159
160 %post -n libzfs2 -p /sbin/ldconfig
161 %postun -n libzfs2 -p /sbin/ldconfig
162
163 %package -n libzfs2-devel
164 Summary: Development headers
165 Group: System Environment/Kernel
166 Requires: libzfs2 = %{version}
167 Requires: libzpool2 = %{version}
168 Requires: libnvpair1 = %{version}
169 Requires: libuutil1 = %{version}
170 Provides: libzpool2-devel
171 Provides: libnvpair1-devel
172 Provides: libuutil1-devel
173 Obsoletes: zfs-devel
174
175 %description -n libzfs2-devel
176 This package contains the header files needed for building additional
177 applications against the ZFS libraries.
178
179 %package test
180 Summary: Test infrastructure
181 Group: System Environment/Kernel
182 Requires: %{name}%{?_isa} = %{version}-%{release}
183 Requires: parted
184 Requires: lsscsi
185 Requires: mdadm
186 Requires: bc
187 Requires: ksh
188 Requires: fio
189 Requires: acl
190 Requires: sudo
191 Requires: sysstat
192 Requires: libaio
193 AutoReqProv: no
194
195 %description test
196 This package contains test infrastructure and support scripts for
197 validating the file system.
198
199 %package dracut
200 Summary: Dracut module
201 Group: System Environment/Kernel
202 Requires: %{name}%{?_isa} = %{version}-%{release}
203 Requires: dracut
204
205 %description dracut
206 This package contains a dracut module used to construct an initramfs
207 image which is ZFS aware.
208
209 %if 0%{?_initramfs}
210 %package initramfs
211 Summary: Initramfs module
212 Group: System Environment/Kernel
213 Requires: %{name}%{?_isa} = %{version}-%{release}
214 Requires: %{name} = %{version}-%{release}
215 Requires: initramfs-tools
216
217 %description initramfs
218 This package contains a initramfs module used to construct an initramfs
219 image which is ZFS aware.
220 %endif
221
222 %prep
223 %if %{with debug}
224 %define debug --enable-debug
225 %else
226 %define debug --disable-debug
227 %endif
228
229 %if %{with debuginfo}
230 %define debuginfo --enable-debuginfo
231 %else
232 %define debuginfo --disable-debuginfo
233 %endif
234
235 %if %{with asan}
236 %define asan --enable-asan
237 %else
238 %define asan --disable-asan
239 %endif
240
241 %if 0%{?_systemd}
242 %define systemd --enable-systemd --with-systemdunitdir=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --disable-sysvinit
243 %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
244 %else
245 %define systemd --enable-sysvinit --disable-systemd
246 %endif
247
248 %setup -q
249
250 %build
251 %configure \
252 --with-config=user \
253 --with-udevdir=%{_udevdir} \
254 --with-udevruledir=%{_udevruledir} \
255 --with-dracutdir=%{_dracutdir} \
256 --disable-static \
257 %{debug} \
258 %{debuginfo} \
259 %{asan} \
260 %{systemd}
261 make %{?_smp_mflags}
262
263 %install
264 %{__rm} -rf $RPM_BUILD_ROOT
265 make install DESTDIR=%{?buildroot}
266 find %{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \;
267
268 %post
269 %if 0%{?_systemd}
270 %if 0%{?systemd_post:1}
271 %systemd_post %{systemd_svcs}
272 %else
273 if [ "$1" = "1" -o "$1" = "install" ] ; then
274 # Initial installation
275 systemctl preset %{systemd_svcs} >/dev/null || true
276 fi
277 %endif
278 %else
279 if [ -x /sbin/chkconfig ]; then
280 /sbin/chkconfig --add zfs-import
281 /sbin/chkconfig --add zfs-mount
282 /sbin/chkconfig --add zfs-share
283 /sbin/chkconfig --add zfs-zed
284 fi
285 %endif
286 exit 0
287
288 # On RHEL/CentOS 7 the static nodes aren't refreshed by default after
289 # installing a package. This is the default behavior for Fedora.
290 %posttrans
291 %if 0%{?rhel} == 7 || 0%{?centos} == 7
292 systemctl restart kmod-static-nodes
293 systemctl restart systemd-tmpfiles-setup-dev
294 udevadm trigger
295 %endif
296
297 %preun
298 %if 0%{?_systemd}
299 %if 0%{?systemd_preun:1}
300 %systemd_preun %{systemd_svcs}
301 %else
302 if [ "$1" = "0" -o "$1" = "remove" ] ; then
303 # Package removal, not upgrade
304 systemctl --no-reload disable %{systemd_svcs} >/dev/null || true
305 systemctl stop %{systemd_svcs} >/dev/null || true
306 fi
307 %endif
308 %else
309 if [ "$1" = "0" -o "$1" = "remove" ] && [ -x /sbin/chkconfig ]; then
310 /sbin/chkconfig --del zfs-import
311 /sbin/chkconfig --del zfs-mount
312 /sbin/chkconfig --del zfs-share
313 /sbin/chkconfig --del zfs-zed
314 fi
315 %endif
316 exit 0
317
318 %postun
319 %if 0%{?_systemd}
320 %if 0%{?systemd_postun:1}
321 %systemd_postun %{systemd_svcs}
322 %else
323 systemctl --system daemon-reload >/dev/null || true
324 %endif
325 %endif
326
327 %files
328 %{_sbindir}/*
329 %{_bindir}/*
330 %{_libexecdir}/%{name}
331 %{_mandir}/man1/*
332 %{_mandir}/man5/*
333 %{_mandir}/man8/*
334 %{_udevdir}/vdev_id
335 %{_udevdir}/zvol_id
336 %{_udevdir}/rules.d/*
337 %if 0%{?_systemd}
338 /usr/lib/modules-load.d/*
339 %{_unitdir}/*
340 %{_presetdir}/*
341 %{_generatordir}/*
342 %else
343 %config(noreplace) %{_sysconfdir}/init.d/*
344 %config(noreplace) %{_initconfdir}/zfs
345 %endif
346 %config(noreplace) %{_sysconfdir}/%{name}
347 %attr(440, root, root) %config(noreplace) %{_sysconfdir}/sudoers.d/*
348
349 %files -n libzpool2
350 %{_libdir}/libzpool.so.*
351
352 %files -n libnvpair1
353 %{_libdir}/libnvpair.so.*
354
355 %files -n libuutil1
356 %{_libdir}/libuutil.so.*
357
358 %files -n libzfs2
359 %{_libdir}/libzfs*.so.*
360
361 %files -n libzfs2-devel
362 %{_datadir}/pkgconfig/libzfs.pc
363 %{_datadir}/pkgconfig/libzfs_core.pc
364 %{_libdir}/*.so
365 %{_includedir}/*
366 %doc AUTHORS COPYRIGHT DISCLAIMER
367 %doc OPENSOLARIS.LICENSE README.markdown
368
369 %files test
370 %{_datadir}/%{name}
371
372 %files dracut
373 %doc contrib/dracut/README.dracut.markdown
374 %{_dracutdir}/modules.d/*
375
376 %if 0%{?_initramfs}
377 %files initramfs
378 %doc contrib/initramfs/README.initramfs.markdown
379 /usr/share/initramfs-tools/*
380 %else
381 # Since we're not building the initramfs package,
382 # ignore those files.
383 %exclude /usr/share/initramfs-tools
384 %endif
385
386 %changelog
387 * Wed Jul 26 2017 Brian Behlendorf <behlendorf1@llnl.gov> - 0.7.0-1
388 - Released 0.7.0-1, detailed release notes are available at:
389 - https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.0