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: The Samba SMB server.
5Name: samba
6Version: 3.0.13
7Release: 1
8License: GNU GPL Version 2
9Group: System Environment/Daemons
10URL: http://www.samba.org/
11
12Source: ftp://www.samba.org/pub/samba/%{name}-%{version}.tar.bz2
13
14# Red Hat specific replacement-files
15Source1:  samba.log
16Source2:  samba.xinetd
17Source4:  samba.sysconfig
18Source5:  smb.init
19Source6:  winbind.init
20Source7:  samba.pamd
21Source8:  smbprint
22Source9:  smbusers
23Source10: smb.conf
24
25# Don't depend on Net::LDAP
26Source999: filter-requires-samba.sh
27
28# generic patches
29
30Requires: pam >= 0.64 %{auth} samba-common = %{version} 
31Requires: logrotate >= 3.4 initscripts >= 5.54-1 
32BuildRoot: %{_tmppath}/%{name}-%{version}-root
33Prereq: /sbin/chkconfig /bin/mktemp /usr/bin/killall
34Prereq: fileutils sed /etc/init.d 
35BuildRequires: pam-devel, readline-devel, ncurses-devel, fileutils, libacl-devel, openldap-devel, krb5-devel, cups-devel
36
37
38# Working around perl dependency problem from docs
39%define __perl_requires %{SOURCE999}
40
41%description
42Samba is the protocol by which a lot of PC-related machines share
43files, printers, and other information (such as lists of available
44files and printers). The Windows NT, OS/2, and Linux operating systems
45support this natively, and add-on packages can enable the same thing
46for DOS, Windows, VMS, UNIX of all kinds, MVS, and more. This package
47provides an SMB server that can be used to provide network services to
48SMB (sometimes called "Lan Manager") clients. Samba uses NetBIOS over
49TCP/IP (NetBT) protocols and does NOT need the NetBEUI (Microsoft Raw
50NetBIOS frame) protocol.
51
52%package client
53Summary: Samba (SMB) client programs.
54Group: Applications/System
55Requires: samba-common = %{version}
56Obsoletes: smbfs
57
58%description client
59The samba-client package provides some SMB clients to compliment the
60built-in SMB filesystem in Linux. These clients allow access of SMB
61shares and printing to SMB printers.
62
63%package common
64Summary: Files used by both Samba servers and clients.
65Group: Applications/System
66
67%description common
68Samba-common provides files necessary for both the server and client
69packages of Samba.
70
71%package swat
72Summary: The Samba SMB server configuration program.
73Group: Applications/System
74Requires: samba = %{version} xinetd
75
76%description swat
77The samba-swat package includes the new SWAT (Samba Web Administration
78Tool), for remotely managing Samba's smb.conf file using your favorite
79Web browser.
80
81%prep
82%setup -q
83
84# copy Red Hat specific scripts
85cp %{SOURCE5} packaging/Fedora/
86cp %{SOURCE6} packaging/Fedora/
87cp %{SOURCE7} packaging/Fedora/
88cp %{SOURCE8} packaging/Fedora/winbind.init
89
90%build
91
92cd source
93%ifarch i386 sparc
94RPM_OPT_FLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64"
95%endif
96%ifarch ia64
97libtoolize --copy --force     # get it to recognize IA-64
98autoheader                                               
99autoconf
100EXTRA="-D_LARGEFILE64_SOURCE"
101%endif
102
103## run autogen if missing the configure script
104if [ ! -f "configure" ]; then
105        ./autogen.sh
106fi
107
108CFLAGS="$RPM_OPT_FLAGS" ./configure \
109	--prefix=%{_prefix} \
110	--localstatedir=/var \
111	--sysconfdir=/etc \
112	--with-privatedir=%{_sysconfdir}/samba \
113	--with-fhs \
114	--with-quotas \
115	--with-smbmount \
116	--with-pam \
117	--with-pam_smbpass \
118	--with-syslog \
119	--with-utmp \
120	--with-sambabook=%{_datadir}/swat/using_samba \
121	--with-swatdir=%{_datadir}/swat \
122	--with-libsmbclient \
123	--with-acl-support \
124	--with-shared-modules=idmap_rid \
125	--enable-cups=yes
126make showlayout
127make proto
128make %{?_smp_mflags} all modules nsswitch/libnss_wins.so debug2html 
129
130
131%install
132rm -rf $RPM_BUILD_ROOT
133
134mkdir -p $RPM_BUILD_ROOT/sbin
135mkdir -p $RPM_BUILD_ROOT/usr/{sbin,bin}
136mkdir -p $RPM_BUILD_ROOT/%{initdir}
137mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/{pam.d,logrotate.d}
138mkdir -p $RPM_BUILD_ROOT/var/{log,spool,lib}/samba
139mkdir -p $RPM_BUILD_ROOT/%{_datadir}/swat/using_samba
140mkdir -p $RPM_BUILD_ROOT/%{_datadir}/samba/codepages 
141
142cd source
143
144make DESTDIR=$RPM_BUILD_ROOT \
145	install
146
147cd ..
148
149# Install other stuff
150install -m644 %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/samba/smb.conf
151install -m644 %{SOURCE9} $RPM_BUILD_ROOT/etc/samba/smbusers
152install -m755 %{SOURCE8} $RPM_BUILD_ROOT%{_bindir}
153install -m644 %{SOURCE7} $RPM_BUILD_ROOT/etc/pam.d/samba
154install -m644 %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/samba
155install -m755 source/script/mksmbpasswd.sh $RPM_BUILD_ROOT%{_bindir}
156
157install -m755 %{SOURCE5} $RPM_BUILD_ROOT%{initdir}/smb
158install -m755 %{SOURCE6} $RPM_BUILD_ROOT%{initdir}/winbind
159ln -s ../..%{initdir}/smb  $RPM_BUILD_ROOT%{_sbindir}/samba
160ln -s ../..%{initdir}/winbind  $RPM_BUILD_ROOT%{_sbindir}/winbind
161
162ln -s ../usr/bin/smbmount $RPM_BUILD_ROOT/sbin/mount.smb
163## Samba's Makefile is breaking this currently.  Remove it and set our own
164/bin/rm -f $RPM_BUILD_ROOT/sbin/mount.smbfs
165ln -s ../usr/bin/smbmount $RPM_BUILD_ROOT/sbin/mount.smbfs
166
167echo 127.0.0.1 localhost > $RPM_BUILD_ROOT%{_sysconfdir}/samba/lmhosts
168
169
170# pam_smbpass
171mkdir -p $RPM_BUILD_ROOT/%{_lib}/security
172mv source/bin/pam_smbpass.so $RPM_BUILD_ROOT/%{_lib}/security/pam_smbpass.so
173
174# winbind
175mkdir -p $RPM_BUILD_ROOT/%{_lib}/security
176install -m 755 source/nsswitch/pam_winbind.so $RPM_BUILD_ROOT/%{_lib}/security/pam_winbind.so
177install -m 755 source/nsswitch/libnss_winbind.so $RPM_BUILD_ROOT/%{_lib}/libnss_winbind.so
178install -m 755 source/nsswitch/libnss_wins.so $RPM_BUILD_ROOT/%{_lib}/libnss_wins.so
179( cd $RPM_BUILD_ROOT/%{_lib}; 
180  ln -sf libnss_winbind.so  libnss_winbind.so.2;
181  ln -sf libnss_wins.so  libnss_wins.so.2 )
182
183# libsmbclient
184
185# make install puts libsmbclient.so in the wrong place on x86_64
186rm -f $RPM_BUILD_ROOT/usr/lib || true
187mkdir -p $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_includedir}
188install -m 755 source/bin/libsmbclient.so $RPM_BUILD_ROOT%{_libdir}/libsmbclient.so
189install -m 755 source/bin/libsmbclient.a $RPM_BUILD_ROOT%{_libdir}/libsmbclient.a
190install -m 644 source/include/libsmbclient.h $RPM_BUILD_ROOT%{_includedir}
191rm -f $RPM_BUILD_ROOT%{_libdir}/samba/libsmbclient.*
192
193mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d
194install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d/swat
195
196mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
197install -m644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/samba
198
199##
200## Clean out man pages for tools not installed here
201##
202rm -f $RPM_BUILD_ROOT/%{_mandir}/man1/editreg.1*
203rm -f $RPM_BUILD_ROOT%{_mandir}/man1/log2pcap.1*
204rm -f $RPM_BUILD_ROOT%{_mandir}/man1/smbsh.1*
205rm -f $RPM_BUILD_ROOT%{_mandir}/man1/smbget.1*
206rm -f $RPM_BUILD_ROOT%{_mandir}/man5/smbgetrc.5*
207rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/mount.cifs.8*
208
209%clean
210rm -rf $RPM_BUILD_ROOT
211
212%post
213/sbin/chkconfig --add smb
214
215%preun
216if [ $1 = 0 ] ; then
217    /sbin/chkconfig --del smb
218    rm -rf /var/log/samba/* /var/cache/samba/*
219    /sbin/service smb stop >/dev/null 2>&1
220fi
221exit 0
222
223%postun
224if [ "$1" -ge "1" ]; then
225	%{initdir}/smb condrestart >/dev/null 2>&1
226fi	
227
228
229%post swat
230# Add swat entry to /etc/services if not already there.
231if [ ! "`grep ^\s**swat /etc/services`" ]; then
232        echo 'swat        901/tcp     # Add swat service used via inetd' >> /etc/services
233fi
234
235%post common
236/sbin/chkconfig --add winbind
237/sbin/ldconfig
238
239%preun common
240if [ $1 = 0 ] ; then
241    /sbin/chkconfig --del winbind
242    /sbin/service winbind stop >/dev/null 2>&1
243fi
244exit 0
245
246%postun common -p /sbin/ldconfig
247
248%triggerpostun -- samba < 1.9.18p7
249if [ $1 != 0 ]; then
250    /sbin/chkconfig --add smb
251fi
252
253%triggerpostun -- samba < 2.0.5a-3
254if [ $1 != 0 ]; then
255    [ ! -d /var/lock/samba ] && mkdir -m 0755 /var/lock/samba
256    [ ! -d /var/spool/samba ] && mkdir -m 1777 /var/spool/samba
257    chmod 644 /etc/services
258    [ -f /etc/inetd.conf ] && chmod 644 /etc/inetd.conf
259fi
260
261%files
262%defattr(-,root,root)
263%doc README COPYING Manifest 
264%doc WHATSNEW.txt Roadmap
265%doc docs
266%doc examples/autofs examples/LDAP examples/libsmbclient examples/misc examples/printer-accounting
267%doc examples/printing
268
269%attr(755,root,root) /%{_lib}/security/pam_smbpass.so
270%{_sbindir}/smbd
271%{_sbindir}/nmbd
272# %{_bindir}/make_unicodemap
273%{_bindir}/mksmbpasswd.sh
274%{_bindir}/smbcontrol
275%{_bindir}/smbstatus
276# %{_bindir}/smbadduser
277%{_bindir}/tdbbackup
278%{_bindir}/tdbtool
279%config(noreplace) %{_sysconfdir}/sysconfig/samba
280%config(noreplace) %{_sysconfdir}/samba/smbusers
281%attr(755,root,root) %config %{initdir}/smb
282%config(noreplace) %{_sysconfdir}/logrotate.d/samba
283%config(noreplace) %{_sysconfdir}/pam.d/samba
284# %{_mandir}/man1/make_unicodemap.1*
285%{_mandir}/man1/smbcontrol.1*
286%{_mandir}/man1/smbstatus.1*
287%{_mandir}/man5/smbpasswd.5*
288%{_mandir}/man7/samba.7*
289%{_mandir}/man8/nmbd.8*
290%{_mandir}/man8/pdbedit.8*
291%{_mandir}/man8/smbd.8*
292%{_mandir}/man8/pam_winbind.8*
293%{_mandir}/man8/tdbbackup.8*
294#%{_mandir}/ja/man1/smbstatus.1*
295#%{_mandir}/ja/man5/smbpasswd.5*
296#%{_mandir}/ja/man7/samba.7*
297#%{_mandir}/ja/man8/smbd.8*
298#%{_mandir}/ja/man8/nmbd.8*
299%{_libdir}/samba/vfs
300
301%attr(0700,root,root) %dir /var/log/samba
302%attr(1777,root,root) %dir /var/spool/samba
303
304%files swat
305%defattr(-,root,root)
306%config(noreplace) %{_sysconfdir}/xinetd.d/swat
307%{_datadir}/swat
308%{_sbindir}/swat
309%{_mandir}/man8/swat.8*
310#%{_mandir}/ja/man8/swat.8*
311%attr(755,root,root) %{_libdir}/samba/*.msg
312
313%files client
314%defattr(-,root,root)
315/sbin/mount.smb
316/sbin/mount.smbfs
317%{_libdir}/samba/lowcase.dat
318%{_libdir}/samba/upcase.dat
319%{_libdir}/samba/valid.dat
320%{_bindir}/rpcclient
321%{_bindir}/smbcacls
322%{_bindir}/smbmount
323%{_bindir}/smbmnt
324%{_bindir}/smbumount
325%{_bindir}/findsmb
326%{_bindir}/tdbdump
327%{_mandir}/man8/tdbdump.8*
328%{_mandir}/man8/smbmnt.8*
329%{_mandir}/man8/smbmount.8*
330%{_mandir}/man8/smbumount.8*
331%{_mandir}/man8/smbspool.8*
332%{_bindir}/nmblookup
333%{_bindir}/smbclient
334%{_bindir}/smbprint
335%{_bindir}/smbspool
336%{_bindir}/smbtar
337%{_bindir}/net
338%{_bindir}/smbtree
339%{_mandir}/man1/findsmb.1*
340%{_mandir}/man1/nmblookup.1*
341%{_mandir}/man1/rpcclient.1*
342%{_mandir}/man1/smbcacls.1*
343%{_mandir}/man1/smbclient.1*
344%{_mandir}/man1/smbtar.1*
345%{_mandir}/man1/smbtree.1*
346%{_mandir}/man8/net.8*
347#%{_mandir}/ja/man1/smbtar.1*
348#%{_mandir}/ja/man1/smbclient.1*
349#%{_mandir}/ja/man1/nmblookup.1*
350
351%files common
352%defattr(-,root,root)
353/%{_lib}/libnss_wins.so*
354/%{_lib}/libnss_winbind.so*
355/%{_lib}/security/pam_winbind.so
356%{_libdir}/libsmbclient.a
357%{_libdir}/libsmbclient.so
358%{_libdir}/samba/charset/CP*.so
359%{_libdir}/samba/idmap/idmap*.so
360%{_includedir}/libsmbclient.h
361%{_bindir}/testparm
362%{_bindir}/testprns
363%{_bindir}/smbpasswd
364# %{_bindir}/make_printerdef
365%{_bindir}/wbinfo
366# %{_bindir}/editreg
367%{_bindir}/ntlm_auth
368%{_bindir}/pdbedit
369%{_bindir}/profiles
370%{_bindir}/smbcquotas
371#%{_bindir}/vfstest
372%{_sbindir}/winbindd
373%config(noreplace) %{_sysconfdir}/samba/smb.conf
374%config(noreplace) %{_sysconfdir}/samba/lmhosts
375%dir %{_datadir}/samba
376%dir %{_datadir}/samba/codepages
377%dir %{_sysconfdir}/samba
378%{initdir}/winbind
379# %{_datadir}/samba/codepages/*
380# %{_mandir}/man1/make_smbcodepage.1*
381%{_mandir}/man1/ntlm_auth.1*
382%{_mandir}/man1/profiles.1*
383%{_mandir}/man1/smbcquotas.1*
384%{_mandir}/man1/testparm.1*
385%{_mandir}/man1/testprns.1*
386%{_mandir}/man5/smb.conf.5*
387%{_mandir}/man5/lmhosts.5*
388%{_mandir}/man8/smbpasswd.8*
389%{_mandir}/man1/wbinfo.1*
390%{_mandir}/man8/winbindd.8*
391%{_mandir}/man1/vfstest.1*
392
393# #%lang(ja) %{_mandir}/ja/man1/make_smbcodepage.1*
394#%lang(ja) %{_mandir}/ja/man1/testparm.1*
395#%lang(ja) %{_mandir}/ja/man1/testprns.1*
396#%lang(ja) %{_mandir}/ja/man5/smb.conf.5*
397#%lang(ja) %{_mandir}/ja/man5/lmhosts.5*
398#%lang(ja) %{_mandir}/ja/man8/smbpasswd.8*
399
400%changelog
401* Fri Jan 16 2004 Gerald (Jerry) Carter <jerry@samba,org>
402- Removed ChangeLog entries since they are kept in CVS
403
404
405
406