27b8e277f40f2fbaeec41fd2fe27533e3c126c43
[ira/wip.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 # make install puts libmsrpc.so in the wrong place on x86_64
200 rm -f $RPM_BUILD_ROOT/usr/lib || true
201 mkdir -p $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_includedir}
202 install -m 755 source/bin/libmsrpc.so $RPM_BUILD_ROOT%{_libdir}/libmsrpc.so
203 install -m 755 source/bin/libmsrpc.a $RPM_BUILD_ROOT%{_libdir}/libmsrpc.a
204 install -m 644 source/include/libmsrpc.h $RPM_BUILD_ROOT%{_includedir}
205 rm -f $RPM_BUILD_ROOT%{_libdir}/samba/libmsrpc.*
206
207 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d
208 install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d/swat
209
210 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
211 install -m644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/samba
212
213 ##
214 ## Clean out man pages for tools not installed here
215 ##
216 rm -f $RPM_BUILD_ROOT/%{_mandir}/man1/editreg.1*
217 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/log2pcap.1*
218 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/smbsh.1*
219 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/smbget.1*
220 rm -f $RPM_BUILD_ROOT%{_mandir}/man5/smbgetrc.5*
221 rm -f $RPM_BUILD_ROOT/%{_mandir}/man1/testprns.1*
222
223 %clean
224 rm -rf $RPM_BUILD_ROOT
225
226 %post
227 /sbin/chkconfig --add smb
228
229 %preun
230 if [ $1 = 0 ] ; then
231     /sbin/chkconfig --del smb
232     rm -rf /var/log/samba/* /var/cache/samba/*
233     /sbin/service smb stop >/dev/null 2>&1
234 fi
235 exit 0
236
237 %postun
238 if [ "$1" -ge "1" ]; then
239         %{initdir}/smb condrestart >/dev/null 2>&1
240 fi      
241
242
243 %post swat
244 # Add swat entry to /etc/services if not already there.
245 if [ ! "`grep ^\s**swat /etc/services`" ]; then
246         echo 'swat        901/tcp     # Add swat service used via inetd' >> /etc/services
247 fi
248
249 %post common
250 /sbin/chkconfig --add winbind
251 /sbin/ldconfig
252
253 %preun common
254 if [ $1 = 0 ] ; then
255     /sbin/chkconfig --del winbind
256     /sbin/service winbind stop >/dev/null 2>&1
257 fi
258 exit 0
259
260 %postun common -p /sbin/ldconfig
261
262 %triggerpostun -- samba < 1.9.18p7
263 if [ $1 != 0 ]; then
264     /sbin/chkconfig --add smb
265 fi
266
267 %triggerpostun -- samba < 2.0.5a-3
268 if [ $1 != 0 ]; then
269     [ ! -d /var/lock/samba ] && mkdir -m 0755 /var/lock/samba
270     [ ! -d /var/spool/samba ] && mkdir -m 1777 /var/spool/samba
271     chmod 644 /etc/services
272     [ -f /etc/inetd.conf ] && chmod 644 /etc/inetd.conf
273 fi
274
275 %files
276 %defattr(-,root,root)
277 %doc README COPYING Manifest 
278 %doc WHATSNEW.txt Roadmap
279 %doc docs
280 %doc examples/autofs examples/LDAP examples/libsmbclient examples/misc examples/printer-accounting
281 %doc examples/printing
282
283 %attr(755,root,root) /%{_lib}/security/pam_smbpass.so
284 %{_sbindir}/samba
285 %{_sbindir}/winbind
286 %{_sbindir}/smbd
287 %{_sbindir}/nmbd
288 %{_bindir}/mksmbpasswd.sh
289 %{_bindir}/smbcontrol
290 %{_bindir}/smbstatus
291 %{_bindir}/tdbbackup
292 %{_bindir}/tdbtool
293 %config(noreplace) %{_sysconfdir}/sysconfig/samba
294 %config(noreplace) %{_sysconfdir}/samba/smbusers
295 %attr(755,root,root) %config %{initdir}/smb
296 %config(noreplace) %{_sysconfdir}/logrotate.d/samba
297 %config(noreplace) %{_sysconfdir}/pam.d/samba
298 %{_mandir}/man1/smbcontrol.1*
299 %{_mandir}/man1/smbstatus.1*
300 %{_mandir}/man5/smbpasswd.5*
301 %{_mandir}/man7/samba.7*
302 %{_mandir}/man8/nmbd.8*
303 %{_mandir}/man8/pdbedit.8*
304 %{_mandir}/man8/smbd.8*
305 %{_mandir}/man8/pam_winbind.8*
306 %{_mandir}/man8/tdbbackup.8*
307 %{_mandir}/man8/libsmbclient.8*
308
309 %{_libdir}/samba/vfs
310
311 %attr(0700,root,root) %dir /var/log/samba
312 %attr(1777,root,root) %dir /var/spool/samba
313
314 %files swat
315 %defattr(-,root,root)
316 %config(noreplace) %{_sysconfdir}/xinetd.d/swat
317 %{_datadir}/swat
318 %{_sbindir}/swat
319 %{_mandir}/man8/swat.8*
320 %attr(755,root,root) %{_libdir}/samba/*.msg
321
322 %files client
323 %defattr(-,root,root)
324 /sbin/mount.smb
325 /sbin/mount.smbfs
326 /sbin/mount.cifs
327 /sbin/umount.cifs
328 %{_libdir}/samba/lowcase.dat
329 %{_libdir}/samba/upcase.dat
330 %{_libdir}/samba/valid.dat
331 %{_bindir}/rpcclient
332 %{_bindir}/smbcacls
333 %{_bindir}/smbmount
334 %{_bindir}/smbmnt
335 %{_bindir}/smbumount
336 %{_bindir}/findsmb
337 %{_bindir}/tdbdump
338 %{_mandir}/man8/tdbdump.8*
339 %{_mandir}/man8/smbmnt.8*
340 %{_mandir}/man8/smbmount.8*
341 %{_mandir}/man8/smbumount.8*
342 %{_mandir}/man8/mount.cifs.8.*
343 %{_mandir}/man8/umount.cifs.8.*
344 %{_mandir}/man8/smbspool.8*
345 %{_bindir}/nmblookup
346 %{_bindir}/smbclient
347 %{_bindir}/smbprint
348 %{_bindir}/smbspool
349 %{_bindir}/smbtar
350 %{_bindir}/net
351 %{_bindir}/smbtree
352 %{_mandir}/man1/findsmb.1*
353 %{_mandir}/man1/nmblookup.1*
354 %{_mandir}/man1/rpcclient.1*
355 %{_mandir}/man1/smbcacls.1*
356 %{_mandir}/man1/smbclient.1*
357 %{_mandir}/man1/smbtar.1*
358 %{_mandir}/man1/smbtree.1*
359 %{_mandir}/man8/net.8*
360 #%{_mandir}/ja/man1/smbtar.1*
361 #%{_mandir}/ja/man1/smbclient.1*
362 #%{_mandir}/ja/man1/nmblookup.1*
363
364 %files common
365 %defattr(-,root,root)
366 /%{_lib}/libnss_wins.so*
367 /%{_lib}/libnss_winbind.so*
368 /%{_lib}/security/pam_winbind.so
369 %{_libdir}/libsmbclient.a
370 %{_libdir}/libsmbclient.so
371 %{_libdir}/samba/charset/CP*.so
372 %{_libdir}/samba/idmap/idmap*.so
373 %{_includedir}/libsmbclient.h
374 %{_bindir}/testparm
375 %{_bindir}/smbpasswd
376 # %{_bindir}/make_printerdef
377 %{_bindir}/wbinfo
378 # %{_bindir}/editreg
379 %{_bindir}/ntlm_auth
380 %{_bindir}/pdbedit
381 %{_bindir}/eventlogadm
382 %{_bindir}/profiles
383 %{_bindir}/smbcquotas
384 #%{_bindir}/vfstest
385 %{_sbindir}/winbindd
386 %config(noreplace) %{_sysconfdir}/samba/smb.conf
387 %config(noreplace) %{_sysconfdir}/samba/lmhosts
388 %dir %{_datadir}/samba
389 %dir %{_datadir}/samba/codepages
390 %dir %{_sysconfdir}/samba
391 %{initdir}/winbind
392 # %{_datadir}/samba/codepages/*
393 # %{_mandir}/man1/make_smbcodepage.1*
394 %{_mandir}/man1/ntlm_auth.1*
395 %{_mandir}/man1/profiles.1*
396 %{_mandir}/man1/smbcquotas.1*
397 %{_mandir}/man1/testparm.1*
398 %{_mandir}/man5/smb.conf.5*
399 %{_mandir}/man5/lmhosts.5*
400 %{_mandir}/man8/smbpasswd.8*
401 %{_mandir}/man1/wbinfo.1*
402 %{_mandir}/man8/winbindd.8*
403 %{_mandir}/man1/vfstest.1*
404
405 %changelog
406 * Fri Jan 16 2004 Gerald (Jerry) Carter <jerry@samba,org>
407 - Removed ChangeLog entries since they are kept in CVS
408
409
410