]> git.proxmox.com Git - mirror_zfs.git/blob - rpm/generic/zfs.spec.in
Update spec file to enable systemd for RHEL7
[mirror_zfs.git] / rpm / generic / zfs.spec.in
1 %global _sbindir /sbin
2 %global _libdir /%{_lib}
3 %if 0%{?fedora} >= 17
4 %global _udevdir %{_prefix}/lib/udev
5 %global _dracutdir %{_prefix}/lib/dracut
6 %else
7 %global _udevdir /lib/udev
8 %global _dracutdir %{_prefix}/share/dracut
9 %endif
10
11 %bcond_with debug
12 %bcond_with blkid
13 %bcond_with systemd
14
15 # Generic enable switch for systemd
16 %if %{with systemd}
17 %define _systemd 1
18 %endif
19
20 # RHEL >= 7 comes with systemd
21 %if 0%{?rhel} >= 7
22 %define _systemd 1
23 %endif
24
25 # Fedora >= 15 comes with systemd, but only >= 18 has
26 # the proper macros
27 %if 0%{?fedora} >= 18
28 %define _systemd 1
29 %endif
30
31 # opensuse >= 12.1 comes with systemd, but only >= 13.1
32 # has the proper macros
33 %if 0%{?suse_version} >= 1310
34 %define _systemd 1
35 %endif
36
37 Name: @PACKAGE@
38 Version: @VERSION@
39 Release: @RELEASE@%{?dist}
40 Summary: Commands to control the kernel modules and libraries
41
42 Group: System Environment/Kernel
43 License: @ZFS_META_LICENSE@
44 URL: http://zfsonlinux.org/
45 Source0: %{name}-%{version}.tar.gz
46 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
47 ExclusiveArch: i386 i686 x86_64
48
49 # May build but untested on ppc/ppc64
50 ExcludeArch: ppc ppc64
51
52 Requires: spl = %{version}
53 Requires: libzpool2 = %{version}
54 Requires: libnvpair1 = %{version}
55 Requires: libuutil1 = %{version}
56 Requires: libzfs2 = %{version}
57 Requires: %{name}-kmod = %{version}
58 Provides: %{name}-kmod-common = %{version}
59
60 # zfs-fuse provides the same commands and man pages that ZoL does. Renaming
61 # those on either side would conflict with all available documentation.
62 Conflicts: zfs-fuse
63
64 %if 0%{?rhel}%{?fedora}%{?suse_version}
65 BuildRequires: zlib-devel
66 BuildRequires: libuuid-devel
67 %if %{with blkid}
68 BuildRequires: libblkid-devel
69 %endif
70 %endif
71 %if 0%{?_systemd}
72 Requires(post): systemd
73 Requires(preun): systemd
74 Requires(postun): systemd
75 BuildRequires: systemd
76 %endif
77
78 %description
79 This package contains the ZFS command line utilities.
80
81 %package -n libzpool2
82 Summary: Native ZFS pool library for Linux
83 Group: System Environment/Kernel
84
85 %description -n libzpool2
86 This package contains the zpool library, which provides support
87 for managing zpools
88
89 %post-n libzpool2 -p /sbin/ldconfig
90 %postun -n libzpool2 -p /sbin/ldconfig
91
92 %package -n libnvpair1
93 Summary: Solaris name-value library for Linux
94 Group: System Environment/Kernel
95
96 %description -n libnvpair1
97 This package contains routines for packing and unpacking name-value
98 pairs. This functionality is used to portably transport data across
99 process boundaries, between kernel and user space, and can be used
100 to write self describing data structures on disk.
101
102 %post-n libnvpair1 -p /sbin/ldconfig
103 %postun -n libnvpair1 -p /sbin/ldconfig
104
105 %package -n libuutil1
106 Summary: Solaris userland utility library for Linux
107 Group: System Environment/Kernel
108
109 %description -n libuutil1
110 This library provides a variety of compatibility functions for ZFS on Linux:
111 * libspl: The Solaris Porting Layer userland library, which provides APIs
112 that make it possible to run Solaris user code in a Linux environment
113 with relatively minimal modification.
114 * libavl: The Adelson-Velskii Landis balanced binary tree manipulation
115 library.
116 * libefi: The Extensible Firmware Interface library for GUID disk
117 partitioning.
118 * libshare: NFS, SMB, and iSCSI service integration for ZFS.
119
120 %post-n libuutil1 -p /sbin/ldconfig
121 %postun -n libuutil1 -p /sbin/ldconfig
122
123 %package -n libzfs2
124 Summary: Native ZFS filesystem library for Linux
125 Group: System Environment/Kernel
126
127 %description -n libzfs2
128 This package provides support for managing ZFS filesystems
129
130 %post-n libzfs2 -p /sbin/ldconfig
131 %postun -n libzfs2 -p /sbin/ldconfig
132
133 %package -n libzfs2-devel
134 Summary: Development headers
135 Group: System Environment/Kernel
136 Requires: libzfs2 = %{version}
137 Requires: libzpool2 = %{version}
138 Requires: libnvpair1 = %{version}
139 Requires: libuutil1 = %{version}
140 Provides: libzpool2-devel
141 Provides: libnvpair1-devel
142 Provides: libuutil1-devel
143 Obsoletes: zfs-devel
144
145 %description -n libzfs2-devel
146 This package contains the header files needed for building additional
147 applications against the ZFS libraries.
148
149 %package test
150 Summary: Test infrastructure
151 Group: System Environment/Kernel
152 Requires: %{name}%{?_isa} = %{version}-%{release}
153 Requires: parted
154 Requires: lsscsi
155 Requires: mdadm
156 Requires: bc
157
158 %description test
159 This package contains test infrastructure and support scripts for
160 validating the file system.
161
162 %package dracut
163 Summary: Dracut module
164 Group: System Environment/Kernel
165 Requires: %{name}%{?_isa} = %{version}-%{release}
166 Requires: dracut
167
168 %description dracut
169 This package contains a dracut module used to construct an initramfs
170 image which is ZFS aware.
171
172 %prep
173 %if %{with debug}
174 %define debug --enable-debug
175 %else
176 %define debug --disable-debug
177 %endif
178 %if %{with blkid}
179 %define blkid --with-blkid
180 %else
181 %define blkid --without-blkid
182 %endif
183 %if 0%{?_systemd}
184 %define systemd --enable-systemd --with-systemdunitdir=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --disable-sysvinit
185 %else
186 %define systemd --enable-sysvinit --disable-systemd
187 %endif
188
189 %setup -q
190
191 %build
192 %configure \
193 --with-config=user \
194 --with-udevdir=%{_udevdir} \
195 --with-dracutdir=%{_dracutdir} \
196 --disable-static \
197 %{debug} \
198 %{blkid} \
199 %{systemd}
200 make %{?_smp_mflags}
201
202 %install
203 %{__rm} -rf $RPM_BUILD_ROOT
204 make install DESTDIR=%{?buildroot}
205 find %{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \;
206
207 %post
208 %if 0%{?_systemd}
209 %systemd_post zfs.target
210 %else
211 [ -x /sbin/chkconfig ] && /sbin/chkconfig --add zfs
212 %endif
213 exit 0
214
215 %preun
216 %if 0%{?_systemd}
217 %systemd_preun zfs.target
218 %else
219 if [ $1 -eq 0 ] ; then
220 [ -x /sbin/chkconfig ] && /sbin/chkconfig --del zfs
221 fi
222 %endif
223 exit 0
224
225 %postun
226 %if 0%{?_systemd}
227 %systemd_postun zfs.target
228 %endif
229
230 %files
231 %{_sbindir}/*
232 %{_bindir}/*
233 %{_libexecdir}/%{name}
234 %{_mandir}/man1/*
235 %{_mandir}/man5/*
236 %{_mandir}/man8/*
237 %{_udevdir}/vdev_id
238 %{_udevdir}/zvol_id
239 %{_udevdir}/rules.d/*
240 %config(noreplace) %{_sysconfdir}/%{name}
241 %if 0%{?_systemd}
242 /usr/lib/modules-load.d/*
243 %{_unitdir}/*
244 %{_presetdir}/*
245 %else
246 %{_sysconfdir}/init.d/*
247 %endif
248
249 %files -n libzpool2
250 %{_libdir}/libzpool.so.*
251
252 %files -n libnvpair1
253 %{_libdir}/libnvpair.so.*
254
255 %files -n libuutil1
256 %{_libdir}/libuutil.so.*
257
258 %files -n libzfs2
259 %{_libdir}/libzfs*.so.*
260
261 %files -n libzfs2-devel
262 %{_libdir}/*.so
263 %{_includedir}/*
264 %doc AUTHORS COPYRIGHT DISCLAIMER
265 %doc OPENSOLARIS.LICENSE README.markdown
266
267 %files test
268 %{_datadir}/%{name}
269
270 %files dracut
271 %doc dracut/README.dracut.markdown
272 %{_dracutdir}/modules.d/*
273
274 %changelog
275 * Wed Aug 21 2013 Brian Behlendorf <behlendorf1@llnl.gov> - 0.6.2-1
276 - Released 0.6.2-1
277 * Fri Mar 22 2013 Brian Behlendorf <behlendorf1@llnl.gov> - 0.6.1-1
278 - First official stable release.