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