Add conditional chkconfig to packaging
[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  /lib/dracut
9 %endif
10
11 %bcond_with    debug
12 %bcond_with    blkid
13 %bcond_with    selinux
14
15
16 Name:           @PACKAGE@
17 Version:        @VERSION@
18 Release:        @RELEASE@%{?dist}
19 Summary:        Commands to control the kernel modules and libraries
20
21 Group:          System Environment/Kernel
22 License:        @ZFS_META_LICENSE@
23 URL:            http://zfsonlinux.org/
24 Source0:        %{name}-%{version}.tar.gz
25 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
26 ExclusiveArch:  i386 i686 x86_64
27
28 # May build but untested on ppc/ppc64
29 ExcludeArch:    ppc ppc64
30
31 Requires:       spl = %{version}
32 Requires:       %{name}-kmod >= %{version}
33 Provides:       %{name}-kmod-common = %{version}
34
35 %if 0%{?rhel}%{?fedora}%{?suse_version}
36 BuildRequires:  zlib-devel
37 BuildRequires:  libuuid-devel
38 %if %{with blkid}
39 BuildRequires:  libblkid-devel
40 %endif
41 %if %{with selinux}
42 BuildRequires:  libselinux-devel
43 %endif
44 %endif
45
46 %description
47 This package contains the ZFS command line utilities and libraries.
48
49 %package devel
50 Summary:        Development headers
51 Group:          System Environment/Kernel
52 Requires:       %{name}%{?_isa} = %{version}-%{release}
53
54 %description devel
55 This package contains the header files needed for building additional
56 applications against the ZFS libraries.
57
58 %package test
59 Summary:        Test infrastructure
60 Group:          System Environment/Kernel
61 Requires:       %{name}%{?_isa} = %{version}-%{release}
62 Requires:       parted
63 Requires:       lsscsi
64 Requires:       mdadm
65 Requires:       bc
66
67 %description test
68 This package contains test infrastructure and support scripts for
69 validating the file system.
70
71 %package dracut
72 Summary:        Dracut module
73 Group:          System Environment/Kernel
74 Requires:       %{name}%{?_isa} = %{version}-%{release}
75 Requires:       dracut
76
77 %description dracut
78 This package contains a dracut module used to construct an initramfs
79 image which is ZFS aware.
80
81 %prep
82 %if %{with debug}
83     %define debug --enable-debug
84 %else
85     %define debug --disable-debug
86 %endif
87 %if %{with blkid}
88     %define blkid --with-blkid
89 %else
90     %define blkid --without-blkid
91 %endif
92 %if %{with selinux}
93     %define selinux --with-selinux
94 %else
95     %define selinux --without-selinux
96 %endif
97
98 %setup -q
99
100 %build
101 %configure \
102     --with-config=user \
103     --with-udevdir=%{_udevdir} \
104     --with-dracutdir=%{_dracutdir} \
105     --disable-static \
106     %{debug} \
107     %{blkid} \
108     %{selinux}
109 make %{?_smp_mflags}
110
111 %install
112 %{__rm} -rf $RPM_BUILD_ROOT
113 make install DESTDIR=%{?buildroot}
114 find %{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \;
115
116 %post
117 /sbin/ldconfig
118 [ -x /sbin/chkconfig ] && /sbin/chkconfig --add zfs
119
120 %preun
121 if [ $1 -eq 0 ] ; then
122     [ -x /sbin/chkconfig ] && /sbin/chkconfig --del zfs
123 fi
124
125 %postun -p /sbin/ldconfig
126
127 %files
128 %doc AUTHORS COPYRIGHT DISCLAIMER
129 %doc OPENSOLARIS.LICENSE README.markdown
130 %{_sbindir}/*
131 %{_bindir}/*
132 %{_libdir}/*.so.1*
133 %{_mandir}/man1/*
134 %{_mandir}/man5/*
135 %{_mandir}/man8/*
136 %{_udevdir}/vdev_id
137 %{_udevdir}/zvol_id
138 %{_udevdir}/rules.d/*
139 %config(noreplace) %{_sysconfdir}/%{name}
140 %{_sysconfdir}/init.d/*
141
142 %files devel
143 %{_libdir}/*.so
144 %{_includedir}/*
145
146 %files test
147 %{_datadir}/%{name}
148
149 %files dracut
150 %doc dracut/README.dracut.markdown
151 %{_dracutdir}/modules.d/*
152
153 %changelog
154 * Fri Mar 22 2013 Brian Behlendorf <behlendorf1@llnl.gov> - 0.6.1-1
155 - First official stable release.