source: trunk/samba/packaging/RHEL/samba.spec @ 30

Last change on this file since 30 was 30, checked in by Paul Smedley, 14 years ago

Code updated to Samba 3.0.25rc2 level

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