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