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