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