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