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