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