]>
Commit | Line | Data |
---|---|---|
f3757573 BB |
1 | %global _sbindir /sbin |
2 | %global _libdir /%{_lib} | |
2ee4e7da TF |
3 | |
4 | # Set the default udev directory based on distribution. | |
5d2107d8 | 5 | %if %{undefined _udevdir} |
2ee4e7da | 6 | %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7 |
f3757573 | 7 | %global _udevdir %{_prefix}/lib/udev |
f3757573 BB |
8 | %else |
9 | %global _udevdir /lib/udev | |
2ee4e7da TF |
10 | %endif |
11 | %endif | |
12 | ||
13 | # Set the default udevrule directory based on distribution. | |
5d2107d8 | 14 | %if %{undefined _udevruledir} |
2ee4e7da | 15 | %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7 |
5d2107d8 | 16 | %global _udevruledir %{_prefix}/lib/udev/rules.d |
2ee4e7da | 17 | %else |
5d2107d8 | 18 | %global _udevruledir /lib/udev/rules.d |
2ee4e7da TF |
19 | %endif |
20 | %endif | |
21 | ||
22 | # Set the default dracut directory based on distribution. | |
5d2107d8 | 23 | %if %{undefined _dracutdir} |
2ee4e7da TF |
24 | %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7 |
25 | %global _dracutdir %{_prefix}/lib/dracut | |
26 | %else | |
4788a01d | 27 | %global _dracutdir %{_prefix}/share/dracut |
f3757573 | 28 | %endif |
2ee4e7da | 29 | %endif |
f3757573 | 30 | |
3b79cef2 BB |
31 | # Set the default _initconfdir when undefined. |
32 | %if %{undefined _initconfdir} | |
33 | %global _initconfdir /etc/sysconfig | |
34 | %endif | |
35 | ||
f3757573 | 36 | %bcond_with debug |
fed90353 BB |
37 | %bcond_with debuginfo |
38 | %bcond_with asan | |
881f45c6 | 39 | %bcond_with systemd |
f3757573 | 40 | |
881f45c6 RE |
41 | # Generic enable switch for systemd |
42 | %if %{with systemd} | |
43 | %define _systemd 1 | |
44 | %endif | |
45 | ||
8b974ba0 BA |
46 | # RHEL >= 7 comes with systemd |
47 | %if 0%{?rhel} >= 7 | |
48 | %define _systemd 1 | |
49 | %endif | |
50 | ||
881f45c6 RE |
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 | |
f3757573 BB |
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) | |
68a2e016 | 73 | Requires: spl = %{version} |
c9b5cc8c TF |
74 | Requires: libzpool2 = %{version} |
75 | Requires: libnvpair1 = %{version} | |
76 | Requires: libuutil1 = %{version} | |
77 | Requires: libzfs2 = %{version} | |
28967367 | 78 | Requires: %{name}-kmod = %{version} |
f3757573 BB |
79 | Provides: %{name}-kmod-common = %{version} |
80 | ||
f12971e6 RE |
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 | ||
f3757573 BB |
85 | %if 0%{?rhel}%{?fedora}%{?suse_version} |
86 | BuildRequires: zlib-devel | |
87 | BuildRequires: libuuid-devel | |
f3757573 | 88 | BuildRequires: libblkid-devel |
de0ef912 BB |
89 | BuildRequires: libudev-devel |
90 | BuildRequires: libattr-devel | |
4807c0ba TC |
91 | BuildRequires: openssl-devel |
92 | Requires: openssl | |
ee410eef | 93 | %if 0%{?_systemd} |
94 | BuildRequires: systemd | |
95 | %endif | |
f3757573 | 96 | %endif |
ee410eef | 97 | |
881f45c6 RE |
98 | %if 0%{?_systemd} |
99 | Requires(post): systemd | |
100 | Requires(preun): systemd | |
101 | Requires(postun): systemd | |
881f45c6 | 102 | %endif |
f3757573 | 103 | |
d6418de0 TH |
104 | # The zpool iostat/status -c scripts call some utilities like lsblk and iostat |
105 | Requires: util-linux | |
106 | Requires: sysstat | |
107 | ||
f3757573 | 108 | %description |
c9b5cc8c | 109 | This package contains the ZFS command line utilities. |
f3757573 | 110 | |
c9b5cc8c TF |
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 | ||
c0ba93de | 119 | %post -n libzpool2 -p /sbin/ldconfig |
c9b5cc8c TF |
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 | ||
c0ba93de | 132 | %post -n libnvpair1 -p /sbin/ldconfig |
c9b5cc8c TF |
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 | ||
c0ba93de | 150 | %post -n libuutil1 -p /sbin/ldconfig |
c9b5cc8c TF |
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 | ||
c0ba93de | 160 | %post -n libzfs2 -p /sbin/ldconfig |
c9b5cc8c TF |
161 | %postun -n libzfs2 -p /sbin/ldconfig |
162 | ||
163 | %package -n libzfs2-devel | |
f3757573 BB |
164 | Summary: Development headers |
165 | Group: System Environment/Kernel | |
c9b5cc8c TF |
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 | |
f3757573 | 174 | |
c9b5cc8c | 175 | %description -n libzfs2-devel |
f3757573 BB |
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 | |
6bb24f4d | 187 | Requires: ksh |
13589da9 BB |
188 | Requires: fio |
189 | Requires: acl | |
190 | Requires: sudo | |
191 | Requires: sysstat | |
b2ab468d | 192 | Requires: libaio |
13589da9 | 193 | AutoReqProv: no |
f3757573 BB |
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 | ||
2cac7f5f TF |
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 | ||
f3757573 BB |
222 | %prep |
223 | %if %{with debug} | |
224 | %define debug --enable-debug | |
225 | %else | |
226 | %define debug --disable-debug | |
227 | %endif | |
fed90353 BB |
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 | ||
881f45c6 RE |
241 | %if 0%{?_systemd} |
242 | %define systemd --enable-systemd --with-systemdunitdir=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --disable-sysvinit | |
9920950c | 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 |
881f45c6 RE |
244 | %else |
245 | %define systemd --enable-sysvinit --disable-systemd | |
246 | %endif | |
f3757573 BB |
247 | |
248 | %setup -q | |
249 | ||
250 | %build | |
251 | %configure \ | |
252 | --with-config=user \ | |
253 | --with-udevdir=%{_udevdir} \ | |
2ee4e7da | 254 | --with-udevruledir=%{_udevruledir} \ |
f3757573 BB |
255 | --with-dracutdir=%{_dracutdir} \ |
256 | --disable-static \ | |
257 | %{debug} \ | |
fed90353 BB |
258 | %{debuginfo} \ |
259 | %{asan} \ | |
881f45c6 | 260 | %{systemd} |
f3757573 BB |
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 | ||
ba661a6e | 268 | %post |
881f45c6 | 269 | %if 0%{?_systemd} |
fbd42542 | 270 | %if 0%{?systemd_post:1} |
b3c159fe | 271 | %systemd_post %{systemd_svcs} |
881f45c6 | 272 | %else |
fbd42542 | 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 | |
2a34db1b TF |
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 | |
881f45c6 | 285 | %endif |
168d056c | 286 | exit 0 |
ba661a6e | 287 | |
a6cc9756 BB |
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 | ||
ba661a6e | 297 | %preun |
881f45c6 | 298 | %if 0%{?_systemd} |
fbd42542 | 299 | %if 0%{?systemd_preun:1} |
b3c159fe | 300 | %systemd_preun %{systemd_svcs} |
881f45c6 | 301 | %else |
fbd42542 | 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 | |
2a34db1b TF |
310 | /sbin/chkconfig --del zfs-import |
311 | /sbin/chkconfig --del zfs-mount | |
312 | /sbin/chkconfig --del zfs-share | |
313 | /sbin/chkconfig --del zfs-zed | |
ba661a6e | 314 | fi |
881f45c6 | 315 | %endif |
168d056c | 316 | exit 0 |
f3757573 | 317 | |
881f45c6 | 318 | %postun |
881f45c6 | 319 | %if 0%{?_systemd} |
fbd42542 | 320 | %if 0%{?systemd_postun:1} |
b3c159fe | 321 | %systemd_postun %{systemd_svcs} |
fbd42542 | 322 | %else |
323 | systemctl --system daemon-reload >/dev/null || true | |
324 | %endif | |
881f45c6 | 325 | %endif |
f3757573 BB |
326 | |
327 | %files | |
f3757573 | 328 | %{_sbindir}/* |
fb02fabf | 329 | %{_bindir}/* |
9e246ac3 | 330 | %{_libexecdir}/%{name} |
f3757573 BB |
331 | %{_mandir}/man1/* |
332 | %{_mandir}/man5/* | |
333 | %{_mandir}/man8/* | |
334 | %{_udevdir}/vdev_id | |
335 | %{_udevdir}/zvol_id | |
336 | %{_udevdir}/rules.d/* | |
881f45c6 RE |
337 | %if 0%{?_systemd} |
338 | /usr/lib/modules-load.d/* | |
339 | %{_unitdir}/* | |
340 | %{_presetdir}/* | |
341 | %else | |
2a34db1b TF |
342 | %config(noreplace) %{_sysconfdir}/init.d/* |
343 | %config(noreplace) %{_initconfdir}/zfs | |
881f45c6 | 344 | %endif |
2a34db1b | 345 | %config(noreplace) %{_sysconfdir}/%{name} |
099700d9 | 346 | %attr(440, root, root) %config(noreplace) %{_sysconfdir}/sudoers.d/* |
f3757573 | 347 | |
c9b5cc8c TF |
348 | %files -n libzpool2 |
349 | %{_libdir}/libzpool.so.* | |
350 | ||
351 | %files -n libnvpair1 | |
352 | %{_libdir}/libnvpair.so.* | |
353 | ||
354 | %files -n libuutil1 | |
355 | %{_libdir}/libuutil.so.* | |
356 | ||
357 | %files -n libzfs2 | |
358 | %{_libdir}/libzfs*.so.* | |
359 | ||
360 | %files -n libzfs2-devel | |
c3f8dc2a TF |
361 | %{_datadir}/pkgconfig/libzfs.pc |
362 | %{_datadir}/pkgconfig/libzfs_core.pc | |
f3757573 BB |
363 | %{_libdir}/*.so |
364 | %{_includedir}/* | |
c9b5cc8c TF |
365 | %doc AUTHORS COPYRIGHT DISCLAIMER |
366 | %doc OPENSOLARIS.LICENSE README.markdown | |
f3757573 BB |
367 | |
368 | %files test | |
369 | %{_datadir}/%{name} | |
370 | ||
371 | %files dracut | |
cc492505 | 372 | %doc contrib/dracut/README.dracut.markdown |
f3757573 BB |
373 | %{_dracutdir}/modules.d/* |
374 | ||
2cac7f5f TF |
375 | %if 0%{?_initramfs} |
376 | %files initramfs | |
377 | %doc contrib/initramfs/README.initramfs.markdown | |
378 | /usr/share/initramfs-tools/* | |
379 | %else | |
380 | # Since we're not building the initramfs package, | |
381 | # ignore those files. | |
382 | %exclude /usr/share/initramfs-tools | |
383 | %endif | |
384 | ||
f3757573 | 385 | %changelog |
ccad6431 BB |
386 | * Wed Jul 26 2017 Brian Behlendorf <behlendorf1@llnl.gov> - 0.7.0-1 |
387 | - Released 0.7.0-1, detailed release notes are available at: | |
388 | - https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.0 |