Whamcloud - gitweb
- add things to /etc/modules.conf | /etc/modprobe.conf
[fs/lustre-release.git] / build / lustre.spec.in
1 # lustre.spec
2 %define version @VERSION@
3 %define kversion @LINUXRELEASE@
4
5 Summary: Lustre File System
6 Name: lustre
7 Version: %{version}
8 Release: @RELEASE@
9 Copyright: GPL
10 Group: Utilities/System
11 Source: lustre-%{version}.tar.gz
12 URL: http://clusterfs.com/
13 BuildRoot: /var/tmp/lustre-%{version}-root
14 Obsoletes: lustre-lite, lustre-lite-utils, lustre-ldap
15 Provides: lustre-lite = %{version}, lustre-lite-utils = %{version}, lustre-ldap = %{version}
16
17 %description
18 Userspace tools and files for the Lustre file system.
19
20 %package modules
21 Summary: Kernel Lustre modules for Linux %{kversion}
22 Requires: modutils >= 2.4.10
23 Group: Development/Kernel
24
25 %description modules
26 Lustre file system, server and network drivers for Linux %{kversion}.
27
28 %package source
29 Summary: Object-Based Disk storage driver source
30 Group: Development/Kernel
31
32 %description source
33 Lustre sources for further development
34
35 # Since the RPMs we ship are to be used on both SLES and RHEL, we
36 # can't include any dependency information (since the package names
37 # are different on the two platforms).
38 #
39 # Instead, we can build these empty meta-packages that only include
40 # dependency information.  These let people get the correct
41 # dependencies for their platform and lets them use tools like yum and
42 # red carpet to install the correct files.
43 #
44 # Unfortunately I have not seen this come up on the lists much, so I
45 # have disabled them (by commenting out their empty files section
46 # below) until it's clear that they resolve more confusion than they
47 # add.
48
49 %package deps-sles
50 Summary: Lustre dependencies meta-package for SLES
51 Group: Utilities/System
52 Provides: lustre-deps = %{version}
53 Requires: lustre = %{version}, sles-release, python-xml
54 Conflicts: lustre-deps-rhel
55
56 %description deps-sles
57 This package has RPM dependencies appropriate for SLES systems.
58
59 %package deps-rhel
60 Summary: Lustre dependencies meta-package for RHEL
61 Group: Utilities/System
62 Provides: lustre-deps = %{version}
63 Requires: lustre = %{version}, redhat-release, PyXML
64 Conflicts: lustre-deps-sles
65
66 %description deps-rhel
67 This package has RPM dependencies appropriate for RHEL, RHL, and FC
68 systems.
69
70 %prep
71 %setup -qn lustre-%{version}
72
73 %build
74 # if RPM_BUILD_NCPUS unset, set it
75 if [ -z "$RPM_BUILD_NCPUS" ] ; then
76     RPM_BUILD_NCPUS=$(egrep -c "^cpu[0-9]+" /proc/stat 2>/dev/null || echo 0 :)
77     if [ $RPM_BUILD_NCPUS -eq 0 ] ; then
78         RPM_BUILD_NCPUS=1
79     fi
80     if [ $RPM_BUILD_NCPUS -gt 8 ] ; then
81         RPM_BUILD_NCPUS=8
82     fi
83 fi
84
85 rm -rf $RPM_BUILD_ROOT
86
87 # Set an explicit path to our Linux tree, if we can.
88 cd $RPM_BUILD_DIR/lustre-%{version}
89 ./configure @ac_configure_args@ \
90         --sysconfdir=%{_sysconfdir} \
91         --mandir=%{_mandir} \
92         --libdir=%{_libdir}
93 make -j $RPM_BUILD_NCPUS -s
94
95 %install
96 make install DESTDIR=$RPM_BUILD_ROOT
97 # hack to avoid changing the libsysio code for "make install"
98 rm -f $RPM_BUILD_ROOT%{_libdir}/libsysio.a
99
100 # Create the pristine source directory.
101 cd $RPM_BUILD_DIR/lustre-%{version}
102 mkdir -p $RPM_BUILD_ROOT/usr/src
103 rm -f lustre-source
104 ln -s $RPM_BUILD_ROOT/usr/src lustre-source
105 make distdir distdir=lustre-source/lustre-%{version}
106
107 cat >lustre.files <<EOF
108 %attr(-, root, root) /sbin/mount.lustre
109 %attr(-, root, root) /usr/sbin/*
110 %attr(-, root, root) /usr/bin/*
111 %attr(-, root, root) %{_libdir}/lustre/python
112 %attr(-, root, root) /usr/share/lustre/examples
113
114 %attr(-, root, root) /etc/init.d/lustre
115 %attr(-, root, root) /etc/init.d/lustrefs
116
117 %attr(-, root, root) %{_libdir}/libptlctl.a
118 %attr(-, root, root) %{_libdir}/liblustreapi.a
119 %attr(-, root, root) /usr/include/lustre
120 %attr(-, root, root) /usr/include/linux/lustre_idl.h
121
122 %attr(-, root, root) %{_mandir}/man?/*
123
124 %attr(-, root, root) /etc/openldap/slapd-lustre.conf
125 %attr(-, root, root) /etc/openldap/schema/lustre.schema
126 %attr(-, root, root) /usr/share/lustre/lustre2ldif.xsl
127 %attr(-, root, root) /usr/share/lustre/top.ldif
128 EOF
129 if [ -f $RPM_BUILD_ROOT/usr/lib/liblustre.so ] ; then
130   echo '%attr(-, root, root) %{_libdir}/liblustre.a' >>lustre.files
131   echo '%attr(-, root, root) %{_libdir}/liblustre.so' >>lustre.files
132 fi
133
134 %files -f lustre.files
135
136 %files modules
137 %attr(-, root, root) %doc COPYING
138 %attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre
139 %attr(-, root, root) /lib/modules/%{kversion}/kernel/net/lustre
140
141 %files source
142 %attr(-, root, root) /usr/src/lustre-%{version}
143
144 # uncomment these lines to enable deps packages
145 # %files deps-sles
146 # %files deps-rhel
147
148 %post
149 if [ -f /etc/init.d/lustre ] ; then
150         /sbin/chkconfig --add lustre
151         /sbin/chkconfig --add lustrefs
152 fi
153
154 %preun
155 if [ $1 = 0 -a -f /etc/init.d/lustre ] ; then
156         /sbin/chkconfig --del lustre
157         /sbin/chkconfig --del lustrefs
158 fi
159 rm -f %{_libdir}/lustre/python/Lustre/*.pyc
160
161 %post modules
162 if [ ! -e /dev/obd ]; then
163    mknod /dev/obd c 10 241
164 fi
165 if [ ! -e /dev/portals ]; then
166    mknod /dev/portals c 10 240
167 fi
168 if [ -f /boot/System.map-%{kversion} ]; then
169         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
170 else
171         depmod -ae %{kversion} || exit 0
172 fi
173 for ext in .local "" ; do
174         f=/etc/modprobe.conf$ext
175         if [ -f $f ] && ! grep llite $f >/dev/null 2>/dev/null ; then
176                 cat >> $f <<EOF
177 install kptlrouter modprobe portals ; modprobe --ignore-install kptlrouter
178 install ptlrpc modprobe ksocknal ; modprobe --ignore-install ptlrpc
179 install llite modprobe lov osc ; modprobe --ignore-install llite
180 alias lustre llite
181 EOF
182                 break
183         fi
184 done
185 f=/etc/modules.conf
186 if [ -f $f ] && ! grep llite $f >/dev/null 2>/dev/null ; then
187         cat >> $f <<EOF
188 add below kptlrouter portals
189 add below ptlrpc ksocknal
190 add below llite lov osc
191 alias lustre llite
192 EOF
193 fi
194
195 %postun modules
196 if [ -f /boot/System.map-%{kversion} ]; then
197         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
198 else
199         depmod -ae %{kversion} || exit 0
200 fi
201
202 %clean
203 rm -rf $RPM_BUILD_ROOT