fe214d27faf120663475782dd9a973d8fa9582f7
[garming/samba-autobuild/.git] / packaging / RHEL-CTDB / samba.spec.tmpl
1 %define initdir %{_sysconfdir}/rc.d/init.d
2 %define auth %(test -f /etc/pam.d/system-auth && echo /etc/pam.d/system-auth || echo)
3
4 Summary: Samba SMB client and server
5 Vendor: Samba Team
6 Packager: Samba Team <samba@lists.samba.org>
7 Name:         samba
8 Version:      PVERSION
9 Release:      1GITHASH
10 Epoch:        0
11 License: GNU GPL version 3
12 Group: System Environment/Daemons
13 URL: http://www.samba.org/
14
15 Source: samba-%{version}.tar.bz2
16
17 # Don't depend on Net::LDAP
18 Source998: filter-requires-samba.sh
19 Source999: setup.tar.bz2
20
21 Requires: /sbin/chkconfig /bin/mktemp /usr/bin/killall
22 Requires: fileutils sed /etc/init.d
23
24 Requires: pam >= 0.64 %{auth} 
25 Requires: samba-common = %{version}-%{release}
26 Provides: samba = %{version}
27
28 Prefix: /usr
29 BuildRoot: %{_tmppath}/%{name}-%{version}-root
30 BuildRequires: pam-devel, readline-devel, fileutils, libacl-devel, openldap-devel, krb5-devel, cups-devel, e2fsprogs-devel, gettext
31 # requirements for building the man pages:
32 BuildRequires: libxslt, docbook-utils, docbook-style-xsl, rsync
33 BuildRequires: ctdb-devel >= 1.2.25
34
35 # Working around perl dependency problem from docs
36 %define __perl_requires %{SOURCE998}
37
38 # rpm screws up the arch lib dir when using --target on RHEL5
39 %ifarch i386 i486 i586 i686 ppc s390
40 %define _libarch lib
41 %else
42 %define _libarch %_lib
43 %endif
44
45 %define _libarchdir /usr/%{_libarch}
46
47 %define numcpu  %(grep "^processor" /proc/cpuinfo |wc -l | sed -e 's/^0$/1/')
48
49 %define with_vfs_gpfs PGPFS_DEFAULT
50 %define with_vfs_tsmsm PGPFS_DEFAULT
51
52 %if %{with_vfs_tsmsm}
53 %define         vfs_tsmsm       ,vfs_tsmsm
54 %endif
55
56 %if %{with_vfs_gpfs}
57 %define         vfs_gpfs        ,vfs_gpfs
58 %endif
59
60 %define         vfs_modules %{?vfs_gpfs}%{?vfs_tsmsm}
61
62 %define         shared_modules idmap_rid,idmap_ad,idmap_tdb2%{vfs_modules}
63
64 %description
65 Samba is the protocol by which a lot of PC-related machines share
66 files, printers, and other information (such as lists of available
67 files and printers). The Windows NT, OS/2, and Linux operating systems
68 support this natively, and add-on packages can enable the same thing
69 for DOS, Windows, VMS, UNIX of all kinds, MVS, and more. This package
70 provides an SMB server that can be used to provide network services to
71 SMB (sometimes called "Lan Manager") clients. Samba uses NetBIOS over
72 TCP/IP (NetBT) protocols and does NOT need the NetBEUI (Microsoft Raw
73 NetBIOS frame) protocol.
74
75
76 ######################################################################
77 %package client
78 Summary: Samba (SMB) client programs.
79 Group: Applications/System
80 Requires: samba-common = %{version}-%{release}
81 Obsoletes: smbfs
82 Provides: samba-client = %{version}-%{release}
83
84 %description client
85 The samba-client package provides some SMB clients to compliment the
86 built-in SMB filesystem in Linux. These clients allow access of SMB
87 shares and printing to SMB printers.
88
89
90 #######################################################################
91 %package common
92 Summary: Files used by both Samba servers and clients.
93 Group: Applications/System
94 Provides: samba-common = %{version}-%{release}
95
96 %description common
97 Samba-common provides files necessary for both the server and client
98 packages of Samba.
99
100
101
102 #######################################################################
103 %package doc
104 Summary:      Samba Documentation
105 Group:        Documentation/Other
106 Provides:     samba-doc = %{version}-%{release}
107 Requires:       /usr/bin/find /bin/rm /usr/bin/xargs
108
109 %description doc
110 The samba-doc package includes the HTML versions of the Samba manpages as well
111 as the HTML and PDF version of "Using Samba", "Samba By Example", and "The
112 Official Samba HOWTO and Reference Guide".
113
114
115 #######################################################################
116
117 %prep
118 %setup -q
119
120 # setup the vendor files (init scripts, etc...)
121 %setup -T -D -a 999 -n samba-%{version} -q
122
123 %build
124
125 /bin/cp setup/filter-requires-samba.sh %{SOURCE998}
126
127 cd source3
128 # RPM_OPT_FLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64"
129
130 ## check for ccache
131 if ccache -h >/dev/null 2>&1 ; then
132         CC="ccache gcc"
133 else
134         CC="gcc"
135 fi
136
137 export CC
138
139 ## always run autogen.sh
140 ./autogen.sh
141
142 CFLAGS="$RPM_OPT_FLAGS $EXTRA -D_GNU_SOURCE" ./configure \
143         --prefix=%{_prefix} \
144         --localstatedir=/var \
145         --with-configdir=%{_sysconfdir}/samba \
146         --libdir=%{_libarchdir} \
147         --with-modulesdir=%{_libarchdir}/samba \
148         --with-pammodulesdir=/%{_libarch}/security \
149         --with-lockdir=/var/lib/samba \
150         --with-logfilebase=/var/log/samba \
151         --mandir=%{_mandir} \
152         --with-piddir=/var/run \
153         --with-privatedir=%{_sysconfdir}/samba \
154         --disable-cups \
155         --with-acl-support \
156         --with-ads \
157         --with-automount \
158         --enable-fhs \
159         --with-libsmbclient \
160         --without-smbwrapper \
161         --with-pam \
162         --with-quotas \
163         --with-shared-modules=%{shared_modules} \
164         --with-syslog \
165         --with-utmp \
166         --with-cluster-support \
167         --with-ctdb=/usr/include \
168         --without-ldb \
169         --without-dnsupdate \
170         --disable-external-libtalloc \
171         --disable-external-libtdb
172
173 make showlayout
174
175 ## check for gcc 3.4 or later
176 CC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
177 CC_MAJOR=`echo ${CC_VERSION} | cut -d. -f 1`
178 CC_MINOR=`echo ${CC_VERSION} | cut -d. -f 2`
179 if [ ${CC_MAJOR} -ge 3 ]; then
180         if [ ${CC_MAJOR} -gt 3 -o ${CC_MINOR} -ge 4 ]; then
181                 make pch
182         fi
183 fi
184
185
186 make -j %{numcpu} %{?_smp_mflags} \
187         everything modules
188
189 # check that desired suppor has been compiled into smbd:
190 export LD_LIBRARY_PATH=./bin
191
192 HAVE_VARS="HAVE_POSIX_ACLS HAVE_LDAP HAVE_KRB5 CLUSTER_SUPPORT"
193 %if %{with_vfs_gpfs}
194         HAVE_VARS="${HAVE_VARS} HAVE_GPFS"
195 %endif
196 for test in ${HAVE_VARS}
197 do
198         if ! $(./bin/smbd -b | grep -q $test ) ; then
199                 echo "ERROR: '$test' is not in smbd. Build stopped."
200                 exit 1;
201         fi
202 done
203
204 # try and build the manpages
205 cd ..
206 ./release-scripts/build-manpages-nogit
207
208 # Remove some permission bits to avoid to many dependencies
209 find examples docs -type f | xargs -r chmod -x
210
211 %install
212 # Clean up in case there is trash left from a previous build
213 rm -rf $RPM_BUILD_ROOT
214
215 # Create the target build directory hierarchy
216 mkdir -p $RPM_BUILD_ROOT%{_includedir}
217 mkdir -p $RPM_BUILD_ROOT%{_initrddir}
218 mkdir -p $RPM_BUILD_ROOT{%{_libarchdir},%{_includedir}}
219 mkdir -p $RPM_BUILD_ROOT%{_libarchdir}/samba/{auth,charset,idmap,vfs,pdb}
220 mkdir -p $RPM_BUILD_ROOT/%{_libarch}/security
221 mkdir -p $RPM_BUILD_ROOT/lib/security
222 mkdir -p $RPM_BUILD_ROOT%{_mandir}
223 mkdir -p $RPM_BUILD_ROOT%{_prefix}/{bin,sbin}
224 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib
225 mkdir -p $RPM_BUILD_ROOT/sbin
226 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{pam.d,samba}
227 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{pam.d}
228 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
229 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{samba,sysconfig}
230 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d
231 mkdir -p $RPM_BUILD_ROOT/var/lib/samba/winbindd_privileged
232 mkdir -p $RPM_BUILD_ROOT/var/{log,run/winbindd,spool}/samba
233 mkdir -p $RPM_BUILD_ROOT/%{_libarchdir}/krb5/plugins/libkrb5
234
235 cd source3
236 make DESTDIR=$RPM_BUILD_ROOT \
237         install
238
239 make DESTDIR=$RPM_BUILD_ROOT \
240         install-dbwrap_tool install-dbwrap_torture
241 cd ..
242
243 # NSS winbind support
244 install -m 755 nsswitch/libnss_winbind.so $RPM_BUILD_ROOT/%{_libarch}/libnss_winbind.so.2
245 ( cd $RPM_BUILD_ROOT/%{_libarch};
246   ln -sf libnss_winbind.so.2  libnss_winbind.so )
247 #
248 # do not install libnss_wins.so in order to reduce dependencies
249 # (we do not need it for the samba-ctdb scenario)
250 #
251 #install -m 755 nsswitch/libnss_wins.so $RPM_BUILD_ROOT/%{_libarch}/libnss_wins.so
252 # ( cd $RPM_BUILD_ROOT/%{_libarch}; ln -sf libnss_wins.so  libnss_wins.so.2 )
253
254 cp -p source3/bin/winbind_krb5_locator.so ${RPM_BUILD_ROOT}/%{_libarchdir}/krb5/plugins/libkrb5
255
256
257 ## cleanup
258 /bin/rm -rf $RPM_BUILD_ROOT/usr/lib*/samba/security
259
260 # remove installed but unpackaged files:
261 /bin/rm -f $RPM_BUILD_ROOT/usr/lib*/libtalloc.so
262 /bin/rm -f $RPM_BUILD_ROOT/usr/lib*/libtdb.so
263 /bin/rm -f $RPM_BUILD_ROOT/usr/lib*/samba/perfcount/pc_test.so
264
265
266 # Install the miscellany
267 echo 127.0.0.1 localhost > $RPM_BUILD_ROOT%{_sysconfdir}/samba/lmhosts
268
269 install -m644 setup/samba.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/samba
270 install -m755 setup/smb.init $RPM_BUILD_ROOT%{initdir}/smb
271 install -m755 setup/winbind.init $RPM_BUILD_ROOT%{initdir}/winbind
272 install -m644 setup/samba.pamd $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/samba
273 install -m755 packaging/printing/smbprint $RPM_BUILD_ROOT%{_bindir}
274 install -m644 setup/smbusers $RPM_BUILD_ROOT%{_sysconfdir}/samba/smbusers
275 install -m644 setup/smb.conf $RPM_BUILD_ROOT%{_sysconfdir}/samba/smb.conf
276 install -m755 source3/script/mksmbpasswd.sh $RPM_BUILD_ROOT%{_bindir}
277
278 ln -s ../..%{initdir}/smb  $RPM_BUILD_ROOT%{_sbindir}/samba
279 ln -s ../..%{initdir}/winbind  $RPM_BUILD_ROOT%{_sbindir}/winbind
280
281 # Remove "*.old" files
282 find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \;
283
284
285 ##
286 ## Clean out man pages for tools not installed here
287 ##
288 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/log2pcap.1*
289 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/smbsh.1*
290 rm -f $RPM_BUILD_ROOT%{_mandir}/man5/vfstest.1*
291 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/samba-tool.8*
292 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/samba.8*
293
294
295 %clean
296 rm -rf $RPM_BUILD_ROOT
297
298 %post
299 ## deal with an upgrade from a broken 3.0.21b RPM
300 if [ "$1" -eq "2" ]; then
301         if [ -d /var/cache/samba ]; then
302                 for file in `ls /var/cache/samba/*tdb`; do
303                         /bin/cp -up $file /var/lib/samba/`basename $file`
304                 done
305                 mkdir -p /var/lib/samba/eventlog
306                 for file in `ls /var/cache/samba/eventlog/*tdb`; do
307                         /bin/cp -up $file /var/lib/samba/eventlog/`basename $file`
308                 done
309                 /bin/mv /var/cache/samba /var/cache/samba.moved
310         fi
311 fi
312
313 if [ "$1" -ge "1" ]; then
314         /sbin/service smb condrestart >/dev/null 2>&1 || :
315 fi
316
317 %preun
318 if [ $1 = 0 ] ; then
319     /sbin/service smb stop >/dev/null 2>&1 || :
320     /sbin/chkconfig --del smb
321     # rm -rf /var/log/samba/* /var/lib/samba/*
322 fi
323 exit 0
324
325 #%postun
326
327 %post common
328 /sbin/ldconfig
329
330 if [ "$1" -ge "1" ]; then
331         /sbin/service winbind condrestart >/dev/null 2>&1 || :
332 fi
333
334 %preun common
335 if [ $1 = 0 ] ; then
336     /sbin/service winbind stop >/dev/null 2>&1 || :
337     /sbin/chkconfig --del winbind
338 fi
339 exit 0
340
341 %postun common 
342 /sbin/ldconfig
343
344 #######################################################################
345 ## Files section                                                     ##
346 #######################################################################
347
348 %files
349 %defattr(-,root,root)
350
351 %config(noreplace) %{_sysconfdir}/sysconfig/samba
352 %config(noreplace) %{_sysconfdir}/samba/smbusers
353 %attr(755,root,root) %config %{initdir}/smb
354 %config(noreplace) %{_sysconfdir}/pam.d/samba
355
356 %attr(0755,root,root) %dir /var/log/samba
357 %attr(0755,root,root) %dir /var/lib/samba
358 %attr(1777,root,root) %dir /var/spool/samba
359
360 %{_sbindir}/samba
361
362 %{_sbindir}/smbd
363 %{_sbindir}/nmbd
364
365 %{_bindir}/mksmbpasswd.sh
366 %{_bindir}/smbcontrol
367 %{_bindir}/smbstatus
368 %{_bindir}/tdbbackup
369 %{_bindir}/tdbtool
370 %{_bindir}/tdbdump
371 %{_bindir}/tdbrestore
372 %{_bindir}/eventlogadm
373
374 %{_libarchdir}/samba/auth/script.so
375 %{_libarchdir}/samba/vfs/acl_tdb.so
376 %{_libarchdir}/samba/vfs/acl_xattr.so
377 %{_libarchdir}/samba/vfs/aio_fork.so
378 %{_libarchdir}/samba/vfs/audit.so
379 %{_libarchdir}/samba/vfs/cap.so
380 %{_libarchdir}/samba/vfs/catia.so
381 %{_libarchdir}/samba/vfs/crossrename.so
382 %{_libarchdir}/samba/vfs/default_quota.so
383 %{_libarchdir}/samba/vfs/dirsort.so
384 %{_libarchdir}/samba/vfs/expand_msdfs.so
385 %{_libarchdir}/samba/vfs/extd_audit.so
386 %{_libarchdir}/samba/vfs/fake_acls.so
387 %{_libarchdir}/samba/vfs/fake_perms.so
388 %{_libarchdir}/samba/vfs/fileid.so
389 %{_libarchdir}/samba/vfs/full_audit.so
390 %if %{with_vfs_gpfs}
391 %{_libarchdir}/samba/vfs/gpfs.so
392 %endif
393 %{_libarchdir}/samba/vfs/linux_xfs_sgid.so
394 %{_libarchdir}/samba/vfs/netatalk.so
395 %{_libarchdir}/samba/vfs/preopen.so
396 %{_libarchdir}/samba/vfs/readahead.so
397 %{_libarchdir}/samba/vfs/readonly.so
398 %{_libarchdir}/samba/vfs/recycle.so
399 %{_libarchdir}/samba/vfs/shadow_copy.so
400 %{_libarchdir}/samba/vfs/shadow_copy2.so
401 %{_libarchdir}/samba/vfs/streams_depot.so
402 %{_libarchdir}/samba/vfs/streams_xattr.so
403 %{_libarchdir}/samba/vfs/syncops.so
404 %{_libarchdir}/samba/vfs/time_audit.so
405 %if %{with_vfs_tsmsm}
406 %{_libarchdir}/samba/vfs/tsmsm.so
407 %endif
408 %{_libarchdir}/samba/vfs/xattr_tdb.so
409 %{_libarchdir}/samba/vfs/aio_pthread.so
410 %{_libarchdir}/samba/vfs/media_harmony.so
411
412 %{_mandir}/man1/smbcontrol.1*
413 %{_mandir}/man1/smbstatus.1*
414 %{_mandir}/man1/vfstest.1*
415 %{_mandir}/man5/smbpasswd.5*
416 %{_mandir}/man5/pam_winbind.conf.5*
417 %{_mandir}/man7/samba.7*
418 %{_mandir}/man8/nmbd.8*
419 %{_mandir}/man8/pdbedit.8*
420 %{_mandir}/man8/smbd.8*
421 %{_mandir}/man8/eventlogadm.8*
422 %{_mandir}/man8/vfs_*.8*
423
424
425 ##########
426
427 %files doc
428 %defattr(-,root,root)
429 %doc README
430 %doc COPYING
431 %doc WHATSNEW.txt
432 %doc Roadmap
433 %doc docs-xml/archives/THANKS
434 %doc docs-xml/archives/history
435 %doc docs-xml/registry
436 %doc examples/autofs
437 %doc examples/LDAP
438 %doc examples/libsmbclient
439 %doc examples/misc
440 %doc examples/printer-accounting
441 %doc examples/printing
442
443 ##########
444
445 %files client
446 %defattr(-,root,root)
447
448 %{_bindir}/rpcclient
449 %{_bindir}/smbcacls
450 %{_bindir}/findsmb
451 %{_bindir}/nmblookup
452 %{_bindir}/smbget
453 %{_bindir}/smbclient
454 %{_bindir}/smbprint
455 %{_bindir}/smbspool
456 %{_bindir}/smbtar
457 %{_bindir}/smbtree
458 %{_bindir}/sharesec
459
460 %{_mandir}/man8/smbspool.8*
461 %{_mandir}/man1/smbget.1*
462 %{_mandir}/man5/smbgetrc.5*
463 %{_mandir}/man1/findsmb.1*
464 %{_mandir}/man1/nmblookup.1*
465 %{_mandir}/man1/rpcclient.1*
466 %{_mandir}/man1/smbcacls.1*
467 %{_mandir}/man1/smbclient.1*
468 %{_mandir}/man1/smbtar.1*
469 %{_mandir}/man1/smbtree.1*
470 %{_mandir}/man1/sharesec.1*
471
472 ##########
473
474
475 %files common
476 %defattr(-,root,root)
477 %dir %{_sysconfdir}/samba
478 %dir %{_libarchdir}/samba
479 %dir %{_libarchdir}/samba/charset
480 %config(noreplace) %{_sysconfdir}/samba/smb.conf
481 %config(noreplace) %{_sysconfdir}/samba/lmhosts
482 %attr(755,root,root) %config %{initdir}/winbind
483
484 %attr(755,root,root) /%{_libarch}/libnss_winbind.so
485 %attr(755,root,root) /%{_libarch}/libnss_winbind.so.2
486 %attr(755,root,root) /%{_libarch}/security/pam_winbind.so
487 /usr/share/locale/*/LC_MESSAGES/pam_winbind.mo
488 /usr/share/locale/*/LC_MESSAGES/net.mo
489
490 %{_libarchdir}/samba/idmap/ad.so
491 %{_libarchdir}/samba/idmap/rid.so
492 %{_libarchdir}/samba/idmap/tdb2.so
493 %{_libarchdir}/samba/idmap/autorid.so
494 %{_libarchdir}/samba/idmap/hash.so
495 %{_libarchdir}/samba/nss_info/hash.so
496 %{_libarchdir}/samba/nss_info/rfc2307.so
497 %{_libarchdir}/samba/nss_info/sfu.so
498 %{_libarchdir}/samba/nss_info/sfu20.so
499
500 %{_includedir}/libsmbclient.h
501 %{_libarchdir}/libsmbclient.*
502 %{_includedir}/smb_share_modes.h
503
504 %{_includedir}/netapi.h
505 %{_includedir}/wbclient.h
506 %{_libarchdir}/libnetapi.so
507 %{_libarchdir}/libnetapi.so.0
508 %{_libarchdir}/libwbclient.so
509 %{_libarchdir}/libwbclient.so.0
510
511 %{_libarchdir}/krb5/plugins/libkrb5/winbind_krb5_locator.so
512
513 %{_sbindir}/winbind
514
515 %{_sbindir}/winbindd
516 %{_bindir}/testparm
517 %{_bindir}/smbpasswd
518 %{_bindir}/profiles
519 %{_bindir}/net
520 %{_bindir}/wbinfo
521 %{_bindir}/ntlm_auth
522 %{_bindir}/pdbedit
523 %{_bindir}/smbcquotas
524 %{_bindir}/dbwrap_tool
525 %{_bindir}/dbwrap_torture
526
527 %{_mandir}/man1/ntlm_auth.1*
528 %{_mandir}/man1/profiles.1*
529 %{_mandir}/man1/smbcquotas.1*
530 %{_mandir}/man1/testparm.1*
531 %{_mandir}/man5/smb.conf.5*
532 %{_mandir}/man5/lmhosts.5*
533 %{_mandir}/man8/smbpasswd.8*
534 %{_mandir}/man1/wbinfo.1*
535 %{_mandir}/man8/winbindd.8*
536 %{_mandir}/man8/net.8*
537 %{_mandir}/man8/pam_winbind.8*
538 %{_mandir}/man7/libsmbclient.7*
539 %{_mandir}/man7/winbind_krb5_locator.7*
540 %{_mandir}/man8/idmap_*.8*
541
542
543
544 %changelog
545 * Fri Jan 16 2004 Gerald (Jerry) Carter <jerry@samba,org>
546 - Removed ChangeLog entries since they are kept in CVS
547
548
549