s3-samr: fix _samr_LookupNames return code.
[Samba.git] / packaging / RHEL / samba.spec.tmpl
blob49a01090e81058743c0a73ca9a542dc0aa5fe743
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)
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/
15 Source: samba-%{version}.tar.bz2
17 # Don't depend on Net::LDAP
18 Source998: filter-requires-samba.sh
19 Source999: setup.tar.bz2
21 Prereq: /sbin/chkconfig /bin/mktemp /usr/bin/killall
22 Prereq: fileutils sed /etc/init.d
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}
29 Prefix: /usr
30 BuildRoot: %{_tmppath}/%{name}-%{version}-root
31 BuildRequires: pam-devel, readline-devel, fileutils, libacl-devel, openldap-devel, krb5-devel, cups-devel
33 # Working around perl dependency problem from docs
34 %define __perl_requires %{SOURCE998}
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
43 %define _libarchdir /usr/%{_libarch}
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.
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}
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.
72 #######################################################################
73 %package common
74 Summary: Files used by both Samba servers and clients.
75 Group: Applications/System
76 Provides: samba-common = %{version}-%{release}
78 %description common
79 Samba-common provides files necessary for both the server and client
80 packages of Samba.
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}
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.
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
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".
109 #######################################################################
111 %prep
112 %setup -q
114 # setup the vendor files (init scripts, etc...)
115 %setup -T -D -a 999 -n samba-%{version} -q
117 %build
119 /bin/cp setup/filter-requires-samba.sh %{SOURCE998}
121 cd source
122 # RPM_OPT_FLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64"
124 ## check for ccache
125  ccache -h 2>&1 > /dev/null
126 if [ $? -eq 0 ]; then
127         CC="ccache gcc"
128 else
129         CC="gcc"
130 fi 
132 ## always run autogen.sh
133 ./autogen.sh
135 CC="$CC" CFLAGS="$RPM_OPT_FLAGS $EXTRA -D_GNU_SOURCE" ./configure \
136         --prefix=%{_prefix} \
137         --localstatedir=/var \
138         --with-configdir=%{_sysconfdir}/samba \
139         --with-libdir=%{_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 \
160         --with-syslog \
161         --with-utmp \
162         --with-dnsupdate
164 make showlayout
166 make CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE"  proto 
168 ## check for gcc 3.4 or later
169 CC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
170 CC_MAJOR=`echo ${CC_VERSION} | cut -d. -f 1`
171 CC_MINOR=`echo ${CC_VERSION} | cut -d. -f 2`
172 if [ ${CC_MAJOR} -ge 3 ]; then
173         if [ ${CC_MAJOR} -gt 3 -o ${CC_MINOR} -ge 4 ]; then
174                 make pch
175         fi
179 make CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" %{?_smp_mflags} \
180         all modules pam_smbpass
182 ## build the cifs fs mount helper
183 cd client
184 gcc  -o mount.cifs $RPM_OPT_FLAGS  -D_GNU_SOURCE -Wall -D_GNU_SOURCE -D_LARGEFILE64_SOURCE mount.cifs.c
185 gcc  -o umount.cifs $RPM_OPT_FLAGS  -D_GNU_SOURCE -Wall -D_GNU_SOURCE -D_LARGEFILE64_SOURCE umount.cifs.c
186 cd ..
188 # Remove some permission bits to avoid to many dependencies
189 cd ..
190 find examples docs -type f | xargs -r chmod -x
192 %install
193 # Clean up in case there is trash left from a previous build
194 rm -rf $RPM_BUILD_ROOT
196 # Create the target build directory hierarchy
197 mkdir -p $RPM_BUILD_ROOT%{_datadir}/swat/{help,include,using_samba/{figs,gifsa}}
198 mkdir -p $RPM_BUILD_ROOT%{_includedir}
199 mkdir -p $RPM_BUILD_ROOT%{_initrddir}
200 mkdir -p $RPM_BUILD_ROOT{%{_libarchdir},%{_includedir}}
201 mkdir -p $RPM_BUILD_ROOT%{_libarchdir}/samba/{auth,charset,idmap,vfs,pdb}
202 mkdir -p $RPM_BUILD_ROOT/%{_libarch}/security
203 mkdir -p $RPM_BUILD_ROOT%{_mandir}
204 mkdir -p $RPM_BUILD_ROOT%{_prefix}/{bin,sbin}
205 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib
206 mkdir -p $RPM_BUILD_ROOT/sbin
207 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{logrotate.d,pam.d,samba}
208 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{pam.d,logrotate.d}
209 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
210 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{samba,sysconfig}
211 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d
212 mkdir -p $RPM_BUILD_ROOT/var/lib/samba/winbindd_privileged
213 mkdir -p $RPM_BUILD_ROOT/var/{log,run/winbindd,spool}/samba
215 cd source
216 make DESTDIR=$RPM_BUILD_ROOT \
217         install
218 cd ..
220 # NSS winbind support
221 install -m 755 source/nsswitch/libnss_winbind.so $RPM_BUILD_ROOT/%{_libarch}/libnss_winbind.so.2
222 install -m 755 source/nsswitch/libnss_wins.so $RPM_BUILD_ROOT/%{_libarch}/libnss_wins.so.2
223 ( cd $RPM_BUILD_ROOT/%{_libarch};
224   ln -sf libnss_winbind.so.2  libnss_winbind.so;
225   ln -sf libnss_wins.so.2  libnss_wins.so )
227 # Put the shared (and possibly static) libraries into /usr/lib{,64}/ .
228 # Samba 3.2.2 installs them into /usr/lib{,64}/samba/ .
229 # This step will become unnecessary in 3.3.0.
231 for library in libsmbclient libsmbsharemodes libwbclient libtalloc libtdb
232 libnetapi
234         mv -f ${RPM_BUILD_ROOT}%{_libarchdir}/samba/${library}.* \
235                 ${RPM_BUILD_ROOT}%{_libarchdir}/
236 done
239 ## cleanup
240 /bin/rm -rf $RPM_BUILD_ROOT/usr/lib*/samba/security
242 # Install the miscellany
243 echo 127.0.0.1 localhost > $RPM_BUILD_ROOT%{_sysconfdir}/samba/lmhosts
245 install -m644 setup/samba.log $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/samba
246 install -m644 setup/swat $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d/swat
247 install -m644 setup/samba.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/samba
248 install -m755 setup/smb.init $RPM_BUILD_ROOT%{initdir}/smb
249 install -m755 setup/winbind.init $RPM_BUILD_ROOT%{initdir}/winbind
250 install -m644 setup/samba.pamd $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/samba
251 install -m755 setup/smbprint $RPM_BUILD_ROOT%{_bindir}
252 install -m644 setup/smbusers $RPM_BUILD_ROOT%{_sysconfdir}/samba/smbusers
253 install -m644 setup/smb.conf $RPM_BUILD_ROOT%{_sysconfdir}/samba/smb.conf
254 install -m755 source/client/mount.cifs $RPM_BUILD_ROOT/sbin/mount.cifs
255 install -m755 source/client/umount.cifs $RPM_BUILD_ROOT/sbin/umount.cifs
256 install -m755 source/script/mksmbpasswd.sh $RPM_BUILD_ROOT%{_bindir}
258 /bin/rm $RPM_BUILD_ROOT%{_sbindir}/*mount.cifs
260 ln -s ../..%{initdir}/smb  $RPM_BUILD_ROOT%{_sbindir}/samba
261 ln -s ../..%{initdir}/winbind  $RPM_BUILD_ROOT%{_sbindir}/winbind
263 # Remove "*.old" files
264 find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \;
266 ## don't duplicate the docs.  These are installed by/with SWAT
267 rm -rf docs/htmldocs
268 rm -rf docs/manpages
269 ( cd docs; ln -s %{_prefix}/share/swat/help htmldocs )
272 ## Clean out man pages for tools not installed here
274 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/log2pcap.1*
275 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/smbsh.1*
276 rm -f $RPM_BUILD_ROOT%{_mandir}/man5/vfstest.1*
279 %clean
280 rm -rf $RPM_BUILD_ROOT
282 %post
283 ## deal with an upgrade from a broken 3.0.21b RPM
284 if [ "$1" -eq "2" ]; then
285         if [ -d /var/cache/samba ]; then
286                 for file in `ls /var/cache/samba/*tdb`; do
287                         /bin/cp -up $file /var/lib/samba/`basename $file`
288                 done
289                 mkdir -p /var/lib/samba/eventlog
290                 for file in `ls /var/cache/samba/eventlog/*tdb`; do
291                         /bin/cp -up $file /var/lib/samba/eventlog/`basename $file`
292                 done
293                 /bin/mv /var/cache/samba /var/cache/samba.moved
294         fi
297 %preun
298 if [ $1 = 0 ] ; then
299     /sbin/chkconfig --del smb
300     /sbin/chkconfig --del winbind
301     # rm -rf /var/log/samba/* /var/lib/samba/*
302     /sbin/service smb stop >/dev/null 2>&1
304 exit 0
306 %postun
307 if [ "$1" -ge "1" ]; then
308         %{initdir}/smb restart >/dev/null 2>&1
309 fi      
312 %post swat
313 # Add swat entry to /etc/services if not already there.
314 if [ ! "`grep ^\s**swat /etc/services`" ]; then
315         echo 'swat        901/tcp     # Add swat service used via inetd' >> /etc/services
318 %post common
319 /sbin/ldconfig
321 %postun common 
322 /sbin/ldconfig
324 #######################################################################
325 ## Files section                                                     ##
326 #######################################################################
328 %files
329 %defattr(-,root,root)
331 %config(noreplace) %{_sysconfdir}/sysconfig/samba
332 %config(noreplace) %{_sysconfdir}/samba/smbusers
333 %attr(755,root,root) %config %{initdir}/smb
334 %attr(755,root,root) %config %{initdir}/winbind
335 %config(noreplace) %{_sysconfdir}/logrotate.d/samba
336 %config(noreplace) %{_sysconfdir}/pam.d/samba
338 %attr(0755,root,root) %dir /var/log/samba
339 %attr(0755,root,root) %dir /var/lib/samba
340 %attr(1777,root,root) %dir /var/spool/samba
342 %{_sbindir}/samba
343 %{_sbindir}/winbind
345 %{_sbindir}/smbd
346 %{_sbindir}/nmbd
347 %{_sbindir}/winbindd
349 %{_bindir}/mksmbpasswd.sh
350 %{_bindir}/smbcontrol
351 %{_bindir}/smbstatus
352 %{_bindir}/tdbbackup
353 %{_bindir}/tdbtool
354 %{_bindir}/tdbdump
355 %{_bindir}/wbinfo
356 %{_bindir}/ntlm_auth
357 %{_bindir}/pdbedit
358 %{_bindir}/eventlogadm
360 %{_libarchdir}/samba/idmap/*.so
361 %{_libarchdir}/samba/nss_info/*.so
362 %{_libarchdir}/samba/vfs/*.so
363 %{_libarchdir}/samba/auth/*.so
365 %{_mandir}/man1/smbcontrol.1*
366 %{_mandir}/man1/smbstatus.1*
367 %{_mandir}/man1/vfstest.1*
368 %{_mandir}/man5/smbpasswd.5*
369 %{_mandir}/man7/samba.7*
370 %{_mandir}/man8/nmbd.8*
371 %{_mandir}/man8/pdbedit.8*
372 %{_mandir}/man8/smbd.8*
373 %{_mandir}/man8/tdbbackup.8*
374 %{_mandir}/man8/tdbdump.8*
375 %{_mandir}/man8/tdbtool.8*
376 %{_mandir}/man8/eventlogadm.8*
377 %{_mandir}/man8/winbindd.8*
378 %{_mandir}/man1/ntlm_auth.1*
379 %{_mandir}/man1/wbinfo.1*
380 %{_mandir}/man8/vfs_*.8*
381 %{_mandir}/man8/idmap_*.8*
384 ##########
386 %files doc
387 %defattr(-,root,root)
388 %doc README COPYING Manifest 
389 %doc WHATSNEW.txt Roadmap
390 %doc docs
391 %doc examples/autofs examples/LDAP examples/libsmbclient examples/misc examples/printer-accounting
392 %doc examples/printing
393 %doc %{_datadir}/swat/help
394 %doc %{_datadir}/swat/using_samba
396 ##########
398 %files swat
399 %defattr(-,root,root)
400 %config(noreplace) %{_sysconfdir}/xinetd.d/swat
401 %dir %{_datadir}/swat
402 %{_datadir}/swat/include
403 %{_datadir}/swat/images
404 %{_datadir}/swat/lang
405 %{_sbindir}/swat
406 %{_mandir}/man8/swat.8*
408 ##########
410 %files client
411 %defattr(-,root,root)
412 /sbin/mount.cifs
413 /sbin/umount.cifs
415 %{_bindir}/rpcclient
416 %{_bindir}/smbcacls
417 %{_bindir}/findsmb
418 %{_bindir}/smbcquotas
419 %{_bindir}/nmblookup
420 %{_bindir}/smbget
421 %{_bindir}/smbclient
422 %{_bindir}/smbprint
423 %{_bindir}/smbspool
424 %{_bindir}/smbtar
425 %{_bindir}/net
426 %{_bindir}/smbtree
428 %{_mandir}/man8/mount.cifs.8.*
429 %{_mandir}/man8/umount.cifs.8.*
430 %{_mandir}/man8/smbspool.8*
431 %{_mandir}/man1/smbget.1*
432 %{_mandir}/man5/smbgetrc.5*
433 %{_mandir}/man1/findsmb.1*
434 %{_mandir}/man1/nmblookup.1*
435 %{_mandir}/man1/rpcclient.1*
436 %{_mandir}/man1/smbcacls.1*
437 %{_mandir}/man1/smbclient.1*
438 %{_mandir}/man1/smbtar.1*
439 %{_mandir}/man1/smbtree.1*
440 %{_mandir}/man8/net.8*
441 %{_mandir}/man1/smbcquotas.1*
443 ##########
445 %files common
446 %defattr(-,root,root)
447 %dir %{_sysconfdir}/samba
448 %dir %{_libarchdir}/samba
449 %dir %{_libarchdir}/samba/charset
450 %config(noreplace) %{_sysconfdir}/samba/smb.conf
451 %config(noreplace) %{_sysconfdir}/samba/lmhosts
453 %attr(755,root,root) /%{_libarch}/libnss_wins.so*
454 %attr(755,root,root) /%{_libarch}/libnss_winbind.so*
455 %attr(755,root,root) /%{_libarch}/security/pam_winbind.so
456 %attr(755,root,root) /%{_libarch}/security/pam_smbpass.so
458 %{_includedir}/libsmbclient.h
459 %{_libarchdir}/libsmbclient.*
460 %{_includedir}/smb_share_modes.h
461 %{_libarchdir}/libsmbsharemodes.*
463 %{_libarchdir}/samba/*.dat
464 %{_libarchdir}/samba/*.msg
465 %{_libarchdir}/samba/charset/*.so
467 %{_includedir}/netapi.h
468 %{_includedir}/wbclient.h
469 %{_includedir}/talloc.h
470 %{_includedir}/tdb.h
471 %{_libarchdir}/libnetapi.so*
472 %{_libarchdir}/libtalloc.so*
473 %{_libarchdir}/libtdb.so*
474 %{_libarchdir}/libwbclient.so*
476 %{_bindir}/testparm
477 %{_bindir}/smbpasswd
478 %{_bindir}/profiles
480 %{_bindir}/ldbadd
481 %{_bindir}/ldbdel
482 %{_bindir}/ldbedit
483 %{_bindir}/ldbmodify
484 %{_bindir}/ldbsearch
486 %{_mandir}/man1/profiles.1*
487 %{_mandir}/man1/testparm.1*
488 %{_mandir}/man5/smb.conf.5*
489 %{_mandir}/man5/lmhosts.5*
490 %{_mandir}/man8/smbpasswd.8*
491 %{_mandir}/man7/libsmbclient.7*
492 %{_mandir}/man7/pam_winbind.7*
494 %{_mandir}/man1/ldbadd.1*
495 %{_mandir}/man1/ldbdel.1*
496 %{_mandir}/man1/ldbedit.1*
497 %{_mandir}/man1/ldbmodify.1*
498 %{_mandir}/man1/ldbsearch.1*
500 %changelog
501 * Fri Jan 16 2004 Gerald (Jerry) Carter <jerry@samba,org>
502 - Removed ChangeLog entries since they are kept in CVS