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