]> git.proxmox.com Git - mirror_zfs.git/blame - rpm/generic/zfs.spec.in
Fix systemd_ RPM macros usage on Debian-based distributions
[mirror_zfs.git] / rpm / generic / zfs.spec.in
CommitLineData
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
881f45c6 37%bcond_with systemd
f3757573 38
881f45c6
RE
39# Generic enable switch for systemd
40%if %{with systemd}
41%define _systemd 1
42%endif
43
8b974ba0
BA
44# RHEL >= 7 comes with systemd
45%if 0%{?rhel} >= 7
46%define _systemd 1
47%endif
48
881f45c6
RE
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
f3757573
BB
60
61Name: @PACKAGE@
62Version: @VERSION@
63Release: @RELEASE@%{?dist}
64Summary: Commands to control the kernel modules and libraries
65
66Group: System Environment/Kernel
67License: @ZFS_META_LICENSE@
68URL: http://zfsonlinux.org/
69Source0: %{name}-%{version}.tar.gz
70BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
68a2e016 71Requires: spl = %{version}
c9b5cc8c
TF
72Requires: libzpool2 = %{version}
73Requires: libnvpair1 = %{version}
74Requires: libuutil1 = %{version}
75Requires: libzfs2 = %{version}
28967367 76Requires: %{name}-kmod = %{version}
f3757573
BB
77Provides: %{name}-kmod-common = %{version}
78
f12971e6
RE
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.
81Conflicts: zfs-fuse
82
f3757573
BB
83%if 0%{?rhel}%{?fedora}%{?suse_version}
84BuildRequires: zlib-devel
85BuildRequires: libuuid-devel
f3757573 86BuildRequires: libblkid-devel
de0ef912
BB
87BuildRequires: libudev-devel
88BuildRequires: libattr-devel
f3757573 89%endif
03658d50 90
881f45c6
RE
91%if 0%{?_systemd}
92Requires(post): systemd
93Requires(preun): systemd
94Requires(postun): systemd
881f45c6 95%endif
f3757573 96
d6418de0
TH
97# The zpool iostat/status -c scripts call some utilities like lsblk and iostat
98Requires: util-linux
99Requires: sysstat
100
f3757573 101%description
c9b5cc8c 102This package contains the ZFS command line utilities.
f3757573 103
c9b5cc8c
TF
104%package -n libzpool2
105Summary: Native ZFS pool library for Linux
106Group: System Environment/Kernel
107
108%description -n libzpool2
109This package contains the zpool library, which provides support
110for managing zpools
111
c0ba93de 112%post -n libzpool2 -p /sbin/ldconfig
c9b5cc8c
TF
113%postun -n libzpool2 -p /sbin/ldconfig
114
115%package -n libnvpair1
116Summary: Solaris name-value library for Linux
117Group: System Environment/Kernel
118
119%description -n libnvpair1
120This package contains routines for packing and unpacking name-value
121pairs. This functionality is used to portably transport data across
122process boundaries, between kernel and user space, and can be used
123to write self describing data structures on disk.
124
c0ba93de 125%post -n libnvpair1 -p /sbin/ldconfig
c9b5cc8c
TF
126%postun -n libnvpair1 -p /sbin/ldconfig
127
128%package -n libuutil1
129Summary: Solaris userland utility library for Linux
130Group: System Environment/Kernel
131
132%description -n libuutil1
133This 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
c0ba93de 143%post -n libuutil1 -p /sbin/ldconfig
c9b5cc8c
TF
144%postun -n libuutil1 -p /sbin/ldconfig
145
146%package -n libzfs2
147Summary: Native ZFS filesystem library for Linux
148Group: System Environment/Kernel
149
150%description -n libzfs2
151This package provides support for managing ZFS filesystems
152
c0ba93de 153%post -n libzfs2 -p /sbin/ldconfig
c9b5cc8c
TF
154%postun -n libzfs2 -p /sbin/ldconfig
155
156%package -n libzfs2-devel
f3757573
BB
157Summary: Development headers
158Group: System Environment/Kernel
c9b5cc8c
TF
159Requires: libzfs2 = %{version}
160Requires: libzpool2 = %{version}
161Requires: libnvpair1 = %{version}
162Requires: libuutil1 = %{version}
163Provides: libzpool2-devel
164Provides: libnvpair1-devel
165Provides: libuutil1-devel
166Obsoletes: zfs-devel
f3757573 167
c9b5cc8c 168%description -n libzfs2-devel
f3757573
BB
169This package contains the header files needed for building additional
170applications against the ZFS libraries.
171
172%package test
173Summary: Test infrastructure
174Group: System Environment/Kernel
175Requires: %{name}%{?_isa} = %{version}-%{release}
176Requires: parted
177Requires: lsscsi
178Requires: mdadm
179Requires: bc
6bb24f4d 180Requires: ksh
d4cf3127
BB
181Requires: fio
182Requires: acl
183Requires: sudo
184Requires: sysstat
185Requires: rng-tools
186AutoReqProv: no
f3757573
BB
187
188%description test
189This package contains test infrastructure and support scripts for
190validating the file system.
191
192%package dracut
193Summary: Dracut module
194Group: System Environment/Kernel
195Requires: %{name}%{?_isa} = %{version}-%{release}
196Requires: dracut
197
198%description dracut
199This package contains a dracut module used to construct an initramfs
200image which is ZFS aware.
201
2cac7f5f
TF
202%if 0%{?_initramfs}
203%package initramfs
204Summary: Initramfs module
205Group: System Environment/Kernel
206Requires: %{name}%{?_isa} = %{version}-%{release}
207Requires: %{name} = %{version}-%{release}
208Requires: initramfs-tools
209
210%description initramfs
211This package contains a initramfs module used to construct an initramfs
212image which is ZFS aware.
213%endif
214
f3757573
BB
215%prep
216%if %{with debug}
217 %define debug --enable-debug
218%else
219 %define debug --disable-debug
220%endif
881f45c6
RE
221%if 0%{?_systemd}
222 %define systemd --enable-systemd --with-systemdunitdir=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --disable-sysvinit
30a64eba 223 %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
224%else
225 %define systemd --enable-sysvinit --disable-systemd
226%endif
f3757573
BB
227
228%setup -q
229
230%build
231%configure \
232 --with-config=user \
233 --with-udevdir=%{_udevdir} \
2ee4e7da 234 --with-udevruledir=%{_udevruledir} \
f3757573
BB
235 --with-dracutdir=%{_dracutdir} \
236 --disable-static \
237 %{debug} \
881f45c6 238 %{systemd}
f3757573
BB
239make %{?_smp_mflags}
240
241%install
242%{__rm} -rf $RPM_BUILD_ROOT
243make install DESTDIR=%{?buildroot}
244find %{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \;
245
ba661a6e 246%post
881f45c6 247%if 0%{?_systemd}
29b79dcf 248%if 0%{?systemd_post:1}
b3c159fe 249%systemd_post %{systemd_svcs}
881f45c6 250%else
29b79dcf 251if [ "$1" = "1" -o "$1" = "install" ] ; then
252 # Initial installation
253 systemctl preset %{systemd_svcs} >/dev/null || true
254fi
255%endif
256%else
2a34db1b
TF
257if [ -x /sbin/chkconfig ]; then
258 /sbin/chkconfig --add zfs-import
259 /sbin/chkconfig --add zfs-mount
260 /sbin/chkconfig --add zfs-share
261 /sbin/chkconfig --add zfs-zed
262fi
881f45c6 263%endif
168d056c 264exit 0
ba661a6e
BB
265
266%preun
881f45c6 267%if 0%{?_systemd}
29b79dcf 268%if 0%{?systemd_preun:1}
b3c159fe 269%systemd_preun %{systemd_svcs}
881f45c6 270%else
29b79dcf 271if [ "$1" = "0" -o "$1" = "remove" ] ; then
272 # Package removal, not upgrade
273 systemctl --no-reload disable %{systemd_svcs} >/dev/null || true
274 systemctl stop %{systemd_svcs} >/dev/null || true
275fi
276%endif
277%else
278if [ "$1" = "0" -o "$1" = "remove" ] && [ -x /sbin/chkconfig ]; then
2a34db1b
TF
279 /sbin/chkconfig --del zfs-import
280 /sbin/chkconfig --del zfs-mount
281 /sbin/chkconfig --del zfs-share
282 /sbin/chkconfig --del zfs-zed
ba661a6e 283fi
881f45c6 284%endif
168d056c 285exit 0
f3757573 286
881f45c6 287%postun
881f45c6 288%if 0%{?_systemd}
29b79dcf 289%if 0%{?systemd_postun:1}
b3c159fe 290%systemd_postun %{systemd_svcs}
29b79dcf 291%else
292systemctl --system daemon-reload >/dev/null || true
293%endif
881f45c6 294%endif
f3757573
BB
295
296%files
f3757573 297%{_sbindir}/*
fb02fabf 298%{_bindir}/*
9e246ac3 299%{_libexecdir}/%{name}
f3757573
BB
300%{_mandir}/man1/*
301%{_mandir}/man5/*
302%{_mandir}/man8/*
303%{_udevdir}/vdev_id
304%{_udevdir}/zvol_id
305%{_udevdir}/rules.d/*
881f45c6
RE
306%if 0%{?_systemd}
307/usr/lib/modules-load.d/*
308%{_unitdir}/*
309%{_presetdir}/*
310%else
2a34db1b
TF
311%config(noreplace) %{_sysconfdir}/init.d/*
312%config(noreplace) %{_initconfdir}/zfs
881f45c6 313%endif
2a34db1b 314%config(noreplace) %{_sysconfdir}/%{name}
099700d9 315%attr(440, root, root) %config(noreplace) %{_sysconfdir}/sudoers.d/*
f3757573 316
c9b5cc8c
TF
317%files -n libzpool2
318%{_libdir}/libzpool.so.*
319
320%files -n libnvpair1
321%{_libdir}/libnvpair.so.*
322
323%files -n libuutil1
324%{_libdir}/libuutil.so.*
325
326%files -n libzfs2
327%{_libdir}/libzfs*.so.*
328
329%files -n libzfs2-devel
c3f8dc2a
TF
330%{_datadir}/pkgconfig/libzfs.pc
331%{_datadir}/pkgconfig/libzfs_core.pc
f3757573
BB
332%{_libdir}/*.so
333%{_includedir}/*
c9b5cc8c
TF
334%doc AUTHORS COPYRIGHT DISCLAIMER
335%doc OPENSOLARIS.LICENSE README.markdown
f3757573
BB
336
337%files test
338%{_datadir}/%{name}
339
340%files dracut
cc492505 341%doc contrib/dracut/README.dracut.markdown
f3757573
BB
342%{_dracutdir}/modules.d/*
343
2cac7f5f
TF
344%if 0%{?_initramfs}
345%files initramfs
346%doc contrib/initramfs/README.initramfs.markdown
347/usr/share/initramfs-tools/*
348%else
349# Since we're not building the initramfs package,
350# ignore those files.
351%exclude /usr/share/initramfs-tools
352%endif
353
f3757573 354%changelog
e3b28e16
TH
355* Thu Feb 01 2018 Tony Hutter <hutter2@llnl.gov> - 0.7.6-1
356- Released 0.7.6-1, detailed release notes are available at:
357- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.6
a803eacf
TH
358* Mon Dec 18 2017 Tony Hutter <hutter2@llnl.gov> - 0.7.5-1
359- Released 0.7.5-1, detailed release notes are available at:
360- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.5
3c7fa6ca
TH
361* Thu Dec 07 2017 Tony Hutter <hutter2@llnl.gov> - 0.7.4-1
362- Released 0.7.4-1, detailed release notes are available at:
363- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.4
99598264
TH
364* Wed Oct 18 2017 Tony Hutter <hutter2@llnl.gov> - 0.7.3-1
365- Released 0.7.3-1, detailed release notes are available at:
366- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.3
edd7c246
TH
367* Fri Sep 22 2017 Tony Hutter <hutter2@llnl.gov> - 0.7.2-1
368- Released 0.7.2-1, detailed release notes are available at:
369- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.2
751575fe
TH
370* Tue Aug 8 2017 Tony Hutter <hutter2@llnl.gov> - 0.7.1-1
371- Released 0.7.1-1, detailed release notes are available at:
372- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.1
ccad6431
BB
373* Wed Jul 26 2017 Brian Behlendorf <behlendorf1@llnl.gov> - 0.7.0-1
374- Released 0.7.0-1, detailed release notes are available at:
375- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.0