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