This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.(This used to...
[kai/samba.git] / packaging / RedHat / samba2.spec.tmpl
1 Summary: Samba SMB client and server
2 Name: samba
3 Version: PVERSION
4 Release: PRELEASE
5 Copyright: GNU GPL version 2
6 Group: Networking
7 Source: http://download.samba.org/samba/ftp/samba-%{version}.tar.bz2
8 Packager: Gerald Carter [Samba-Team] <jerry@samba.org>
9 Requires: pam >= 0.72 kernel >= 2.2.1 glibc >= 2.1.2
10 Prereq: chkconfig fileutils
11 Provides: samba = %{version}
12 Obsoletes: samba-common, samba-client, samba-swat
13 BuildRoot: /var/tmp/samba
14 Prefix: /usr
15
16 %description
17 Users are advised to use Samba-2.2 as a Windows NT4
18 Samba provides an SMB/CIFS server which can be used to provide
19 network file and print services to SMB/CIFS clients, including 
20 various versions of MS Windows, OS/2, and other Linux machines. 
21 Samba also provides some SMB clients, which complement the 
22 built-in SMB filesystem in Linux. Samba uses NetBIOS over TCP/IP 
23 (NetBT) protocols and does NOT need NetBEUI (Microsoft Raw NetBIOS 
24 frame) protocol.
25
26 Please refer to the WHATSNEW.txt document for fixup information.
27
28 %changelog
29 * Thu Jun 6 2002 Gerald Carter <jerry@samba.org>
30   - add separate winbindd init script
31   - build and install libsmbclient
32
33 * Sun Jun 2 2002 Gerald Carter <jerry@samba.org>
34   - include audit and recycle VFS modules in /usr/lib/samba
35
36 * Mon May 6 2002 Gerald Carter <jerry@samba.org>
37   - moved findsmb to a standard component in samba's 
38     "make install".  Removed from specfile.
39  
40 * Sun Oct 14 2001 Andrew Bartlett <abartlet@samba.org>
41  - Set SBINDIR for codepage/manpage install, cope with 
42     broken Makefile
43
44 * Mon Aug 1 2001 Tim Potter <tpot@samba.org>
45  - Install winbind daemon, client programs, nss and pam libraries
46
47 * Sat Mar 31 2001 Andrew Bartlett <abartlet@pcug.org.au>
48  - Changed prefix/share/man for _mandir/share/man
49   - Changed this for a sed macro MANDIR_MACRO
50   - This allows us to build both RH7 (RPM4)
51      and older versions from same specfile.
52  - Made makerpms.sh use the rpm -ta command rather 
53     than attempting to devine the correct location to 
54     put the file.  Also removes some /tmp symlink games.
55   - Allows build on RPM4
56  - Increased PAM requirements to allow us to use 
57    system-auth (this pam is in 6.x errata at least)
58
59 * Tue Mar 27 2001 John H Terpstra <jht@samba.org>
60  - Fixed typos introduced by Sum Wun.
61  - Build for Red Hat 7.x
62
63 * Sun Nov 12 2000 John H Terpstra <jht@samba.org>
64  - Updated for Samba-2.2 releases
65  - Added libnss_wins.so stuff
66  - Added compile-time options
67
68 * Sat Nov 29 1999 Matthew Vanecek <mev0003@unt.edu>
69  - Added a Prefix and changed "/usr" to "%{prefix}"
70
71 * Sat Nov 11 1999 Tridge <tridge@linuxcare.com>
72  - changed from mount.smb to mount.smbfs
73
74 * Sat Oct 9 1999 Tridge <tridge@linuxcare.com>
75  - removed smbwrapper
76  - added smbmnt and smbmount
77
78 * Sun Apr 25 1999 John H Terpstra <jht@samba.org>
79  - added smbsh.1 man page
80
81 * Fri Mar 26 1999 Andrew Tridgell <tridge@samba.org>
82  - added --with-pam as pam is no longer used by default
83
84 * Sat Jan 27 1999 Jeremy Allison <jra@samba.org>
85  - Removed smbrun binary and tidied up some loose ends
86
87 * Sun Oct 25 1998 John H Terpstra <jht@samba.org>
88  - Added parameters to /config to ensure smb.conf, lmhosts, 
89         and smbusers never gets over-written.
90
91 * Sat Oct 24 1998 John H Terpstra <jht@samba.org>
92  - removed README.smbsh file from docs area
93
94 * Mon Oct 05 1998 John H Terpstra <jht@samba.org>
95  - Added rpcclient to binaries list
96  - Added smbwrapper stuff
97
98 * Fri Aug 21 1998 John H Terpstra <jht@samba.org>
99  - Updated for Samba version 2.0 building
100
101 * Tue Jul 07 1998 Erik Troan <ewt@redhat.com>
102   - updated postun triggerscript to check $0
103   - clear /etc/codepages from %preun instead of %postun
104
105 * Sat Jul 04 1998 John H Terpstra <jht@samba.org>
106  - fixed codepage preservation during update via -Uvh
107
108 * Mon Jun 08 1998 Erik Troan <ewt@redhat.com>
109   - made the %postun script a tad less agressive; no reason to remove
110     the logs or lock file 
111   - the %postun and %preun should only exectute if this is the final
112     removal
113   - migrated %triggerpostun from Red Hat's samba package to work around
114     packaging problems in some Red Hat samba releases
115
116 * Sun Apr 26 1998 John H Terpstra <jht@samba.org>
117  - Tidy up for early alpha releases
118  - added findsmb from SGI packaging
119
120 * Thu Apr 09 1998 John H Terpstra <jht@samba.org>
121  - Updated spec file
122  - Included new codepage.936
123
124 * Sat Mar 20 1998 John H Terpstra <jht@samba.org>
125  - Added swat facility
126
127 * Sat Jan 24 1998 John H Terpstra <jht@samba.org>
128  - Many optimisations (some suggested by Manoj Kasichainula <manojk@io.com>
129   - Use of chkconfig in place of individual symlinks to /etc/rc.d/init/smb
130   - Compounded make line
131   - Updated smb.init restart mechanism
132   - Use compound mkdir -p line instead of individual calls to mkdir
133   - Fixed smb.conf file path for log files
134   - Fixed smb.conf file path for incoming smb print spool directory
135   - Added a number of options to smb.conf file
136   - Added smbuser file and smb.conf file updates for username map
137
138 %prep
139 %setup
140
141 %build
142 ## Build main Samba source
143 cd source
144
145 %ifarch ia64
146 libtoolize --copy --force     # get it to recognize IA-64
147 autoheader
148 autoconf
149 EXTRA="-D_LARGEFILE64_SOURCE"
150 %endif
151 NUMCPU=`grep processor /proc/cpuinfo | wc -l`
152 CFLAGS="$RPM_OPT_FLAGS $EXTRA" ./configure \
153         --prefix=%{prefix} \
154         --localstatedir=/var \
155         --with-configdir=/etc/samba \
156         --with-privatedir=/etc/samba \
157         --with-fhs \
158         --with-quotas \
159         --with-msdfs \
160         --with-smbmount \
161         --with-pam \
162         --with-pam_smbpass \
163         --with-syslog \
164         --with-utmp \
165         --with-sambabook=%{prefix}/share/swat/using_samba \
166         --with-swatdir=%{prefix}/share/swat \
167         --with-libsmbclient 
168 make -j${NUMCPU} proto
169 make -j${NUMCPU} all nsswitch/libnss_wins.so
170 make -j${NUMCPU} debug2html
171 make -j${NUMCPU} bin/smbspool
172
173 ## Build VFS modules
174 cd ../examples/VFS
175 make
176
177
178
179 %install
180 rm -rf $RPM_BUILD_ROOT
181 mkdir -p $RPM_BUILD_ROOT
182 mkdir -p $RPM_BUILD_ROOT/sbin
183 mkdir -p $RPM_BUILD_ROOT/etc/samba
184 mkdir -p $RPM_BUILD_ROOT/etc/{logrotate.d,pam.d,samba}
185 mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
186 mkdir -p $RPM_BUILD_ROOT%{prefix}/{bin,sbin}
187 mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/{images,help,include,using_samba}
188 mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/using_samba/{figs,gifs}
189 mkdir -p $RPM_BUILD_ROOTMANDIR_MACRO
190 mkdir -p $RPM_BUILD_ROOT/var/cache/samba
191 mkdir -p $RPM_BUILD_ROOT/var/{log,run}/samba
192 mkdir -p $RPM_BUILD_ROOT/var/spool/samba
193 mkdir -p $RPM_BUILD_ROOT/lib/security
194 mkdir -p $RPM_BUILD_ROOT%{prefix}/lib/samba/vfs
195 mkdir -p $RPM_BUILD_ROOT%{prefix}/{lib,include}
196
197 # Install standard binary files
198 for i in nmblookup smbclient smbpasswd smbstatus testparm testprns \
199       rpcclient smbspool smbcacls smbcontrol wbinfo smbmnt
200 do
201         install -m755 source/bin/$i $RPM_BUILD_ROOT%{prefix}/bin
202 done
203
204 for i in mksmbpasswd.sh smbtar findsmb
205 do
206         install -m755 source/script/$i $RPM_BUILD_ROOT%{prefix}/bin
207 done
208
209 # Install secure binary files
210 for i in smbd nmbd swat smbmount smbumount debug2html winbindd
211 do
212         install -m755 source/bin/$i $RPM_BUILD_ROOT%{prefix}/sbin
213 done
214
215 # we need a symlink for mount to recognise the smb and smbfs filesystem types
216 ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smbfs
217 ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smb
218
219 # This allows us to get away without duplicating code that 
220 #  sombody else can maintain for us.  
221 cd source
222 make BASEDIR=$RPM_BUILD_ROOT/usr \
223         LIBDIR=$RPM_BUILD_ROOT/etc/samba \
224         VARDIR=$RPM_BUILD_ROOT/var \
225         SBINDIR=$RPM_BUILD_ROOT%{prefix}/sbin \
226         BINDIR=$RPM_BUILD_ROOT%{prefix}/bin \
227         MANDIR=$RPM_BUILD_ROOTMANDIR_MACRO \
228         SWATDIR=$RPM_BUILD_ROOT/usr/share/swat \
229         SAMBABOOK=$RPM_BUILD_ROOT/usr/share/swat/using_samba \
230         installman installswat
231 cd ..
232
233 # Install the nsswitch wins library
234 install -m755 source/nsswitch/libnss_wins.so $RPM_BUILD_ROOT/lib
235
236 # Make link for wins resolver
237 ( cd $RPM_BUILD_ROOT/lib; ln -sf libnss_wins.so libnss_wins.so.2; )
238
239 # Install winbind shared libraries
240 install -m755 source/nsswitch/libnss_winbind.so $RPM_BUILD_ROOT/lib
241 install -m755 source/nsswitch/pam_winbind.so $RPM_BUILD_ROOT/lib/security
242
243 # Install pam_smbpass.so
244 install -m755 source/bin/pam_smbpass.so $RPM_BUILD_ROOT/lib/security
245
246 # Install the VFS modules
247 install -m755 examples/VFS/recycle.so $RPM_BUILD_ROOT%{prefix}/lib/samba/vfs
248 install -m755 examples/VFS/audit.so $RPM_BUILD_ROOT%{prefix}/lib/samba/vfs
249 install -m755 examples/VFS/netatalk.so $RPM_BUILD_ROOT%{prefix}/lib/samba/vfs
250
251 # clean out VFS directory since it will get installed as documentation later
252 (cd examples/VFS; make clean)
253
254 # libsmbclient
255 install -m 755 source/bin/libsmbclient.so $RPM_BUILD_ROOT%{prefix}/lib/
256 install -m 755 source/bin/libsmbclient.a $RPM_BUILD_ROOT%{prefix}/lib/
257 install -m 644 source/include/libsmbclient.h $RPM_BUILD_ROOT%{prefix}/include/
258
259 # Install SWAT helper files
260 for i in swat/help/*.html docs/htmldocs/*.html
261 do
262         install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/help
263 done
264 for i in swat/images/*.gif
265 do
266         install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/images
267 done
268 for i in swat/include/*.html
269 do
270         install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/include
271 done
272
273 # Install the miscellany
274 install -m644 swat/README $RPM_BUILD_ROOT%{prefix}/share/swat
275 install -m755 packaging/RedHat/smbprint $RPM_BUILD_ROOT%{prefix}/bin
276 install -m755 packaging/RedHat/smb.init $RPM_BUILD_ROOT/etc/rc.d/init.d/smb
277 install -m755 packaging/RedHat/winbind.init $RPM_BUILD_ROOT/etc/rc.d/init.d/winbind
278 install -m755 packaging/RedHat/smb.init $RPM_BUILD_ROOT%{prefix}/sbin/samba
279 install -m644 packaging/RedHat/samba.log $RPM_BUILD_ROOT/etc/logrotate.d/samba
280 install -m644 packaging/RedHat/smb.conf $RPM_BUILD_ROOT/etc/samba/smb.conf
281 install -m644 packaging/RedHat/smbusers $RPM_BUILD_ROOT/etc/samba/smbusers
282 install -m644 packaging/RedHat/samba.pamd $RPM_BUILD_ROOT/etc/pam.d/samba
283 install -m644 packaging/RedHat/samba.pamd.stack $RPM_BUILD_ROOT/etc/samba/samba.stack
284 install -m644 packaging/RedHat/samba.xinetd $RPM_BUILD_ROOT/etc/samba/samba.xinetd
285 echo 127.0.0.1 localhost > $RPM_BUILD_ROOT/etc/samba/lmhosts
286
287 %clean
288 rm -rf $RPM_BUILD_ROOT
289
290 %post
291 /sbin/chkconfig --add smb
292 /sbin/chkconfig --add winbind
293 /sbin/chkconfig smb off
294 /sbin/chkconfig winbind off
295
296 echo "Looking for old /etc/smb.conf..."
297 if [ -f /etc/smb.conf -a ! -f /etc/samba/smb.conf ]; then
298         echo "Moving old /etc/smb.conf to /etc/samba/smb.conf"
299         mv /etc/smb.conf /etc/samba/smb.conf
300 fi
301
302 echo "Looking for old /etc/smbusers..."
303 if [ -f /etc/smbusers -a ! -f /etc/samba/smbusers ]; then
304         echo "Moving old /etc/smbusers to /etc/samba/smbusers"
305         mv /etc/smbusers /etc/samba/smbusers
306 fi
307
308 echo "Looking for old /etc/lmhosts..."
309 if [ -f /etc/lmhosts -a ! -f /etc/samba/lmhosts ]; then
310         echo "Moving old /etc/lmhosts to /etc/samba/lmhosts"
311         mv /etc/lmhosts /etc/samba/lmhosts
312 fi
313
314 echo "Looking for old /etc/MACHINE.SID..."
315 if [ -f /etc/MACHINE.SID -a ! -f /etc/samba/MACHINE.SID ]; then
316         echo "Moving old /etc/MACHINE.SID to /etc/samba/MACHINE.SID"
317         mv /etc/MACHINE.SID /etc/samba/MACHINE.SID
318 fi
319
320 echo "Looking for old /etc/smbpasswd..."
321 if [ -f /etc/smbpasswd -a ! -f /etc/samba/smbpasswd ]; then
322         echo "Moving old /etc/smbpasswd to /etc/samba/smbpasswd"
323         mv /etc/smbpasswd /etc/samba/smbpasswd
324 fi
325
326 #
327 # For 2.2.1 we move the tdb files from /var/lock/samba to /var/cache/samba
328 # to preserve across reboots.
329 #
330 echo "Moving tdb files in /var/lock/samba/*.tdb to /var/cache/samba/*.tdb"
331 for i in /var/lock/samba/*.tdb
332 do
333 if [ -f $i ]; then
334         newname=`echo $i | sed -e's|var\/lock\/samba|var\/cache\/samba|'`
335         echo "Moving $i to $newname"
336         mv $i $newname
337 fi
338 done
339
340 # Remove the transient tdb files.
341 if [ -e /var/cache/samba/brlock.tdb ]; then
342         rm -f /var/cache/samba/brlock.tdb
343 fi
344
345 if [ -e /var/cache/samba/unexpected.tdb ]; then
346         rm -f /var/cache/samba/unexpected.tdb
347 fi
348
349 if [ -e /var/cache/samba/connections.tdb ]; then
350         rm -f /var/cache/samba/connections.tdb
351 fi
352
353 if [ -e /var/cache/samba/locking.tdb ]; then
354         rm -f /var/cache/samba/locking.tdb
355 fi
356
357 if [ -e /var/cache/samba/messages.tdb ]; then
358         rm -f /var/cache/samba/messages.tdb
359 fi
360
361 if [ -d /var/lock/samba ]; then
362         rm -rf /var/lock/samba
363 fi
364
365 # Add swat entry to /etc/services if not already there.
366 if !( grep ^[:space:]*swat /etc/services > /dev/null ) then
367         echo 'swat              901/tcp                         # Add swat service used via inetd' >> /etc/services
368 fi
369
370 # Add swat entry to /etc/inetd.conf if needed.
371 if [ -f /etc/inetd.conf ]; then
372         if !( grep ^[:space:]*swat /etc/inetd.conf > /dev/null ) then
373                 echo 'swat      stream  tcp     nowait.400      root    %{prefix}/sbin/swat swat' >> /etc/inetd.conf
374         killall -1 inetd || :
375         fi
376 fi
377
378 # Add swat entry to xinetd.d if needed.
379 if [ -d $RPM_BUILD_ROOT/etc/xinetd.d -a ! -f /etc/xinetd.d/swat ]; then
380         mv /etc/samba/samba.xinetd /etc/xinetd.d/swat
381 else
382         rm -f /etc/samba/samba.xinetd
383 fi
384
385 # Install the correct version of the samba pam file, depending on pam version.
386 if [ -f /lib/security/pam_stack.so ]; then
387         echo "Installing stack version of /etc/pam.d/samba..."
388         mv /etc/samba/samba.stack /etc/pam.d/samba
389 else
390         echo "Installing non-stack version of /etc/pam.d/samba..."
391         rm -f /etc/samba/samba.stack
392 fi
393
394 # Create winbind nss client symlink
395
396 if [ -e /lib/libnss_winbind.so ]; then
397         ln -sf /lib/libnss_winbind.so /lib/libnss_winbind.so.2
398 fi
399
400 %preun
401 if [ $1 = 0 ] ; then
402         /sbin/chkconfig --del smb
403
404         # We want to remove the browse.dat and wins.dat files so they can not interfer with a new version of samba!
405         if [ -e /var/cache/samba/browse.dat ]; then
406                 rm -f /var/cache/samba/browse.dat
407         fi
408         if [ -e /var/cache/samba/wins.dat ]; then
409                 rm -f /var/cache/samba/wins.dat
410         fi
411
412         # Remove the transient tdb files.
413         if [ -e /var/cache/samba/brlock.tdb ]; then
414                 rm -f /var/cache/samba/brlock.tdb
415         fi
416
417         if [ -e /var/cache/samba/unexpected.tdb ]; then
418                 rm -f /var/cache/samba/unexpected.tdb
419         fi
420
421         if [ -e /var/cache/samba/connections.tdb ]; then
422                 rm -f /var/cache/samba/connections.tdb
423         fi
424
425         if [ -e /var/cache/samba/locking.tdb ]; then
426                 rm -f /var/cache/samba/locking.tdb
427         fi
428
429         if [ -e /var/cache/samba/messages.tdb ]; then
430                 rm -f /var/cache/samba/messages.tdb
431         fi
432
433         # Remove winbind nss client symlink
434
435         if [ -L /lib/libnss_winbind.so.2 ]; then
436                 rm -f /lib/libnss_winbind.so.2
437         fi
438 fi
439
440 %postun
441 # Only delete remnants of samba if this is the final deletion.
442 if [ $1 = 0 ] ; then
443     if [ -x /etc/pam.d/samba ]; then
444       rm -f /etc/pam.d/samba
445     fi
446     if [ -e /var/log/samba ]; then
447       rm -rf /var/log/samba
448     fi
449         if [ -e /var/cache/samba ]; then
450                 rm -rf /var/cache/samba
451         fi
452
453     # Remove swat entries from /etc/inetd.conf and /etc/services
454     cd /etc
455     tmpfile=/etc/tmp.$$
456         if [ -f /etc/inetd.conf ]; then
457       # preserve inetd.conf permissions.
458       cp -p /etc/inetd.conf $tmpfile
459       sed -e '/^[:space:]*swat.*$/d' /etc/inetd.conf > $tmpfile
460       mv $tmpfile inetd.conf
461         fi
462     # preserve services permissions.
463     cp -p /etc/services $tmpfile
464     sed -e '/^[:space:]*swat.*$/d' /etc/services > $tmpfile
465     mv $tmpfile /etc/services
466
467         # Remove swat entry from /etc/xinetd.d
468         if [ -f /etc/xinetd.d/swat ]; then
469                 rm -r /etc/xinetd.d/swat
470         fi
471 fi
472
473 %triggerpostun -- samba < samba-2.0.0
474 if [ $0 != 0 ]; then
475     /sbin/chkconfig --add smb
476 fi
477
478 %files
479 %defattr(-,root,root)
480 %doc README COPYING Manifest Read-Manifest-Now
481 %doc WHATSNEW.txt Roadmap
482 %doc docs
483 %doc swat/README
484 %doc examples
485 %{prefix}/sbin/smbd
486 %{prefix}/sbin/nmbd
487 %{prefix}/sbin/swat
488 %{prefix}/bin/smbmnt
489 %{prefix}/sbin/smbmount
490 %{prefix}/sbin/smbumount
491 %{prefix}/sbin/winbindd
492 /sbin/mount.smbfs
493 /sbin/mount.smb
494 %{prefix}/bin/mksmbpasswd.sh
495 %{prefix}/bin/smbclient
496 %{prefix}/bin/smbspool
497 %{prefix}/bin/rpcclient
498 %{prefix}/bin/testparm
499 %{prefix}/bin/testprns
500 %{prefix}/bin/findsmb
501 %{prefix}/bin/smbstatus
502 %{prefix}/bin/nmblookup
503 %{prefix}/bin/smbpasswd
504 %{prefix}/bin/smbtar
505 %{prefix}/bin/smbprint
506 %{prefix}/bin/smbcontrol
507 %{prefix}/bin/smbcacls
508 %{prefix}/bin/wbinfo
509 %attr(755,root,root) /lib/libnss_wins.s*
510 %attr(755,root,root) %{prefix}/lib/samba/vfs/*.so
511 %{prefix}/include/libsmbclient.h
512 %{prefix}/lib/libsmbclient.a
513 %{prefix}/lib/libsmbclient.so
514 %{prefix}/share/swat/help/*
515 %{prefix}/share/swat/images/*
516 %{prefix}/share/swat/include/header.html
517 %{prefix}/share/swat/include/footer.html
518 %{prefix}/share/swat/using_samba/*
519 %config(noreplace) /etc/samba/lmhosts
520 %config(noreplace) /etc/samba/smb.conf
521 %config(noreplace) /etc/samba/smbusers
522 /etc/samba/samba.stack
523 /etc/samba/samba.xinetd
524 /etc/rc.d/init.d/smb
525 /etc/rc.d/init.d/winbind
526 /etc/logrotate.d/samba
527 %config(noreplace) /etc/pam.d/samba
528 MANDIR_MACRO/man1/*
529 MANDIR_MACRO/man5/*
530 MANDIR_MACRO/man7/*
531 MANDIR_MACRO/man8/*
532 %attr(755,root,root) %dir /var/cache/samba
533 %dir /var/log/samba
534 %dir /var/run/samba
535 %attr(1777,root,root) %dir /var/spool/samba
536 %attr(-,root,root) /lib/libnss_winbind.so
537 %attr(-,root,root) /lib/security/pam_winbind.so
538 %attr(-,root,root) /lib/security/pam_smbpass.so