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